Skip to content

Commit

Permalink
Merge pull request #2952 from bsipocz/ENH_irsa_list_collection
Browse files Browse the repository at this point in the history
ENH: adding list_collections to IRSA
  • Loading branch information
bsipocz authored Feb 17, 2024
2 parents 893eae2 + f55b116 commit 1c6b7bf
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 1 deletion.
5 changes: 4 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
^^^^
Expand Down
13 changes: 13 additions & 0 deletions astroquery/ipac/irsa/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 8 additions & 0 deletions astroquery/ipac/irsa/tests/test_irsa_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
25 changes: 25 additions & 0 deletions docs/ipac/irsa/irsa.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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()
<Table length=110>
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
Expand Down

0 comments on commit 1c6b7bf

Please sign in to comment.