@@ -165,7 +165,7 @@ def query_ssa(self, *, pos=None, radius=None, band=None, time=None, collection=N
165
165
format = 'all' , collection = collection )
166
166
return results .to_table ()
167
167
168
- def list_collections (self , servicetype = None ):
168
+ def list_collections (self , * , servicetype = None , filter = None ):
169
169
"""
170
170
Return information of available IRSA SIAv2 collections to be used in ``query_sia`` queries.
171
171
@@ -174,6 +174,8 @@ def list_collections(self, servicetype=None):
174
174
servicetype : str or None
175
175
Service type to list collections for. Returns all collections when not provided.
176
176
Currently supported service types are: 'SIA', 'SSA'.
177
+ filter : str or None
178
+ If specified we only return collections with names containing the filter string.
177
179
178
180
Returns
179
181
-------
@@ -198,8 +200,12 @@ def list_collections(self, servicetype=None):
198
200
else :
199
201
raise ValueError ("if specified, servicetype should be 'SIA' or 'SSA'" )
200
202
201
- collections = self .query_tap (query = query )
202
- return collections .to_table ()
203
+ collections = self .query_tap (query = query ).to_table ()
204
+
205
+ if filter :
206
+ mask = [filter in collection for collection in collections ['collection' ]]
207
+ collections = collections [mask ]
208
+ return collections
203
209
204
210
@deprecated_renamed_argument (("selcols" , "cache" , "verbose" ), ("columns" , None , None ), since = "0.4.7" )
205
211
def query_region (self , coordinates = None , * , catalog = None , spatial = 'Cone' ,
@@ -297,7 +303,7 @@ def query_region(self, coordinates=None, *, catalog=None, spatial='Cone',
297
303
return response .to_table ()
298
304
299
305
@deprecated_renamed_argument ("cache" , None , since = "0.4.7" )
300
- def list_catalogs (self , full = False , cache = False ):
306
+ def list_catalogs (self , * , full = False , filter = None , cache = False ):
301
307
"""
302
308
Return information of available IRSA catalogs.
303
309
@@ -306,9 +312,15 @@ def list_catalogs(self, full=False, cache=False):
306
312
full : bool
307
313
If True returns the full schema as a `~astropy.table.Table`.
308
314
If False returns a dictionary of the table names and their description.
315
+ filter : str or None
316
+ If specified we only return catalogs with names containing the filter string.
309
317
"""
310
318
tap_tables = Irsa .query_tap ("SELECT * FROM TAP_SCHEMA.tables" ).to_table ()
311
319
320
+ if filter :
321
+ mask = [filter in name for name in tap_tables ['table_name' ]]
322
+ tap_tables = tap_tables [mask ]
323
+
312
324
if full :
313
325
return tap_tables
314
326
else :
0 commit comments