Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: adding list_collections to IRSA #2952

Merged
merged 4 commits into from
Feb 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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()

Check warning on line 140 in astroquery/ipac/irsa/core.py

View check run for this annotation

Codecov / codecov/patch

astroquery/ipac/irsa/core.py#L138-L140

Added lines #L138 - L140 were not covered by tests

@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
Loading