From 9f52d19a6b3f8e9805f89347de1fca5bbbe7681d Mon Sep 17 00:00:00 2001 From: e-koch Date: Wed, 16 Jan 2019 15:46:17 -0700 Subject: [PATCH 01/16] Old bug doesn't set "minor" for beams when array_finalize is used --- radio_beam/multiple_beams.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio_beam/multiple_beams.py b/radio_beam/multiple_beams.py index dc7d2df..af88fd0 100644 --- a/radio_beam/multiple_beams.py +++ b/radio_beam/multiple_beams.py @@ -144,7 +144,7 @@ def __array_finalize__(self, obj): if isinstance(obj, Beams): self.major = obj.major - self.minajor = obj.minor + self.minor = obj.minor self.pa = obj.pa self.meta = obj.meta From 52108fef6b9cc65e45906795398b9c6d5f6fb1d4 Mon Sep 17 00:00:00 2001 From: e-koch Date: Wed, 16 Jan 2019 15:53:22 -0700 Subject: [PATCH 02/16] Beams arithmetic doesn't really work, and we don't really need it to either --- radio_beam/tests/test_beams.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/radio_beam/tests/test_beams.py b/radio_beam/tests/test_beams.py index bf21d66..d3d6fbd 100644 --- a/radio_beam/tests/test_beams.py +++ b/radio_beam/tests/test_beams.py @@ -91,6 +91,20 @@ def test_indexing(): assert np.all(beams[mask].major.value == majors[mask].value) +# Arithmetic like this only works for circular beams +# Keep commented out for now. +# def test_beams_arithmetic(): + +# beams, majors = symm_beams_for_tests()[:2] + +# areas = 2 * np.pi / (8 * np.log(2)) * (majors.to(u.rad)**2).to(u.sr) + +# new_beams = beams * 2 + +# assert np.all(areas.value == beams.sr.value) +# assert np.all(beams.value == beams.sr.value) + + def test_average_beams(): beams, majors = symm_beams_for_tests()[:2] From a0305156b4154c3696913c25716a185d065765c0 Mon Sep 17 00:00:00 2001 From: e-koch Date: Wed, 16 Jan 2019 16:27:20 -0700 Subject: [PATCH 03/16] Try correcting the major and minor axes when operations use array_finalize --- radio_beam/multiple_beams.py | 11 +++++++++-- radio_beam/tests/test_beams.py | 14 ++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/radio_beam/multiple_beams.py b/radio_beam/multiple_beams.py index af88fd0..a0d5243 100644 --- a/radio_beam/multiple_beams.py +++ b/radio_beam/multiple_beams.py @@ -143,11 +143,18 @@ def __array_finalize__(self, obj): self._set_unit(unit) if isinstance(obj, Beams): - self.major = obj.major - self.minor = obj.minor + # Multiplication and division should change the area, + # but not the PA or major/minor ratio + sqrt_ratios = np.sqrt(obj.sr / self.sr) + + self.major = sqrt_ratios * obj.major + self.minor = sqrt_ratios * obj.minor + self.pa = obj.pa self.meta = obj.meta + self.sr = obj.sr + # Copy info if the original had `info` defined. Because of the way the # DataInfo works, `'info' in obj.__dict__` is False until the # `info` attribute is accessed or set. Note that `obj` can be an diff --git a/radio_beam/tests/test_beams.py b/radio_beam/tests/test_beams.py index d3d6fbd..245cc87 100644 --- a/radio_beam/tests/test_beams.py +++ b/radio_beam/tests/test_beams.py @@ -93,16 +93,18 @@ def test_indexing(): # Arithmetic like this only works for circular beams # Keep commented out for now. -# def test_beams_arithmetic(): +def test_beams_arithmetic(): -# beams, majors = symm_beams_for_tests()[:2] + beams, majors = symm_beams_for_tests()[:2] -# areas = 2 * np.pi / (8 * np.log(2)) * (majors.to(u.rad)**2).to(u.sr) + new_beams = beams * 2 -# new_beams = beams * 2 + assert np.all(new_beams.sr.value == 2 * beams.sr.value) -# assert np.all(areas.value == beams.sr.value) -# assert np.all(beams.value == beams.sr.value) + sqrt_2 = np.sqrt(2) + # Major and minor axes should be sqrt(2) larger + assert np.all(new_beams.major.value == sqrt_2 * beams.major.value) + assert np.all(new_beams.minor.value == sqrt_2 * beams.minor.value) def test_average_beams(): From eae3a8573a1d72416d8ff4d3a73ec000deb9d314 Mon Sep 17 00:00:00 2001 From: e-koch Date: Wed, 16 Jan 2019 17:52:05 -0700 Subject: [PATCH 04/16] Set arithmetic operations for Beams matching what Beam does --- radio_beam/multiple_beams.py | 78 ++++++++++++++++++++++++++++++++---- radio_beam/utils.py | 4 ++ 2 files changed, 74 insertions(+), 8 deletions(-) diff --git a/radio_beam/multiple_beams.py b/radio_beam/multiple_beams.py index a0d5243..bd2550b 100644 --- a/radio_beam/multiple_beams.py +++ b/radio_beam/multiple_beams.py @@ -8,6 +8,7 @@ from .beam import Beam, _to_area, SIGMA_TO_FWHM from .commonbeam import commonbeam +from .utils import InvalidBeamOperationError class Beams(u.Quantity): @@ -16,7 +17,8 @@ class Beams(u.Quantity): """ def __new__(cls, major=None, minor=None, pa=None, - areas=None, default_unit=u.arcsec, meta=None): + areas=None, default_unit=u.arcsec, meta=None, + beams=None): """ Create a new set of Gaussian beams @@ -34,12 +36,20 @@ def __new__(cls, major=None, minor=None, pa=None, Gaussian beam. default_unit : :class:`~astropy.units.Unit` The unit to impose on major, minor if they are specified as floats + beams : List of :class:`~radio_beam.Beam` objects + List of individual `Beam` objects. The resulting `Beams` object will + have major and minor axes in degrees. """ # improve to some kwargs magic later # error checking + if beams is not None: + major = [beam.major.to(u.deg).value for beam in beams] * u.deg + minor = [beam.major.to(u.deg).value for beam in beams] * u.deg + pa = [beam.pa.to(u.deg).value for beam in beams] * u.deg + # ... given an area make a round beam assuming it is Gaussian if areas is not None: rad = np.sqrt(areas / (2 * np.pi)) * u.deg @@ -145,16 +155,11 @@ def __array_finalize__(self, obj): if isinstance(obj, Beams): # Multiplication and division should change the area, # but not the PA or major/minor ratio - sqrt_ratios = np.sqrt(obj.sr / self.sr) - - self.major = sqrt_ratios * obj.major - self.minor = sqrt_ratios * obj.minor - + self.major = obj.major + self.minor = obj.minor self.pa = obj.pa self.meta = obj.meta - self.sr = obj.sr - # Copy info if the original had `info` defined. Because of the way the # DataInfo works, `'info' in obj.__dict__` is False until the # `info` attribute is accessed or set. Note that `obj` can be an @@ -332,3 +337,60 @@ def common_beam(self, includemask=None, method='pts', **kwargs): def __iter__(self): for i in range(len(self)): yield self[i] + + def __mul__(self, other): + # Other must be a single beam. Assume multiplying is convolving + # as set of beams with a given beam + if not isinstance(other, Beam): + raise InvalidBeamOperationError("Multiplication is defined as a " + "convolution of the set of beams " + "with a given beam. Must be " + "multiplied with a Beam object.") + + return Beams(beams=[beam * other for beam in self]) + + def __div__(self, other): + # Other must be a single beam. Assume dividing is deconvolving + # as set of beams with a given beam + if not isinstance(other, Beam): + raise InvalidBeamOperationError("Division is defined as a " + "deconvolution of the set of beams" + " with a given beam. Must be " + "divided by a Beam object.") + + return Beams(beams=[beam - other for beam in self]) + + def __add__(self, other): + raise InvalidBeamOperationError("Addition of a set of Beams " + "is not defined.") + + def __sub__(self, other): + raise InvalidBeamOperationError("Addition of a set of Beams " + "is not defined.") + + def __eq__(self, other): + # other should be a single beam, or a another Beams object + if isinstance(other, Beam): + return np.array([beam == other for beam in self]) + elif isinstance(other, Beams): + # These should have the same size. + if not self.size == other.size: + raise InvalidBeamOperationError("Beams objects must have the " + "same shape to test " + "equality.") + + return np.all([beam == other_beam for beam, other_beam in + zip(self, other)]) + else: + raise InvalidBeamOperationError("Must test equality with a Beam" + " or Beams object.") + + def __ne__(self, other): + eq_out = self.__eq__(other) + + # If other is a Beam, will get array back + if isinstance(eq_out, np.ndarray): + return ~eq_out + # If other is a Beams, will get boolean back + else: + return not eq_out diff --git a/radio_beam/utils.py b/radio_beam/utils.py index 1ac419a..8d83dea 100644 --- a/radio_beam/utils.py +++ b/radio_beam/utils.py @@ -8,6 +8,10 @@ class BeamError(Exception): pass +class InvalidBeamOperationError(Exception): + pass + + def deconvolve(beam, other, failure_returns_pointlike=False): """ Deconvolve a beam from another From 5f78e849b2e0d7a12bdc437353a9231366a4e870 Mon Sep 17 00:00:00 2001 From: e-koch Date: Wed, 16 Jan 2019 18:06:54 -0700 Subject: [PATCH 05/16] Make dividing also give deconvolution in Beam --- radio_beam/beam.py | 3 +++ radio_beam/tests/test_beam.py | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/radio_beam/beam.py b/radio_beam/beam.py index 716b743..e38241e 100644 --- a/radio_beam/beam.py +++ b/radio_beam/beam.py @@ -348,6 +348,9 @@ def __mul__(self, other): def __sub__(self, other): return self.deconvolve(other) + def __truediv__(self, other): + return self.deconvolve(other) + def deconvolve(self, other, failure_returns_pointlike=False): """ Deconvolve a beam from another diff --git a/radio_beam/tests/test_beam.py b/radio_beam/tests/test_beam.py index adfc5c8..3b0b9f6 100644 --- a/radio_beam/tests/test_beam.py +++ b/radio_beam/tests/test_beam.py @@ -247,6 +247,10 @@ def test_conv_deconv(): assert beam2 == beam3 - beam1 assert beam1 == beam3 - beam2 + # Dividing should give the same thing + assert beam2 == beam3 / beam1 + assert beam1 == beam3 / beam2 + assert beam3 == beam1 * beam2 From 503170162fe71354b6c0203d40aafe030af95dd8 Mon Sep 17 00:00:00 2001 From: e-koch Date: Wed, 16 Jan 2019 18:07:26 -0700 Subject: [PATCH 06/16] Need to use truediv --- radio_beam/multiple_beams.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio_beam/multiple_beams.py b/radio_beam/multiple_beams.py index bd2550b..b806b4c 100644 --- a/radio_beam/multiple_beams.py +++ b/radio_beam/multiple_beams.py @@ -349,7 +349,7 @@ def __mul__(self, other): return Beams(beams=[beam * other for beam in self]) - def __div__(self, other): + def __truediv__(self, other): # Other must be a single beam. Assume dividing is deconvolving # as set of beams with a given beam if not isinstance(other, Beam): From f81a179d6405adf5d253a5db92c2a7ecf2458d45 Mon Sep 17 00:00:00 2001 From: e-koch Date: Wed, 16 Jan 2019 18:08:17 -0700 Subject: [PATCH 07/16] Add a bunch of operation tests for Beams --- radio_beam/tests/test_beams.py | 106 +++++++++++++++++++++++++++++---- 1 file changed, 94 insertions(+), 12 deletions(-) diff --git a/radio_beam/tests/test_beams.py b/radio_beam/tests/test_beams.py index 245cc87..38b521f 100644 --- a/radio_beam/tests/test_beams.py +++ b/radio_beam/tests/test_beams.py @@ -9,6 +9,7 @@ from ..multiple_beams import Beams from ..beam import Beam from ..commonbeam import common_2beams, common_manybeams_mve +from ..utils import InvalidBeamOperationError from .test_beam import data_path @@ -62,6 +63,97 @@ def test_beams_from_fits_bintable(): assert (beams.pa.value == bintable.data['BPA']).all() +def test_beams_from_list_of_beam(): + + beams, majors = symm_beams_for_tests()[:2] + + new_beams = Beams(beams=[beam for beam in beams]) + + assert beams == new_beams + + +def test_beams_equality_beams(): + + beams, majors = symm_beams_for_tests()[:2] + + assert beams == beams + + assert not beams != beams + + abeams, amajors = asymm_beams_for_tests()[:2] + + assert not (beams == abeams) + + assert beams != abeams + + +def test_beams_equality_beam(): + + # Test whether all are equal to a single beam + beams = Beams([1.] * 5 * u.arcsec) + + beam = Beam(1 * u.arcsec) + + assert np.all(beams == beam) + + assert not np.any(beams != beam) + + +@pytest.mark.xfail(raises=InvalidBeamOperationError, strict=True) +def test_beams_equality_fail(): + + # Test whether all are equal to a single beam + beams = Beams([1.] * 5 * u.arcsec) + + beams == 2 + + +@pytest.mark.xfail(raises=InvalidBeamOperationError, strict=True) +def test_beams_notequality_fail(): + + # Test whether all are equal to a single beam + beams = Beams([1.] * 5 * u.arcsec) + + beams != 2 + + +@pytest.mark.xfail(raises=InvalidBeamOperationError, strict=True) +def test_beams_equality_fail_shape(): + + # Test whether all are equal to a single beam + beams = Beams([1.] * 5 * u.arcsec) + + assert np.all(beams == beams[1:]) + + +def test_beams_mult_convolution(): + + beams, majors = asymm_beams_for_tests()[:2] + + beam = Beam(1 * u.arcsec) + + conv_beams = beams * beam + + individ_conv_beams = [beam_i.convolve(beam) for beam_i in beams] + new_beams = Beams(beams=individ_conv_beams) + + assert conv_beams == new_beams + + +def test_beams_div_deconvolution(): + + beams, majors = asymm_beams_for_tests()[:2] + + beam = Beam(0.25 * u.arcsec) + + deconv_beams = beams / beam + + individ_deconv_beams = [beam_i.deconvolve(beam) for beam_i in beams] + new_beams = Beams(beams=individ_deconv_beams) + + assert deconv_beams == new_beams + + def test_indexing(): beams, majors = symm_beams_for_tests()[:2] @@ -91,20 +183,10 @@ def test_indexing(): assert np.all(beams[mask].major.value == majors[mask].value) -# Arithmetic like this only works for circular beams -# Keep commented out for now. -def test_beams_arithmetic(): - - beams, majors = symm_beams_for_tests()[:2] - - new_beams = beams * 2 +# def test_beams_mult_convolution(): - assert np.all(new_beams.sr.value == 2 * beams.sr.value) +# beams, majors = symm_beams_for_tests()[:2] - sqrt_2 = np.sqrt(2) - # Major and minor axes should be sqrt(2) larger - assert np.all(new_beams.major.value == sqrt_2 * beams.major.value) - assert np.all(new_beams.minor.value == sqrt_2 * beams.minor.value) def test_average_beams(): From 424f57ec82ec64b5ea8efcccdea3e56fd71b9fd7 Mon Sep 17 00:00:00 2001 From: e-koch Date: Wed, 16 Jan 2019 18:12:40 -0700 Subject: [PATCH 08/16] Add more simple operation tests for failures --- radio_beam/tests/test_beams.py | 35 ++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/radio_beam/tests/test_beams.py b/radio_beam/tests/test_beams.py index 38b521f..82dae72 100644 --- a/radio_beam/tests/test_beams.py +++ b/radio_beam/tests/test_beams.py @@ -125,6 +125,41 @@ def test_beams_equality_fail_shape(): assert np.all(beams == beams[1:]) +@pytest.mark.xfail(raises=InvalidBeamOperationError, strict=True) +def test_beams_add_fail(): + + # Test whether all are equal to a single beam + beams = Beams([1.] * 5 * u.arcsec) + + beams + 2 + + +@pytest.mark.xfail(raises=InvalidBeamOperationError, strict=True) +def test_beams_sub_fail(): + + # Test whether all are equal to a single beam + beams = Beams([1.] * 5 * u.arcsec) + + beams - 2 + + +@pytest.mark.xfail(raises=InvalidBeamOperationError, strict=True) +def test_beams_mult_fail(): + + # Test whether all are equal to a single beam + beams = Beams([1.] * 5 * u.arcsec) + + beams * 2 + + +@pytest.mark.xfail(raises=InvalidBeamOperationError, strict=True) +def test_beams_div_fail(): + + # Test whether all are equal to a single beam + beams = Beams([1.] * 5 * u.arcsec) + + beams / 2 + def test_beams_mult_convolution(): From b37b21ee7abb8fb1ad885cfb0d62602b35ca0ad8 Mon Sep 17 00:00:00 2001 From: e-koch Date: Wed, 16 Jan 2019 18:33:58 -0700 Subject: [PATCH 09/16] Update conftest --- radio_beam/conftest.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/radio_beam/conftest.py b/radio_beam/conftest.py index 10cac21..bdaf64c 100644 --- a/radio_beam/conftest.py +++ b/radio_beam/conftest.py @@ -2,8 +2,19 @@ # by importing them here in conftest.py they are discoverable by py.test # no matter how it is invoked within the source tree. -from astropy.tests.pytest_plugins import * +from astropy.version import version as astropy_version +if astropy_version < '3.0': + # With older versions of Astropy, we actually need to import the pytest + # plugins themselves in order to make them discoverable by pytest. + from astropy.tests.pytest_plugins import * +else: + # As of Astropy 3.0, the pytest plugins provided by Astropy are + # automatically made available when Astropy is installed. This means it's + # not necessary to import them here, but we still need to import global + # variables that are used for configuration. + from astropy.tests.plugins.display import PYTEST_HEADER_MODULES, TESTED_VERSIONS +from astropy.tests.helper import enable_deprecations_as_exceptions ## Uncomment the following line to treat all DeprecationWarnings as ## exceptions # enable_deprecations_as_exceptions() From 3f2996aafd3871c23747fe74285e33cbd0763f59 Mon Sep 17 00:00:00 2001 From: e-koch Date: Wed, 16 Jan 2019 18:36:57 -0700 Subject: [PATCH 10/16] Drop testing np <1.13 with py3.5. Critical older versions (like for CASA) are already tested --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7ca71a3..f58e0a4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -96,8 +96,6 @@ matrix: # versions of Python, we can vary Python and Numpy versions at the same # time. - - os: linux - env: PYTHON_VERSION=3.5 NUMPY_VERSION=1.12 - os: linux env: PYTHON_VERSION=3.6 NUMPY_VERSION=1.13 - os: linux From d592320f7eab0b8c9205fdd1e4ff43a3fa17e1f9 Mon Sep 17 00:00:00 2001 From: e-koch Date: Wed, 16 Jan 2019 19:06:48 -0700 Subject: [PATCH 11/16] Issue in setup.cfg?? --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 74ebf1c..a7d27ec 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,7 +7,7 @@ all_files = 1 upload-dir = docs/_build/html show-response = 1 -[pytest] +[tool:pytest] minversion = 2.2 norecursedirs = build docs/_build doctest_plus = enabled From 04837ffcbbe4416e8aa918f9194ca6a78c84394c Mon Sep 17 00:00:00 2001 From: e-koch Date: Wed, 16 Jan 2019 21:59:28 -0700 Subject: [PATCH 12/16] Update CHANGE [skip ci] --- CHANGES.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index f2da6d9..b037ae9 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,5 +1,8 @@ 0.3 (unreleased) ---------------- + - Set mult/div for convolution/deconvolution in `Beam` and `Beams`. + The `==` and `!=` operators also work with `Beams` now. + (https://github.com/radio-astro-tools/radio-beam/pull/75) - Added common beam operations to `Beams`. (https://github.com/radio-astro-tools/radio-beam/pull/67) - Fix PA usage for plotting and kernel routines. From 5b5f9c60cd0c468b9e8442528d28f8247ca278b0 Mon Sep 17 00:00:00 2001 From: e-koch Date: Thu, 17 Jan 2019 10:42:02 -0700 Subject: [PATCH 13/16] Use div for deconvolution --- radio_beam/multiple_beams.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio_beam/multiple_beams.py b/radio_beam/multiple_beams.py index b806b4c..3e9dbed 100644 --- a/radio_beam/multiple_beams.py +++ b/radio_beam/multiple_beams.py @@ -358,7 +358,7 @@ def __truediv__(self, other): " with a given beam. Must be " "divided by a Beam object.") - return Beams(beams=[beam - other for beam in self]) + return Beams(beams=[beam / other for beam in self]) def __add__(self, other): raise InvalidBeamOperationError("Addition of a set of Beams " From ba390c85b52ed7b0e17ee284275c4f504475876f Mon Sep 17 00:00:00 2001 From: e-koch Date: Thu, 17 Jan 2019 10:52:04 -0700 Subject: [PATCH 14/16] Add deprecation warning for subtraction-as-deconvolution --- radio_beam/beam.py | 5 ++++- radio_beam/tests/test_beam.py | 16 ++++++++++++++-- radio_beam/utils.py | 4 ++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/radio_beam/beam.py b/radio_beam/beam.py index e38241e..a62d9a7 100644 --- a/radio_beam/beam.py +++ b/radio_beam/beam.py @@ -12,7 +12,7 @@ from astropy.convolution import Kernel2D from astropy.convolution.kernels import _round_up_to_odd_integer -from .utils import deconvolve, convolve +from .utils import deconvolve, convolve, RadioBeamDeprecationWarning # Conversion between a twod Gaussian FWHM**2 and effective area FWHM_TO_AREA = 2*np.pi/(8*np.log(2)) @@ -346,6 +346,9 @@ def __mul__(self, other): # Does division do the same? Or what? Doesn't have to be defined. def __sub__(self, other): + warnings.warn("Subtraction-as-deconvolution is deprecated. " + "Use division instead.", + RadioBeamDeprecationWarning) return self.deconvolve(other) def __truediv__(self, other): diff --git a/radio_beam/tests/test_beam.py b/radio_beam/tests/test_beam.py index 3b0b9f6..c737bbd 100644 --- a/radio_beam/tests/test_beam.py +++ b/radio_beam/tests/test_beam.py @@ -6,6 +6,7 @@ from astropy.io import fits from astropy import units as u import os +import warnings import numpy as np import numpy.testing as npt from astropy.tests.helper import assert_quantity_allclose @@ -17,6 +18,9 @@ except ImportError: HAS_CASA = False +from ..utils import RadioBeamDeprecationWarning + + data_dir = os.path.join(os.path.dirname(__file__), 'data') @@ -244,8 +248,16 @@ def test_conv_deconv(): assert beam1.convolve(beam2) == beam2.convolve(beam1) # Test multiplication and subtraction (i.e., convolution and deconvolution) - assert beam2 == beam3 - beam1 - assert beam1 == beam3 - beam2 + # subtraction-as-deconvolution is deprecated. Check that one of the gives + # the warning + + with warnings.catch_warnings(record=True) as w: + assert beam2 == beam3 - beam1 + + assert len(w) == 1 + assert w[0].category == RadioBeamDeprecationWarning + assert str(w[0].message) == ("Subtraction-as-deconvolution is deprecated. " + "Use division instead.") # Dividing should give the same thing assert beam2 == beam3 / beam1 diff --git a/radio_beam/utils.py b/radio_beam/utils.py index 8d83dea..50acd5a 100644 --- a/radio_beam/utils.py +++ b/radio_beam/utils.py @@ -12,6 +12,10 @@ class InvalidBeamOperationError(Exception): pass +class RadioBeamDeprecationWarning(Warning): + pass + + def deconvolve(beam, other, failure_returns_pointlike=False): """ Deconvolve a beam from another From 01413db9e69def1c9b5937a825c26e37c09117cc Mon Sep 17 00:00:00 2001 From: e-koch Date: Thu, 17 Jan 2019 10:53:27 -0700 Subject: [PATCH 15/16] Remove old commented out deconvolution test --- radio_beam/tests/test_beams.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/radio_beam/tests/test_beams.py b/radio_beam/tests/test_beams.py index 82dae72..0b9c7dc 100644 --- a/radio_beam/tests/test_beams.py +++ b/radio_beam/tests/test_beams.py @@ -218,12 +218,6 @@ def test_indexing(): assert np.all(beams[mask].major.value == majors[mask].value) -# def test_beams_mult_convolution(): - -# beams, majors = symm_beams_for_tests()[:2] - - - def test_average_beams(): beams, majors = symm_beams_for_tests()[:2] From 24092c60589b6984432b5915cc4063e6d69de8aa Mon Sep 17 00:00:00 2001 From: e-koch Date: Thu, 17 Jan 2019 11:11:19 -0700 Subject: [PATCH 16/16] Enable coveralls --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f58e0a4..d0cc2a5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -151,4 +151,4 @@ script: after_success: # If coveralls.io is set up for this package, uncomment the line below. # The coveragerc file may be customized as needed for your package. - # - if [[ $SETUP_CMD == *coverage* ]]; then coveralls --rcfile='packagename/tests/coveragerc'; fi + - if [[ $SETUP_CMD == *coverage* ]]; then coveralls --rcfile='radio_beam/tests/coveragerc'; fi