@@ -125,7 +125,8 @@ class IrsaClass(BaseQuery):
125
125
126
126
def query_region (self , coordinates = None , catalog = None , spatial = 'Cone' ,
127
127
radius = 10 * u .arcsec , width = None , polygon = None ,
128
- get_query_payload = False , verbose = False , selcols = None ):
128
+ get_query_payload = False , verbose = False , selcols = None ,
129
+ cache = True ):
129
130
"""
130
131
This function can be used to perform either cone, box, polygon or
131
132
all-sky search in the catalogs hosted by the NASA/IPAC Infrared
@@ -169,7 +170,8 @@ def query_region(self, coordinates=None, catalog=None, spatial='Cone',
169
170
conform to the standard. Defaults to `False`.
170
171
selcols : str, optional
171
172
Target column list with value separated by a comma(,)
172
-
173
+ cache : bool, optional
174
+ Use local cache when set to `True`.
173
175
174
176
Returns
175
177
-------
@@ -180,15 +182,15 @@ def query_region(self, coordinates=None, catalog=None, spatial='Cone',
180
182
spatial = spatial , radius = radius ,
181
183
width = width , polygon = polygon ,
182
184
get_query_payload = get_query_payload ,
183
- selcols = selcols )
185
+ selcols = selcols , cache = cache )
184
186
if get_query_payload :
185
187
return response
186
188
return self ._parse_result (response , verbose = verbose )
187
189
188
190
def query_region_async (self , coordinates = None , catalog = None ,
189
191
spatial = 'Cone' , radius = 10 * u .arcsec , width = None ,
190
192
polygon = None , get_query_payload = False ,
191
- selcols = None ):
193
+ selcols = None , cache = True ):
192
194
"""
193
195
This function serves the same purpose as
194
196
:meth:`~astroquery.irsa.IrsaClass.query_region`, but returns the raw
@@ -228,6 +230,8 @@ def query_region_async(self, coordinates=None, catalog=None,
228
230
Defaults to `False`.
229
231
selcols : str, optional
230
232
Target column list with value separated by a comma(,)
233
+ cache : bool, optional
234
+ Use local cache when set to `True`.
231
235
232
236
Returns
233
237
-------
@@ -246,7 +250,8 @@ def query_region_async(self, coordinates=None, catalog=None,
246
250
if get_query_payload :
247
251
return request_payload
248
252
response = self ._request ("GET" , url = Irsa .IRSA_URL ,
249
- params = request_payload , timeout = Irsa .TIMEOUT )
253
+ params = request_payload , timeout = Irsa .TIMEOUT ,
254
+ cache = cache )
250
255
return response
251
256
252
257
def _parse_spatial (self , spatial , coordinates , radius = None , width = None ,
@@ -410,33 +415,42 @@ def _parse_result(self, response, verbose=False):
410
415
411
416
return table
412
417
413
- def list_catalogs (self ):
418
+
419
+ def list_catalogs (self , cache = False ):
414
420
"""
415
421
Return a dictionary of the catalogs in the IRSA Gator tool.
416
422
423
+ Parameters
424
+ ----------
425
+ cache : bool
426
+ Use local cache when set to `True`. Default is `False`.
427
+
417
428
Returns
418
429
-------
419
430
catalogs : dict
420
431
A dictionary of catalogs where the key indicates the catalog
421
432
name to be used in query functions, and the value is the verbose
422
433
description of the catalog.
434
+
423
435
"""
424
436
response = self ._request ("GET" , url = Irsa .GATOR_LIST_URL ,
425
- params = dict (mode = 'xml' ), timeout = Irsa .TIMEOUT )
437
+ params = dict (mode = 'xml' ), cache = cache ,
438
+ timeout = Irsa .TIMEOUT )
426
439
427
440
root = tree .fromstring (response .content )
428
441
catalogs = {}
429
442
for catalog in root .findall ('catalog' ):
430
443
catname = catalog .find ('catname' ).text
431
444
desc = catalog .find ('desc' ).text
432
445
catalogs [catname ] = desc
446
+
433
447
return catalogs
434
448
435
- def print_catalogs (self ):
449
+ def print_catalogs (self , cache = False ):
436
450
"""
437
451
Display a table of the catalogs in the IRSA Gator tool.
438
452
"""
439
- catalogs = self .list_catalogs ()
453
+ catalogs = self .list_catalogs (cache = cache )
440
454
for catname in catalogs :
441
455
print ("{:30s} {:s}" .format (catname , catalogs [catname ]))
442
456
0 commit comments