Skip to content

Commit 2327bb9

Browse files
committed
MAINT: use the updated class and variable names for SIA v2
1 parent bed438b commit 2327bb9

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

astroquery/alma/core.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@
1919
from astropy.utils.console import ProgressBar
2020
from astropy import units as u
2121
from astropy.time import Time
22-
from pyvo.dal.sia2 import SIA_PARAMETERS_DESC
22+
23+
try:
24+
from pyvo.dal.sia2 import SIA2_PARAMETERS_DESC, SIA2Service
25+
except ImportError:
26+
# Can be removed once min version of pyvo is 1.5
27+
from pyvo.dal.sia2 import SIA_PARAMETERS_DESC as SIA2_PARAMETERS_DESC
28+
from pyvo.dal.sia2 import SIAService as SIA2Service
2329

2430
from ..exceptions import LoginError
2531
from ..utils import commons
@@ -243,7 +249,7 @@ def datalink_url(self):
243249
@property
244250
def sia(self):
245251
if not self._sia:
246-
self._sia = pyvo.dal.sia2.SIAService(baseurl=self.sia_url)
252+
self._sia = SIA2Service(baseurl=self.sia_url)
247253
return self._sia
248254

249255
@property
@@ -434,7 +440,7 @@ def query_sia(self, *, pos=None, band=None, time=None, pol=None,
434440
435441
Returns
436442
-------
437-
Results in `pyvo.dal.SIAResults` format.
443+
Results in ``pyvo.dal.sia2.SIA2Results`` format.
438444
result.table in Astropy table format
439445
"""
440446
return self.sia.search(
@@ -458,11 +464,11 @@ def query_sia(self, *, pos=None, band=None, time=None, pol=None,
458464
maxrec=maxrec,
459465
**kwargs)
460466

461-
# SIA_PARAMETERS_DESC contains links that Sphinx can't resolve.
467+
# SIA2_PARAMETERS_DESC contains links that Sphinx can't resolve.
462468
for var in ('POLARIZATION_STATES', 'CALIBRATION_LEVELS'):
463-
SIA_PARAMETERS_DESC = SIA_PARAMETERS_DESC.replace(f'`pyvo.dam.obscore.{var}`',
464-
f'pyvo.dam.obscore.{var}')
465-
query_sia.__doc__ = query_sia.__doc__.replace('_SIA2_PARAMETERS', SIA_PARAMETERS_DESC)
469+
SIA2_PARAMETERS_DESC = SIA2_PARAMETERS_DESC.replace(f'`pyvo.dam.obscore.{var}`',
470+
f'pyvo.dam.obscore.{var}')
471+
query_sia.__doc__ = query_sia.__doc__.replace('_SIA2_PARAMETERS', SIA2_PARAMETERS_DESC)
466472

467473
def query_tap(self, query, maxrec=None):
468474
"""
@@ -498,11 +504,11 @@ def help_tap(self):
498504

499505
# update method pydocs
500506
query_region_async.__doc__ = query_region_async.__doc__.replace(
501-
'_SIA2_PARAMETERS', pyvo.dal.sia2.SIA_PARAMETERS_DESC)
507+
'_SIA2_PARAMETERS', SIA2_PARAMETERS_DESC)
502508
query_object_async.__doc__ = query_object_async.__doc__.replace(
503-
'_SIA2_PARAMETERS', pyvo.dal.sia2.SIA_PARAMETERS_DESC)
509+
'_SIA2_PARAMETERS', SIA2_PARAMETERS_DESC)
504510
query_async.__doc__ = query_async.__doc__.replace(
505-
'_SIA2_PARAMETERS', pyvo.dal.sia2.SIA_PARAMETERS_DESC)
511+
'_SIA2_PARAMETERS', SIA2_PARAMETERS_DESC)
506512

507513
def _get_dataarchive_url(self):
508514
"""

0 commit comments

Comments
 (0)