Skip to content

Commit c3cf26a

Browse files
authored
Merge pull request #2332 from bsipocz/alma_deprecate_utils
Deprecate functions from alma.utils
2 parents d901a3c + b208c6f commit c3cf26a

File tree

3 files changed

+12
-57
lines changed

3 files changed

+12
-57
lines changed

CHANGES.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ alma
1515

1616
- Added ``verify_only`` option to check if data downloaded with correct file size [#2263]
1717

18+
- Deprecate broken functions from ``alma.utils``. [#2332]
19+
1820
esa.hubble
1921
^^^^^^^^^^
2022

astroquery/alma/tests/test_alma_utils.py

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -14,38 +14,6 @@
1414
from .. import utils
1515

1616

17-
@pytest.mark.skipif('not pyregion_OK')
18-
def test_pyregion_subset():
19-
header = dict(naxis=2, crpix1=15, crpix2=15, crval1=0.1, crval2=0.1,
20-
cdelt1=-1. / 3600, cdelt2=1. / 3600., ctype1='GLON-CAR',
21-
ctype2='GLAT-CAR')
22-
mywcs = wcs.WCS(header)
23-
# circle with radius 10" at 0.1, 0.1
24-
shape = Shape('circle', (0.1, 0.1, 10. / 3600.))
25-
shape.coord_format = 'galactic'
26-
shape.coord_list = (0.1, 0.1, 10. / 3600.)
27-
shape.attr = ([], {})
28-
data = np.ones([40, 40])
29-
30-
# The following line raises a DeprecationWarning from pyregion, ignore it
31-
with warnings.catch_warnings():
32-
warnings.filterwarnings('ignore')
33-
(xlo, xhi, ylo, yhi), d = utils.pyregion_subset(shape, data, mywcs)
34-
35-
# sticky note over check-engine light solution... but this problem is too
36-
# large in scope to address here. See
37-
# https://github.com/astropy/astropy/pull/3992
38-
assert d.sum() >= 313 & d.sum() <= 315 # VERY approximately pi
39-
np.testing.assert_almost_equal(xlo,
40-
data.shape[0] / 2 - mywcs.wcs.crpix[0] - 1)
41-
np.testing.assert_almost_equal(xhi,
42-
data.shape[0] - mywcs.wcs.crpix[0] - 1)
43-
np.testing.assert_almost_equal(ylo,
44-
data.shape[1] / 2 - mywcs.wcs.crpix[1] - 1)
45-
np.testing.assert_almost_equal(yhi,
46-
data.shape[1] - mywcs.wcs.crpix[1] - 1)
47-
48-
4917
frq_sup_str = ('[86.26..88.14GHz,976.56kHz, XX YY] U '
5018
'[88.15..90.03GHz,976.56kHz, XX YY] U '
5119
'[98.19..100.07GHz,976.56kHz, XX YY] U '
@@ -63,28 +31,3 @@ def test_parse_frequency_support(frq_sup_str=frq_sup_str, result=franges):
6331
def approximate_primary_beam_sizes(frq_sup_str=frq_sup_str,
6432
beamsizes=beamsizes):
6533
assert np.all(utils.approximate_primary_beam_sizes(frq_sup_str) == beamsizes)
66-
67-
68-
@pytest.mark.remote_data
69-
@pytest.mark.skipif('not pyregion_OK')
70-
@pytest.mark.skip('To be fixed later')
71-
def test_make_finder_chart():
72-
import matplotlib
73-
matplotlib.use('agg')
74-
if matplotlib.get_backend() != 'agg':
75-
pytest.xfail("Matplotlib backend was incorrectly set to {0}, could "
76-
"not run finder chart test.".format(matplotlib.get_backend()))
77-
78-
result = utils.make_finder_chart('Eta Carinae', 3 * u.arcmin,
79-
'Eta Carinae')
80-
image, catalog, hit_mask_public, hit_mask_private = result
81-
82-
assert len(catalog) >= 6 # down to 6 on Nov 17, 2016
83-
assert 3 in [int(x) for x in hit_mask_public]
84-
# Feb 8 2016: apparently the 60s integration hasn't actually been released yet...
85-
if 3 in hit_mask_public:
86-
assert hit_mask_public[3][256, 256] >= 30.23
87-
elif b'3' in hit_mask_public:
88-
assert hit_mask_public[b'3'][256, 256] >= 30.23
89-
else:
90-
raise ValueError("hit_mask keys are not of any known type")

astroquery/alma/utils.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,18 @@
1010
from astroquery import log
1111
from astropy import units as u
1212
from astropy.io import fits
13+
from astropy.utils import deprecated
14+
1315
from astroquery.utils.commons import ASTROPY_LT_4_1
1416

1517
from astroquery.skyview import SkyView
1618
from astroquery.alma import Alma
1719

1820

21+
__all__ = ['parse_frequency_support', 'footprint_to_reg', 'approximate_primary_beam_sizes']
22+
23+
24+
@deprecated('0.4.6', 'this function has been deprecated and will be removed in the next release.')
1925
def pyregion_subset(region, data, mywcs):
2026
"""
2127
Return a subset of an image (``data``) given a region.
@@ -153,6 +159,7 @@ def footprint_to_reg(footprint):
153159
return reglist
154160

155161

162+
@deprecated('0.4.6', 'this function has been deprecated and will be removed in the next release.')
156163
def add_meta_to_reg(reg, meta):
157164
reg.meta = meta
158165
return reg
@@ -181,6 +188,7 @@ def approximate_primary_beam_sizes(frequency_support_str,
181188
return u.Quantity(beam_sizes)
182189

183190

191+
@deprecated('0.4.6', 'this function has been deprecated and will be removed in the next release.')
184192
def make_finder_chart(target, radius, save_prefix, service=SkyView.get_images,
185193
service_kwargs={'survey': ['2MASS-K'], 'pixels': 500},
186194
alma_kwargs={'public': False, 'science': False},
@@ -229,6 +237,7 @@ def make_finder_chart(target, radius, save_prefix, service=SkyView.get_images,
229237
**kwargs)
230238

231239

240+
@deprecated('0.4.6', 'this function has been deprecated and will be removed in the next release.')
232241
def make_finder_chart_from_image(image, target, radius, save_prefix,
233242
alma_kwargs={'public': False,
234243
'science': False,
@@ -273,6 +282,7 @@ def make_finder_chart_from_image(image, target, radius, save_prefix,
273282
**kwargs)
274283

275284

285+
@deprecated('0.4.6', 'this function has been deprecated and will be removed in the next release.')
276286
def make_finder_chart_from_image_and_catalog(image, catalog, save_prefix,
277287
alma_kwargs={'public': False,
278288
'science': False},

0 commit comments

Comments
 (0)