Skip to content

Commit f837d78

Browse files
committed
Merge pull request #489 from bsipocz/change_icrs_to_skycoord
Changing deprecated coordinates.ICRS() calls to coordinates.SkyCoord()
2 parents 28e2d19 + fa9aa5f commit f837d78

File tree

13 files changed

+25
-25
lines changed

13 files changed

+25
-25
lines changed

astroquery/alfalfa/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def query_region(self, coordinates, radius=3. * u.arcmin,
119119
--------
120120
>>> from astroquery.alfalfa import Alfalfa
121121
>>> from astropy import coordinates as coords
122-
>>> C = coords.ICRS('0h8m05.63s +14d50m23.3s')
122+
>>> C = coords.SkyCoord('0h8m05.63s +14d50m23.3s')
123123
>>> agc = Alfalfa.query_region(C,'3 arcmin')
124124
125125
Returns

astroquery/alfalfa/tests/test_alfalfa.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def data_path(filename):
5454
return os.path.join(data_dir, filename)
5555

5656
# Test Case: A Seyfert 1 galaxy
57-
coords = coordinates.ICRS('0h8m05.63s +14d50m23.3s')
57+
coords = coordinates.SkyCoord('0h8m05.63s +14d50m23.3s')
5858

5959
ALFALFA = alfalfa.core.Alfalfa()
6060

astroquery/fermi/tests/test_fermi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def post_mockreturn(url, data=None, timeout=50, **kwargs):
3333
response = MockResponse(r.read(), **kwargs)
3434
return response
3535

36-
FK5_COORDINATES = coord.ICRS(10.68471, 41.26875, unit=('deg', 'deg'))
36+
FK5_COORDINATES = coord.SkyCoord(10.68471, 41.26875, unit=('deg', 'deg'))
3737

3838
# disable waiting so tests run fast
3939
fermi.core.get_fermilat_datafile.TIMEOUT = 1

astroquery/irsa/tests/test_irsa.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ def test_query_region_box(coordinates, patch_get):
110110
width=2 * u.arcmin)
111111
assert isinstance(result, Table)
112112

113-
poly1 = [coord.ICRS(ra=10.1, dec=10.1, unit=(u.deg, u.deg)),
114-
coord.ICRS(ra=10.0, dec=10.1, unit=(u.deg, u.deg)),
115-
coord.ICRS(ra=10.0, dec=10.0, unit=(u.deg, u.deg))]
113+
poly1 = [coord.SkyCoord(ra=10.1, dec=10.1, unit=(u.deg, u.deg)),
114+
coord.SkyCoord(ra=10.0, dec=10.1, unit=(u.deg, u.deg)),
115+
coord.SkyCoord(ra=10.0, dec=10.0, unit=(u.deg, u.deg))]
116116
poly2 = [(10.1 * u.deg, 10.1 * u.deg), (10.0 * u.deg, 10.1 * u.deg), (10.0 * u.deg, 10.0 * u.deg)]
117117

118118

astroquery/irsa/tests/test_irsa_remote.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ def test_query_region_box(self):
3939
assert isinstance(result, Table)
4040

4141
def test_query_region_async_polygon(self):
42-
polygon = [coord.ICRS(ra=10.1, dec=10.1, unit=(u.deg, u.deg)),
43-
coord.ICRS(ra=10.0, dec=10.1, unit=(u.deg, u.deg)),
44-
coord.ICRS(ra=10.0, dec=10.0, unit=(u.deg, u.deg))]
42+
polygon = [coord.SkyCoord(ra=10.1, dec=10.1, unit=(u.deg, u.deg)),
43+
coord.SkyCoord(ra=10.0, dec=10.1, unit=(u.deg, u.deg)),
44+
coord.SkyCoord(ra=10.0, dec=10.0, unit=(u.deg, u.deg))]
4545
response = irsa.core.Irsa.query_region_async("m31", catalog="fp_psc", spatial="Polygon",
4646
polygon=polygon)
4747
assert response is not None

astroquery/nrao/tests/test_nrao_remote.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
class TestNrao:
1616

1717
def test_query_region_async(self):
18-
response = nrao.core.Nrao.query_region_async(coord.ICRS("04h33m11.1s 05d21m15.5s"))
18+
response = nrao.core.Nrao.query_region_async(coord.SkyCoord("04h33m11.1s 05d21m15.5s"))
1919
assert response is not None
2020

2121
def test_query_region(self):
22-
result = nrao.core.Nrao.query_region(coord.ICRS("04h33m11.1s 05d21m15.5s"))
22+
result = nrao.core.Nrao.query_region(coord.SkyCoord("04h33m11.1s 05d21m15.5s"))
2323
assert isinstance(result, Table)

