diff --git a/CHANGES.rst b/CHANGES.rst index 54be97c819..2b7d61ef8f 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -26,7 +26,10 @@ ipac.irsa ``columns``, and the ``cache`` and ``verbose`` kwargs have been deprecated as they have no effect. [#2823] -- Method to run SIAv2 VO queries is added. [#2837] +- Method to run SIAv2 VO queries, ``query_sia``, is added. [#2837] + +- Method to list available collections for SIA queries, + ``list_collections``, is added. [#2952] gaia ^^^^ diff --git a/astroquery/ipac/irsa/core.py b/astroquery/ipac/irsa/core.py index 4f3776add3..be8aa69b1f 100644 --- a/astroquery/ipac/irsa/core.py +++ b/astroquery/ipac/irsa/core.py @@ -126,6 +126,19 @@ def query_sia(self, *, pos=None, band=None, time=None, pol=None, f'pyvo.dam.obscore.{var}') query_sia.__doc__ = query_sia.__doc__.replace('_SIA2_PARAMETERS', SIA2_PARAMETERS_DESC) + def list_collections(self): + """ + Return information of available IRSA SIAv2 collections to be used in ``query_sia`` queries. + + Returns + ------- + collections : A `~astropy.table.Table` object. + A table listing all the possible collections for IRSA SIA queries. + """ + query = "SELECT DISTINCT collection from caom.observation ORDER by collection" + collections = self.query_tap(query=query) + return collections.to_table() + @deprecated_renamed_argument(("selcols", "cache", "verbose"), ("columns", None, None), since="0.4.7") def query_region(self, coordinates=None, *, catalog=None, spatial='Cone', radius=10 * u.arcsec, width=None, polygon=None, diff --git a/astroquery/ipac/irsa/tests/test_irsa_remote.py b/astroquery/ipac/irsa/tests/test_irsa_remote.py index 584453a944..ed52b629e7 100644 --- a/astroquery/ipac/irsa/tests/test_irsa_remote.py +++ b/astroquery/ipac/irsa/tests/test_irsa_remote.py @@ -71,6 +71,14 @@ def test_list_catalogs(self): # (at the time of writing there are 933 tables in the list). assert len(catalogs) > 900 + def test_list_collections(self): + collections = Irsa.list_collections() + # Number of available collections may change over time, test only for significant drop. + # (at the time of writing there are 110 collections in the list). + assert len(collections) > 100 + assert 'spitzer_seip' in collections['collection'] + assert 'wise_allwise' in collections['collection'] + def test_tap(self): query = "SELECT TOP 5 ra,dec FROM cosmos2015" with pytest.warns(expected_warning=DALOverflowWarning, diff --git a/docs/ipac/irsa/irsa.rst b/docs/ipac/irsa/irsa.rst index a502149c51..cab15dedb1 100644 --- a/docs/ipac/irsa/irsa.rst +++ b/docs/ipac/irsa/irsa.rst @@ -236,6 +236,31 @@ Enhanced Imaging products in the centre of the COSMOS field as an `~astropy.tabl >>> coord = SkyCoord('150.01d 2.2d', frame='icrs') >>> spitzer_images = Irsa.query_sia(pos=(coord, 1 * u.arcmin), collection='spitzer_seip').to_table() +To list available collections for SIA queries, the +`~astroquery.ipac.irsa.IrsaClass.list_collections` method is provided, and +will return a `~astropy.table.Table`: + +.. doctest-remote-data:: + + >>> from astroquery.ipac.irsa import Irsa + >>> Irsa.list_collections() + + collection + object + --------------------- + akari_allskymaps + blast + bolocam_gps + bolocam_lh + bolocam_planck_sz + ... + wise_allsky + wise_allwise + wise_prelim + wise_prelim_2bandcryo + wise_unwise + wise_z0mgs + Now open a cutout image for one of the science images. You could either use the the IRSA on-premise data or the cloud version of it using the ``access_url`` or ``cloud_access`` columns. For more info about fits