Skip to content

MAINT: update urls and response parsing for imcce #3286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions astroquery/imcce/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ class Conf(_config.ConfigNamespace):

# server settings
ephemcc_server = _config.ConfigItem(
'http://vo.imcce.fr/webservices/miriade/ephemcc_query.php',
'https://ssp.imcce.fr/webservices/miriade/api/ephemcc.php',
'IMCCE/Miriade.ephemcc base server')
skybot_server = _config.ConfigItem(
['http://vo.imcce.fr/webservices/skybot/skybotconesearch_query.php'],
['https://ssp.imcce.fr/webservices/skybot/api/conesearch.php'],
'SkyBoT')

timeout = _config.ConfigItem(
Expand Down
88 changes: 48 additions & 40 deletions astroquery/imcce/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
class MiriadeClass(BaseQuery):
"""
A class for querying the
`IMCCE/Miriade <http://vo.imcce.fr/webservices/miriade/>`_ service.
`IMCCE/Miriade <https://ssp.imcce.fr/webservices/miriade/>`_ service.
"""

_query_uri = None # uri used in query
Expand All @@ -49,8 +49,8 @@ def get_ephemerides_async(self, targetname, *, objtype='asteroid',
get_raw_response=False, cache=True):
"""
Query the
`IMCCE Miriade <http://vo.imcce.fr/webservices/miriade/>`_
`ephemcc <http://vo.imcce.fr/webservices/miriade/?ephemcc>`_
`IMCCE Miriade <https://ssp.imcce.fr/webservices/miriade/>`_
`ephemcc <https://ssp.imcce.fr/webservices/miriade/api/ephemcc>`_
service.


Expand Down Expand Up @@ -85,14 +85,14 @@ def get_ephemerides_async(self, targetname, *, objtype='asteroid',
location : str, optional
Location of the observer on Earth as a code or a set of
coordinates. See the
`Miriade manual <http://vo.imcce.fr/webservices/miriade/?documentation#field_7>`_
`Miriade manual <https://ssp.imcce.fr/webservices/miriade/?documentation#field_7>`_
for details. Default: geocentric location (``'500'``)

coordtype : int, optional
Type of coordinates to be calculated: ``1``: spherical, ``2``:
rectangular, ``3``: local coordinates (azimuth and elevation),
``4``: hour angle coordinates, ``5``: dedicated to observation,
``6``: dedicated to AO observation. Default: ``1``
Default: ``1``

timescale : str, optional
The time scale used in the computation of the ephemerides:
Expand Down Expand Up @@ -142,42 +142,38 @@ def get_ephemerides_async(self, targetname, *, objtype='asteroid',
+------------------+-----------------------------------------------+
| Column Name | Definition |
+==================+===============================================+
| ``target`` | Target name (str, 1, 2, 3, 4, 5, 6 ) |
+------------------+-----------------------------------------------+
| ``epoch`` | Ephemerides epoch (JD, float, 1, 2, 3, 4, 5, |
| | 6) |
| ``epoch`` | Ephemerides epoch (JD, float, 1, 2, 3, 4, 5) |
+------------------+-----------------------------------------------+
| ``RA`` | Target RA at ``ephtype`` (deg, float, 1) |
+------------------+-----------------------------------------------+
| ``DEC`` | Target declination at ``ephtype`` (deg, |
| | float, 1, 4, 5) |
+------------------+-----------------------------------------------+
| ``RAJ2000`` | Target RA at J2000 (deg, float, 5, 6) |
| ``RAJ2000`` | Target RA at J2000 (deg, float, 5) |
+------------------+-----------------------------------------------+
| ``DECJ2000`` | Target declination at J2000 (deg, float, 5, 6)|
| ``DECJ2000`` | Target declination at J2000 (deg, float, 5) |
+------------------+-----------------------------------------------+
| ``AZ`` | Target azimuth (deg, float, 3, 5) |
+------------------+-----------------------------------------------+
| ``EL`` | Target elevation (deg, float, 3, 5) |
+------------------+-----------------------------------------------+
| ``delta`` | Distance from observer (au, float, 1, 2, 3, |
| | 4, 5, 6) |
| | 4, 5) |
+------------------+-----------------------------------------------+
| ``delta_rate`` | Rate in observer distance (km/s, float, |
| | 1, 5, 6) |
| ``delta_rate`` | Rate in observer distance (km/s, float, 1, 5) |
+------------------+-----------------------------------------------+
| ``V`` | Apparent visual magnitude (mag, float, 1, 2, |
| | 3, 4, 5, 6) |
| | 3, 4, 5) |
+------------------+-----------------------------------------------+
| ``alpha`` | Solar phase angle (deg, 1, 2, 3, 4, 5, 6) |
| ``alpha`` | Solar phase angle (deg, 1, 2, 3, 4, 5) |
+------------------+-----------------------------------------------+
| ``elong`` | Solar elongation angle (deg, 1, 2, 3, 4, 5, 6)|
| ``elong`` | Solar elongation angle (deg, 1, 2, 3, 4, 5) |
+------------------+-----------------------------------------------+
| ``RAcosD_rate`` | Rate of motion in RA * cos(DEC) (arcsec/min, |
| | float, 1, 5, 6) |
| | float, 1, 5) |
+------------------+-----------------------------------------------+
| ``DEC_rate`` | Rate of motion in DEC (arcsec/min, float, 1, |
| | 5, 6) |
| | 5) |
+------------------+-----------------------------------------------+
| ``x`` | X position state vector (au, float, 2) |
+------------------+-----------------------------------------------+
Expand All @@ -193,8 +189,7 @@ def get_ephemerides_async(self, targetname, *, objtype='asteroid',
+------------------+-----------------------------------------------+
| ``rv`` | Radial velocity (km/s, float, 2) |
+------------------+-----------------------------------------------+
| ``heldist`` | Target heliocentric distance (au, float, 2, |
| | 5, 6) |
| ``heldist`` | Target heliocentric distance (au, float, 2, 5)|
+------------------+-----------------------------------------------+
| ``x_h`` | X heliocentric position vector (au, float, 2) |
+------------------+-----------------------------------------------+
Expand All @@ -210,13 +205,13 @@ def get_ephemerides_async(self, targetname, *, objtype='asteroid',
+------------------+-----------------------------------------------+
| ``hourangle`` | Target hour angle (deg, float, 4, 5) |
+------------------+-----------------------------------------------+
| ``siderealtime`` | Local sidereal time (hr, float, 5, 6) |
| ``siderealtime`` | Local sidereal time (hr, float, 5) |
+------------------+-----------------------------------------------+
| ``refraction`` | Atmospheric refraction (arcsec, float, 5, 6) |
| ``refraction`` | Atmospheric refraction (arcsec, float, 5) |
+------------------+-----------------------------------------------+
| ``airmass`` | Target airmass (float, 5, 6) |
| ``airmass`` | Target airmass (float, 5) |
+------------------+-----------------------------------------------+
| ``posunc`` | Positional uncertainty (arcsec, float, 5, 6) |
| ``posunc`` | Positional uncertainty (arcsec, float, 5) |
+------------------+-----------------------------------------------+


Expand Down Expand Up @@ -299,17 +294,27 @@ def _parse_result(self, response, *, verbose=None):
votable = parse(voraw)
data = votable.get_first_table().to_table()

# modify table columns
# modify table columns. This is an ugly hack as astropy's votable parser
# is not yet capable of parsing some of these properly.
# Also, not clear why some of the columns are now parsed as object as
# opposed to strings, workaround here is to do .astype()

data['date'] = Time(data['date'].astype('str'), format='isot')

# Adding for backwards compatibility
data['epoch'] = data['date'].jd
data['epoch'].unit = u.d

if 'ra' in data.columns:
data['ra'] = Angle(data['ra'], unit=u.hourangle).deg*u.deg
data.rename_column('ra', 'RA')
if 'RA' in data.columns:
data['RA'] = Angle(data['RA'].astype('str'), unit=u.hourangle).deg*u.deg

if 'DEC' in data.columns:
data['DEC'] = Angle(data['DEC'], unit=u.deg).deg*u.deg

if 'dec' in data.columns:
data['dec'] = Angle(data['dec'], unit=u.deg).deg*u.deg
data.rename_column('dec', 'DEC')

# These don't seem to be returned with the new API/url, as of 2025-04-07
if 'raJ2000' in data.columns and 'decJ2000' in data.columns:
data['raJ2000'] = Angle(
data['raJ2000'], unit=u.hourangle).deg*u.deg
Expand Down Expand Up @@ -342,6 +347,9 @@ def _parse_result(self, response, *, verbose=None):
data['vy_h'].unit = u.au/u.day
data['vz_h'].unit = u.au/u.day

if 'dobs' in data.columns:
data.rename_column('dobs', 'delta')

if 'distance' in data.columns:
data.rename_column('distance', 'delta')

Expand All @@ -358,8 +366,8 @@ def _parse_result(self, response, *, verbose=None):
data.rename_column('azimut', 'AZ')
data.rename_column('elevation', 'EL')

if 'mv' in data.columns:
data.rename_column('mv', 'V')
if 'vmag' in data.columns:
data.rename_column('vmag', 'V')
data['V'].unit = u.mag

if 'phase' in data.columns:
Expand All @@ -368,14 +376,14 @@ def _parse_result(self, response, *, verbose=None):
if 'elongation' in data.columns:
data.rename_column('elongation', 'elong')

if 'dracosdec' in data.columns:
data.rename_column('dracosdec', 'RAcosD_rate')
if 'dRAcosDEC' in data.columns:
data.rename_column('dRAcosDEC', 'RAcosD_rate')

if 'ddec' in data.columns:
data.rename_column('ddec', 'DEC_rate')
if 'dDEC' in data.columns:
data.rename_column('dDEC', 'DEC_rate')

if 'dist_dot' in data.columns:
data.rename_column('dist_dot', 'delta_rate')
if 'rv' in data.columns:
data.rename_column('rv', 'delta_rate')

if 'lst' in data.columns:
data.rename_column('lst', 'siderealtime')
Expand Down Expand Up @@ -418,7 +426,7 @@ def uri(self):
>>> skybot = Skybot()
>>> obj = skybot.cone_search(field, 0.1*u.deg, epoch) # doctest: +SKIP
>>> skybot.uri # doctest: +SKIP
'http://vo.imcce.fr/webservices/skybot/skybotconesearch_query.php?-ra=1.0&-dec=1.0&-rd=0.1&-ep=2458633.404166667&-loc=500&-filter=120.0&-objFilter=111&-refsys=EQJ2000&-output=all&-mime=text'
'https://ssp.imcce.fr/webservices/skybot/skybotconesearch_query.php?-ra=1.0&-dec=1.0&-rd=0.1&-ep=2458633.404166667&-loc=500&-filter=120.0&-objFilter=111&-refsys=EQJ2000&-output=all&-mime=text'
"""
return self._uri

Expand All @@ -437,7 +445,7 @@ def cone_search_async(self,
cache=True):
"""
This method queries the IMCCE
`SkyBoT <http://vo.imcce.fr/webservices/skybot/?conesearch>`_
`SkyBoT <https://ssp.imcce.fr/webservices/skybot/api/conesearch>`_
cone search service and produces a `~astropy.table.QTable` object
containing all Solar System bodies that might be in the cone
defined by the cone center coordinates and epoch provided.
Expand Down
Loading
Loading