astroquery/sdss/core.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def query_region_async(self, coordinates, radius=u.degree / 1800.,
104104
--------
105105
>>> from astroquery.sdss import SDSS
106106
>>> from astropy import coordinates as coords
107-
>>> co = coords.ICRS('0h8m05.63s +14d50m23.3s')
107+
>>> co = coords.SkyCoord('0h8m05.63s +14d50m23.3s')
108108
>>> result = SDSS.query_region(co)
109109
>>> print(result[:5])
110110
ra dec objid run rerun camcol field
@@ -359,7 +359,7 @@ def get_spectra_async(self, coordinates=None, radius=u.degree / 1800.,
359359
360360
>>> from astropy import coordinates as coords
361361
>>> from astroquery.sdss import SDSS
362-
>>> co = coords.ICRS('0h8m05.63s +14d50m23.3s')
362+
>>> co = coords.SkyCoord('0h8m05.63s +14d50m23.3s')
363363
>>> result = SDSS.query_region(co, spectro=True)
364364
>>> spec = SDSS.get_spectra(matches=result)
365365
@@ -483,7 +483,7 @@ def get_images_async(self, coordinates=None, radius=u.degree / 1800.,
483483
484484
>>> from astropy import coordinates as coords
485485
>>> from astroquery.sdss import SDSS
486-
>>> co = coords.ICRS('0h8m05.63s +14d50m23.3s')
486+
>>> co = coords.SkyCoord('0h8m05.63s +14d50m23.3s')
487487
>>> result = SDSS.query_region(co)
488488
>>> imgs = SDSS.get_images(matches=result)
489489

astroquery/sdss/tests/test_sdss_remote.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def test_images_timeout():
1515
An independent timeout test to verify that test_images_timeout in the
1616
TestSDSSRemote class should be working. Consider this a regression test.
1717
"""
18-
coords = coordinates.ICRS('0h8m05.63s +14d50m23.3s')
18+
coords = coordinates.SkyCoord('0h8m05.63s +14d50m23.3s')
1919
xid = sdss.core.SDSS.query_region(coords)
2020
assert len(xid) == 18
2121
with pytest.raises(TimeoutError):
@@ -25,7 +25,7 @@ def test_images_timeout():
2525
@remote_data
2626
class TestSDSSRemote:
2727
# Test Case: A Seyfert 1 galaxy
28-
coords = coordinates.ICRS('0h8m05.63s +14d50m23.3s')
28+
coords = coordinates.SkyCoord('0h8m05.63s +14d50m23.3s')
2929
mintimeout = 1e-6
3030

3131

astroquery/simbad/tests/test_simbad_remote.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
imp.reload(requests)
1313

1414
# M42 coordinates
15-
ICRS_COORDS = coord.ICRS("05h35m17.3s -05h23m28s")
15+
ICRS_COORDS = coord.SkyCoord("05h35m17.3s -05h23m28s", frame='icrs')
1616

1717

1818
@remote_data
@@ -122,19 +122,19 @@ def test_query_objects_null(self):
122122

123123
# Special case of null test: zero-sized region
124124
def test_query_region_null(self):
125-
result = simbad.core.Simbad.query_region(coord.ICRS("00h00m0.0s 00h00m0.0s"), radius="0d",
125+
result = simbad.core.Simbad.query_region(coord.SkyCoord("00h00m0.0s 00h00m0.0s"), radius="0d",
126126
equinox=2000.0, epoch='J2000')
127127
assert result is None
128128

129129
# Special case of null test: very small region
130130
def test_query_small_region_null(self):
131-
result = simbad.core.Simbad.query_region(coord.ICRS("00h00m0.0s 00h00m0.0s"), radius=1.0 * u.marcsec,
131+
result = simbad.core.Simbad.query_region(coord.SkyCoord("00h00m0.0s 00h00m0.0s"), radius=1.0 * u.marcsec,
132132
equinox=2000.0, epoch='J2000')
133133
assert result is None
134134

135135
# Special case : zero-sized region with one object
136136
def test_query_zero_sized_region(self):
137-
result = simbad.core.Simbad.query_region(coord.ICRS("20h54m05.6889s 37d01m17.380s"), radius="0d",
137+
result = simbad.core.Simbad.query_region(coord.SkyCoord("20h54m05.6889s 37d01m17.380s"), radius="0d",
138138
equinox=2000.0, epoch='J2000')
139139
# This should find a single star, BD+36 4308
140140
assert len(result) == 1

astroquery/utils/commons.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def radius_to_unit(radius, unit='degree'):
162162
def parse_coordinates(coordinates):
163163
"""
164164
Takes a string or astropy.coordinates object. Checks if the
165-
string is parsable as an astropy.coordinates.ICRS
165+
string is parsable as an `astropy.coordinates`
166166
object or is a name that is resolvable. Otherwise asserts
167167
that the argument is an astropy.coordinates object.
168168

0 commit comments

Comments
 (0)