Skip to content

Commit 78aee6f

Browse files
authored
Merge pull request #3252 from bsipocz/ENH_table_instead_votable_sia
ENH: query_sia and query_ssa to return QTable
2 parents 006c62b + fe2614f commit 78aee6f

File tree

4 files changed

+23
-17
lines changed

4 files changed

+23
-17
lines changed

CHANGES.rst

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@ New Tools and Services
88
API changes
99
-----------
1010

11-
1211
esa.euclid
1312
^^^^^^^^^^^^
1413

1514
- New module to access the ESA Euclid Archive. [#3216]
1615

1716
- Tests remove temp directories. [#3226]
1817

18+
ipac.irsa
19+
^^^^^^^^^
20+
21+
- ``query_sia`` now returns the results as an astropy QTable. [#3252]
22+
1923
mast
2024
^^^^
2125

astroquery/ipac/irsa/core.py

+12-10
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ def query_sia(self, *, pos=None, band=None, time=None, pol=None,
102102
103103
Returns
104104
-------
105-
Results in `pyvo.dal.SIAResults` format.
106-
result.to_table() in Astropy table format
105+
Results in `~astropy.table.QTable` format.
106+
107107
"""
108-
return self.sia.search(
108+
results = self.sia.search(
109109
pos=pos,
110110
band=band,
111111
time=time,
@@ -126,6 +126,8 @@ def query_sia(self, *, pos=None, band=None, time=None, pol=None,
126126
maxrec=maxrec,
127127
**kwargs)
128128

129+
return results.to_qtable()
130+
129131
query_sia.__doc__ = query_sia.__doc__.replace('_SIA2_PARAMETERS', SIA2_PARAMETERS_DESC)
130132

131133
def query_ssa(self, *, pos=None, radius=None, band=None, time=None, collection=None):
@@ -151,17 +153,17 @@ def query_ssa(self, *, pos=None, radius=None, band=None, time=None, collection=N
151153
152154
Returns
153155
-------
154-
Results in `pyvo.dal.SSAResults` format.
155-
result.to_table() in Astropy table format
156+
Results in `~astropy.table.QTable` format.
156157
"""
157158

158159
if radius is None:
159160
diameter = None
160161
else:
161162
diameter = 2 * radius
162163

163-
return self.ssa.search(pos=pos, diameter=diameter, band=band, time=time,
164-
format='all', collection=collection)
164+
results = self.ssa.search(pos=pos, diameter=diameter, band=band, time=time,
165+
format='all', collection=collection)
166+
return results.to_qtable()
165167

166168
def list_collections(self, servicetype=None):
167169
"""
@@ -302,10 +304,10 @@ def list_catalogs(self, full=False, cache=False):
302304
Parameters
303305
----------
304306
full : bool
305-
If True returns the full schema VOTable. If False returns a dictionary of the table names and
306-
their description.
307+
If True returns the full schema as a `~astropy.table.Table`.
308+
If False returns a dictionary of the table names and their description.
307309
"""
308-
tap_tables = Irsa.query_tap("SELECT * FROM TAP_SCHEMA.tables")
310+
tap_tables = Irsa.query_tap("SELECT * FROM TAP_SCHEMA.tables").to_table()
309311

310312
if full:
311313
return tap_tables

astroquery/ipac/irsa/tests/test_irsa_remote.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,5 @@ def test_ssa(self):
9292
coord = SkyCoord.from_name("Eta Carina")
9393
result = Irsa.query_ssa(pos=coord)
9494
assert len(result) > 260
95-
collections = set(result.to_table()['dataid_collection'])
95+
collections = set(result['dataid_collection'])
9696
assert {'champ', 'iso_sws', 'sofia_forcast', 'sofia_great', 'spitzer_sha'}.issubset(collections)

docs/ipac/irsa/irsa.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ Simple image access queries
271271

272272
`~astroquery.ipac.irsa.IrsaClass.query_sia` provides a way to access IRSA's Simple
273273
Image Access VO service. In the following example we are looking for Spitzer
274-
Enhanced Imaging products in the centre of the COSMOS field as an `~astropy.table.Table`.
274+
Enhanced Imaging products in the centre of the COSMOS field as a `~astropy.table.QTable`.
275275

276276
.. doctest-remote-data::
277277

@@ -280,7 +280,7 @@ Enhanced Imaging products in the centre of the COSMOS field as an `~astropy.tabl
280280
>>> from astropy import units as u
281281
>>>
282282
>>> coord = SkyCoord('150.01d 2.2d', frame='icrs')
283-
>>> spitzer_images = Irsa.query_sia(pos=(coord, 1 * u.arcmin), collection='spitzer_seip').to_table()
283+
>>> spitzer_images = Irsa.query_sia(pos=(coord, 1 * u.arcmin), collection='spitzer_seip')
284284

285285
To list available collections for SIA queries, the
286286
`~astroquery.ipac.irsa.IrsaClass.list_collections` method is provided, and
@@ -342,7 +342,7 @@ Now plot the cutout.
342342
from astropy.wcs import WCS
343343
import matplotlib.pyplot as plt
344344
coord = SkyCoord('150.01d 2.2d', frame='icrs')
345-
spitzer_images = Irsa.query_sia(pos=(coord, 1 * u.arcmin), collection='spitzer_seip').to_table()
345+
spitzer_images = Irsa.query_sia(pos=(coord, 1 * u.arcmin), collection='spitzer_seip')
346346
science_image = spitzer_images[spitzer_images['dataproduct_subtype'] == 'science'][0]
347347
with fits.open(science_image['access_url'], use_fsspec=True) as hdul:
348348
cutout = Cutout2D(hdul[0].section, position=coord, size=2 *
@@ -356,7 +356,7 @@ Simple spectral access queries
356356

357357
`~astroquery.ipac.irsa.IrsaClass.query_ssa` provides a way to access IRSA's Simple
358358
Spectral Access VO service. In the following example we are looking for Spitzer
359-
Enhanced Imaging products in the centre of the COSMOS field as an `~astropy.table.Table`.
359+
Enhanced Imaging products in the centre of the COSMOS field as a `~astropy.table.QTable`.
360360

361361
.. doctest-remote-data::
362362

@@ -365,7 +365,7 @@ Enhanced Imaging products in the centre of the COSMOS field as an `~astropy.tabl
365365
>>> from astropy import units as u
366366
>>>
367367
>>> coord = pos = SkyCoord.from_name('Arp 220')
368-
>>> arp220_spectra = Irsa.query_ssa(pos=coord).to_table()
368+
>>> arp220_spectra = Irsa.query_ssa(pos=coord)
369369

370370
Without specifying the collection, the query returns results from multiple
371371
collections. For example this target has spectra from SOFIA as well as from

0 commit comments

Comments
 (0)