Skip to content

Commit 1c6b7bf

Browse files
authored
Merge pull request #2952 from bsipocz/ENH_irsa_list_collection
ENH: adding list_collections to IRSA
2 parents 893eae2 + f55b116 commit 1c6b7bf

File tree

4 files changed

+50
-1
lines changed

4 files changed

+50
-1
lines changed

CHANGES.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ ipac.irsa
2626
``columns``, and the ``cache`` and ``verbose`` kwargs have been
2727
deprecated as they have no effect. [#2823]
2828

29-
- Method to run SIAv2 VO queries is added. [#2837]
29+
- Method to run SIAv2 VO queries, ``query_sia``, is added. [#2837]
30+
31+
- Method to list available collections for SIA queries,
32+
``list_collections``, is added. [#2952]
3033

3134
gaia
3235
^^^^

astroquery/ipac/irsa/core.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,19 @@ def query_sia(self, *, pos=None, band=None, time=None, pol=None,
126126
f'pyvo.dam.obscore.{var}')
127127
query_sia.__doc__ = query_sia.__doc__.replace('_SIA2_PARAMETERS', SIA2_PARAMETERS_DESC)
128128

129+
def list_collections(self):
130+
"""
131+
Return information of available IRSA SIAv2 collections to be used in ``query_sia`` queries.
132+
133+
Returns
134+
-------
135+
collections : A `~astropy.table.Table` object.
136+
A table listing all the possible collections for IRSA SIA queries.
137+
"""
138+
query = "SELECT DISTINCT collection from caom.observation ORDER by collection"
139+
collections = self.query_tap(query=query)
140+
return collections.to_table()
141+
129142
@deprecated_renamed_argument(("selcols", "cache", "verbose"), ("columns", None, None), since="0.4.7")
130143
def query_region(self, coordinates=None, *, catalog=None, spatial='Cone',
131144
radius=10 * u.arcsec, width=None, polygon=None,

astroquery/ipac/irsa/tests/test_irsa_remote.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ def test_list_catalogs(self):
7171
# (at the time of writing there are 933 tables in the list).
7272
assert len(catalogs) > 900
7373

74+
def test_list_collections(self):
75+
collections = Irsa.list_collections()
76+
# Number of available collections may change over time, test only for significant drop.
77+
# (at the time of writing there are 110 collections in the list).
78+
assert len(collections) > 100
79+
assert 'spitzer_seip' in collections['collection']
80+
assert 'wise_allwise' in collections['collection']
81+
7482
def test_tap(self):
7583
query = "SELECT TOP 5 ra,dec FROM cosmos2015"
7684
with pytest.warns(expected_warning=DALOverflowWarning,

docs/ipac/irsa/irsa.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,31 @@ Enhanced Imaging products in the centre of the COSMOS field as an `~astropy.tabl
236236
>>> coord = SkyCoord('150.01d 2.2d', frame='icrs')
237237
>>> spitzer_images = Irsa.query_sia(pos=(coord, 1 * u.arcmin), collection='spitzer_seip').to_table()
238238

239+
To list available collections for SIA queries, the
240+
`~astroquery.ipac.irsa.IrsaClass.list_collections` method is provided, and
241+
will return a `~astropy.table.Table`:
242+
243+
.. doctest-remote-data::
244+
245+
>>> from astroquery.ipac.irsa import Irsa
246+
>>> Irsa.list_collections()
247+
<Table length=110>
248+
collection
249+
object
250+
---------------------
251+
akari_allskymaps
252+
blast
253+
bolocam_gps
254+
bolocam_lh
255+
bolocam_planck_sz
256+
...
257+
wise_allsky
258+
wise_allwise
259+
wise_prelim
260+
wise_prelim_2bandcryo
261+
wise_unwise
262+
wise_z0mgs
263+
239264
Now open a cutout image for one of the science images. You could either use
240265
the the IRSA on-premise data or the cloud version of it using the
241266
``access_url`` or ``cloud_access`` columns. For more info about fits

0 commit comments

Comments
 (0)