Skip to content

Commit b3a7ede

Browse files
committed
ENH: adding query_sia to IRSA
1 parent ff71c93 commit b3a7ede

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

astroquery/ipac/irsa/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class Conf(_config.ConfigNamespace):
2727
timeout = _config.ConfigItem(
2828
60,
2929
'Time limit for connecting to the IRSA server.')
30+
sia_url = _config.ConfigItem('https://irsa.ipac.caltech.edu/SIA', 'IRSA SIA URL')
3031
tap_url = _config.ConfigItem('https://irsa.ipac.caltech.edu/TAP', 'IRSA TAP URL')
3132

3233

astroquery/ipac/irsa/core.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,15 @@
1111
from astropy.coordinates import SkyCoord, Angle
1212
from astropy import units as u
1313
from astropy.utils.decorators import deprecated_renamed_argument
14+
1415
from pyvo.dal import TAPService
16+
17+
try:
18+
from pyvo.dal.sia2 import SIA2Service
19+
except ImportError:
20+
# Can be removed once min version of pyvo is 1.5
21+
from pyvo.dal.sia2 import SIAService as SIA2Service
22+
1523
from astroquery import log
1624
from astroquery.query import BaseVOQuery
1725
from astroquery.utils.commons import parse_coordinates
@@ -26,9 +34,17 @@ class IrsaClass(BaseVOQuery):
2634

2735
def __init__(self):
2836
super().__init__()
37+
self.sia_url = conf.sia_url
2938
self.tap_url = conf.tap_url
39+
self._sia = None
3040
self._tap = None
3141

42+
@property
43+
def sia(self):
44+
if not self._sia:
45+
self._sia = SIA2Service(baseurl=self.sia_url)
46+
return self._sia
47+
3248
@property
3349
def tap(self):
3450
if not self._tap:
@@ -60,6 +76,48 @@ def query_tap(self, query, *, maxrec=None):
6076
log.debug(f'TAP query: {query}')
6177
return self.tap.search(query, language='ADQL', maxrec=maxrec)
6278

79+
def query_sia(self, *, pos=None, band=None, time=None, pol=None,
80+
field_of_view=None, spatial_resolution=None,
81+
spectral_resolving_power=None, exptime=None,
82+
timeres=None, publisher_did=None,
83+
facility=None, collection=None,
84+
instrument=None, data_type=None,
85+
calib_level=None, target_name=None,
86+
res_format=None, maxrec=None,
87+
**kwargs):
88+
"""
89+
Use standard SIA2 attributes to query the IRSA SIA service.
90+
91+
Parameters
92+
----------
93+
_SIA2_PARAMETERS
94+
95+
Returns
96+
-------
97+
Results in `pyvo.dal.SIAResults` format.
98+
result.table in Astropy table format
99+
"""
100+
return self.sia.search(
101+
pos=pos,
102+
band=band,
103+
time=time,
104+
pol=pol,
105+
field_of_view=field_of_view,
106+
spatial_resolution=spatial_resolution,
107+
spectral_resolving_power=spectral_resolving_power,
108+
exptime=exptime,
109+
timeres=timeres,
110+
publisher_did=publisher_did,
111+
facility=facility,
112+
collection=collection,
113+
instrument=instrument,
114+
data_type=data_type,
115+
calib_level=calib_level,
116+
target_name=target_name,
117+
res_format=res_format,
118+
maxrec=maxrec,
119+
**kwargs)
120+
63121
@deprecated_renamed_argument(("selcols", "cache", "verbose"), ("columns", None, None), since="0.4.7")
64122
def query_region(self, coordinates=None, *, catalog=None, spatial='Cone',
65123
radius=10 * u.arcsec, width=None, polygon=None,

0 commit comments

Comments
 (0)