Skip to content

Commit 8a0a427

Browse files
authored
Merge pull request #3415 from bsipocz/ENH_irsa_list_catalogs_filter_desc
ENH: Irsa.list_catalog(filter) now matching in description
2 parents 03828dd + 86760cc commit 8a0a427

File tree

4 files changed

+23
-38
lines changed

4 files changed

+23
-38
lines changed

CHANGES.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ mast
3030
^^^^
3131

3232
- Deprecated the ``product`` parameter in the ``Tesscut.get_sectors``, ``Tesscut.get_cutouts``, and ``Tesscut.download_cutouts`` methods.
33-
Support for TESS Image Calibration (TICA) high-level science products has been removed; only Science Processing Operations Center (SPOC)
33+
Support for TESS Image Calibration (TICA) high-level science products has been removed; only Science Processing Operations Center (SPOC)
3434
products are now supported. [#3391]
3535

3636
Service fixes and enhancements
@@ -86,6 +86,9 @@ ipac.irsa
8686
in to return all TAP tables, including non-spatial and metadata ones,
8787
too. [#3334]
8888

89+
- The "filter" kwarg of ``list_catalogs`` is now looking for string matches
90+
either in catalog names and short descriptions. [#3415]
91+
8992
SIMBAD
9093
^^^^^^
9194

astroquery/ipac/irsa/core.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,9 @@ def list_catalogs(self, *, full=False, filter=None, include_metadata_tables=Fals
314314
If True returns the full schema as a `~astropy.table.Table`.
315315
If False returns a dictionary of the table names and their description.
316316
filter : str or None
317-
If specified we only return catalogs when their catalog_name
318-
contains the filter string.
317+
If specified we only return catalogs when their catalog_name or the short description
318+
contains the filter string (case-insensitive). Note this may not be all the relevant catalogs
319+
from a given mission, do consult the unfiltered list when in doubt.
319320
include_metadata_tables : bool
320321
If True returns not just the catalogs but all table holdings including the image metadata tables.
321322
These are not suitable for spatial queries with e.g. ``query_region``.
@@ -331,7 +332,9 @@ def list_catalogs(self, *, full=False, filter=None, include_metadata_tables=Fals
331332
tap_tables = self.query_tap(f"SELECT * FROM TAP_SCHEMA.tables {more_filtering}").to_table()
332333

333334
if filter:
334-
mask = [filter in name for name in tap_tables['table_name']]
335+
filter = filter.lower()
336+
mask = [filter in name.lower() or filter in description.lower()
337+
for name, description in tap_tables['table_name', 'description']]
335338
tap_tables = tap_tables[mask]
336339

337340
if full:

astroquery/ipac/irsa/tests/test_irsa_remote.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,13 @@ def test_list_catalogs_filter(self):
8282

8383
assert len(allwise_catalogs) == 4
8484

85+
def test_list_catalogs_filter_description(self):
86+
twomass_catalogs = Irsa.list_catalogs(filter='2mass')
87+
assert len(twomass_catalogs) == 39
88+
89+
all_twomass = Irsa.list_catalogs(filter='2mass', include_metadata_tables=True)
90+
assert len(all_twomass) == 58
91+
8592
def test_list_catalogs_metadata(self):
8693
catalogs = Irsa.list_catalogs(filter='wise')
8794
all_tables = Irsa.list_catalogs(filter='wise', include_metadata_tables=True)

docs/ipac/irsa/irsa.rst

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ The output consists of two fields for each catalog, the name of the catalog
2929
and a very short description. To query a
3030
specific catalog, the first field can be entered as the value of the
3131
``catalog`` parameter in the `~.astroquery.ipac.irsa.IrsaClass.query_region` method.
32-
You can also use the ``filter`` argument to return only the catalogs with
33-
name matches to the specified string.
32+
You can also use the ``filter`` argument to return only the catalogs with their
33+
name or short description matching to the specified string (case-insensitive matching).
3434

3535

3636
.. doctest-remote-data::
@@ -455,48 +455,20 @@ will return a `~astropy.table.Table`.
455455

456456
>>> from astroquery.ipac.irsa import Irsa
457457
>>> Irsa.list_collections(servicetype='SSA')
458-
<Table length=37>
458+
<Table length=41>
459459
collection
460460
object
461461
------------------------
462462
champ
463463
goals
464+
herschel_digit
464465
herschel_gotcplus
465-
herschel_hexos
466-
herschel_hifistars
467-
herschel_hop
468-
herschel_hops
469-
herschel_magcloudscplus
470-
herschel_ppdisks
471-
herschel_prismas
472-
herschel_sag4
473-
herschel_shpdp
474-
herschel_v838mon
475-
herschel_vngs
476-
irtf_mearth
477-
irts
478-
iso_sws
479-
sofia_exes
480-
sofia_exes_enh
481-
sofia_fifils
482-
sofia_flitecam
483-
sofia_forcast
484-
sofia_great
485-
spitzer_5muses
486-
spitzer_c2d
487-
spitzer_disks_sh_spectra
488-
spitzer_feps
489-
spitzer_irs_std
490-
spitzer_irsenh
491-
spitzer_m83m33
492-
spitzer_s5
493-
spitzer_sage
494-
spitzer_sass
466+
...
495467
spitzer_sha
496468
spitzer_sings
497469
spitzer_ssgss
498470
swas
499-
471+
thrumms
500472

501473
Other Configurations
502474
--------------------

0 commit comments

Comments
 (0)