From f921f645c081342c18b05d02c49791866664d682 Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Tue, 24 May 2022 20:22:52 -0400 Subject: [PATCH 01/17] Documentation edits, mainly spacing. --- astroquery/jplhorizons/core.py | 149 ++++++++++++++++++++++----------- 1 file changed, 99 insertions(+), 50 deletions(-) diff --git a/astroquery/jplhorizons/core.py b/astroquery/jplhorizons/core.py index 5b513e12fd..1421631629 100644 --- a/astroquery/jplhorizons/core.py +++ b/astroquery/jplhorizons/core.py @@ -29,20 +29,23 @@ @async_to_sync class HorizonsClass(BaseQuery): """ - A class for querying the - `JPL Horizons `_ service. + Query the `JPL Horizons` `_ service. """ TIMEOUT = conf.timeout def __init__(self, id=None, location=None, epochs=None, id_type=None): - """Instantiate JPL query. + """ + Initialize JPL query. + Parameters ---------- + id : str, required Name, number, or designation of the object to be queried. + location : str or dict, optional Observer's location for ephemerides queries or center body name for orbital element or vector queries. Uses the same codes as JPL @@ -56,6 +59,7 @@ def __init__(self, id=None, location=None, epochs=None, ellipsoid, [``'body'``: Horizons body ID of the central body; optional; if this value is not provided it is assumed that this location is on Earth]}. + epochs : scalar, list-like, or dictionary, optional Either a list of epochs in JD or MJD format or a dictionary defining a range of times and dates; the range dictionary has to be of the @@ -64,23 +68,27 @@ def __init__(self, id=None, location=None, epochs=None, the type of query performed: UTC for ephemerides queries, TDB for element and vector queries. If no epochs are provided, the current time is used. + id_type : str, optional Controls Horizons's object selection for ``id`` [HORIZONSDOC_SELECTION]_ . Options: ``'designation'`` (small body designation), ``'name'`` (asteroid or comet name), - ``'asteroid_name'``, ``'comet_name'``, ``'smallbody'`` (asteroid - and comet search), or ``None`` (first search search planets, - natural satellites, spacecraft, and special cases, and if no - matches, then search small bodies). + ``'asteroid_name'``, ``'comet_name'``, ``'smallbody'`` (asteroid and + comet search), or ``None`` (first search search planets, natural + satellites, spacecraft, and special cases, and if no matches, then + search small bodies). + References ---------- - .. [HORIZONSDOC_SELECTION] https://ssd.jpl.nasa.gov/horizons/manual.html#select (retrieved 2021 Sep 23). + .. [HORIZONSDOC_SELECTION] https://ssd.jpl.nasa.gov/horizons/manual.html#select + (retrieved 2021 Sep 23). Examples -------- + >>> from astroquery.jplhorizons import Horizons >>> eros = Horizons(id='433', location='568', ... epochs={'start':'2017-01-01', @@ -88,7 +96,9 @@ def __init__(self, id=None, location=None, epochs=None, ... 'step':'1d'}) >>> print(eros) # doctest: +SKIP JPLHorizons instance "433"; location=568, epochs={'start': '2017-01-01', 'step': '1d', 'stop': '2017-02-01'}, id_type=None + """ + super().__init__() self.id = id self.location = location @@ -129,11 +139,12 @@ def __init__(self, id=None, location=None, epochs=None, def __str__(self): """ - String representation of HorizonsClass object instance' + String representation of this instance. Examples -------- + >>> from astroquery.jplhorizons import Horizons >>> eros = Horizons(id='433', location='568', ... epochs={'start':'2017-01-01', @@ -141,7 +152,9 @@ def __str__(self): ... 'step':'1d'}) >>> print(eros) # doctest: +SKIP JPLHorizons instance "433"; location=568, epochs={'start': '2017-01-01', 'step': '1d', 'stop': '2017-02-01'}, id_type=None + """ + return ('JPLHorizons instance \"{:s}\"; location={:s}, ' 'epochs={:s}, id_type={:s}').format( str(self.id), @@ -173,8 +186,6 @@ def ephemerides_async(self, airmass_lessthan=99, more information on the definitions of these quantities, please refer to the `Horizons User Manual `_. - - +------------------+-----------------------------------------------+ | Column Name | Definition | +==================+===============================================+ @@ -419,32 +430,41 @@ def ephemerides_async(self, airmass_lessthan=99, Parameters ---------- + airmass_lessthan : float, optional Defines a maximum airmass for the query, default: 99 + solar_elongation : tuple, optional Permissible solar elongation range: (minimum, maximum); default: (0,180) + max_hour_angle : float, optional Defines a maximum hour angle for the query, default: 0 + rate_cutoff : float, optional Angular range rate upper limit cutoff in arcsec/h; default: disabled + skip_daylight : boolean, optional Crop daylight epochs in query, default: False + refraction : boolean If ``True``, coordinates account for a standard atmosphere refraction model; if ``False``, coordinates do not account for refraction (airless model); default: ``False`` + refsystem : string Coordinate reference system: ``'ICRF'`` or ``'B1950'``; default: ``'ICRF'`` + closest_apparition : boolean, optional Only applies to comets. This option will choose the closest apparition available in time to the selected epoch; default: False. Do not use this option for non-cometary objects. + no_fragments : boolean, optional Only applies to comets. Reject all comet fragments from selection; - default: False. Do not use this option for - non-cometary objects. + default: False. Do not use this option for non-cometary objects. + quantities : integer or string, optional Single integer or comma-separated list in the form of a string corresponding to all the quantities to be queried from JPL Horizons @@ -452,24 +472,29 @@ def ephemerides_async(self, airmass_lessthan=99, Definition of Observer Table Quantities `_; default: all quantities + get_query_payload : boolean, optional When set to `True` the method returns the HTTP request parameters as a dict, default: False + get_raw_response : boolean, optional Return raw data as obtained by JPL Horizons without parsing the data into a table, default: False + extra_precision : boolean, optional Enables extra precision in RA and DEC values; default: False Returns ------- + response : `requests.Response` The response of the HTTP request. Examples -------- + >>> from astroquery.jplhorizons import Horizons >>> obj = Horizons(id='Ceres', location='568', ... epochs={'start':'2010-01-01', @@ -486,6 +511,7 @@ def ephemerides_async(self, airmass_lessthan=99, 1 Ceres (A801 AA) 2010-Jan-31 00:00 2455227.5 ... 247.2518 3.7289 1 Ceres (A801 AA) 2010-Feb-10 00:00 2455237.5 ... 250.0576 3.4415 1 Ceres (A801 AA) 2010-Feb-20 00:00 2455247.5 ... 252.7383 3.1451 + """ URL = conf.horizons_server @@ -673,27 +699,34 @@ def elements_async(self, get_query_payload=False, Parameters ---------- + refsystem : string Element reference system for geometric and astrometric quantities: ``'ICRF'`` or ``'B1950'``; default: ``'ICRF'`` + refplane : string Reference plane for all output quantities: ``'ecliptic'`` (ecliptic and mean equinox of reference epoch), ``'earth'`` (Earth mean equator and equinox of reference epoch), or ``'body'`` (body mean equator and node of date); default: ``'ecliptic'`` + tp_type : string Representation for time-of-perihelion passage: ``'absolute'`` or ``'relative'`` (to epoch); default: ``'absolute'`` + closest_apparition : boolean, optional Only applies to comets. This option will choose the closest apparition available in time to the selected epoch; default: False. Do not use this option for non-cometary objects. + no_fragments : boolean, optional Only applies to comets. Reject all comet fragments from selection; default: False. Do not use this option for non-cometary objects. + get_query_payload : boolean, optional When set to ``True`` the method returns the HTTP request parameters as a dict, default: False + get_raw_response: boolean, optional Return raw data as obtained by JPL Horizons without parsing the data into a table, default: False @@ -701,21 +734,24 @@ def elements_async(self, get_query_payload=False, Returns ------- + response : `requests.Response` The response of the HTTP request. Examples -------- - >>> from astroquery.jplhorizons import Horizons - >>> obj = Horizons(id='433', location='500@10', - ... epochs=2458133.33546) - >>> el = obj.elements() # doctest: +SKIP - >>> print(el) # doctest: +SKIP - targetname datetime_jd ... Q P - --- d ... AU d - ------------------ ------------- ... ------------- ------------ - 433 Eros (1898 DQ) 2458133.33546 ... 1.78244263804 642.93873484 + + >>> from astroquery.jplhorizons import Horizons + >>> obj = Horizons(id='433', location='500@10', + ... epochs=2458133.33546) + >>> el = obj.elements() # doctest: +SKIP + >>> print(el) # doctest: +SKIP + targetname datetime_jd ... Q P + --- d ... AU d + ------------------ ------------- ... ------------- ------------ + 433 Eros (1898 DQ) 2458133.33546 ... 1.78244263804 642.93873484 + """ URL = conf.horizons_server @@ -884,19 +920,24 @@ def vectors_async(self, get_query_payload=False, Parameters ---------- + closest_apparition : boolean, optional Only applies to comets. This option will choose the closest apparition available in time to the selected epoch; default: False. Do not use this option for non-cometary objects. + no_fragments : boolean, optional Only applies to comets. Reject all comet fragments from selection; default: False. Do not use this option for non-cometary objects. + get_query_payload : boolean, optional When set to `True` the method returns the HTTP request parameters as a dict, default: False + get_raw_response: boolean, optional Return raw data as obtained by JPL Horizons without parsing the data into a table, default: False + refplane : string Reference plane for all output quantities: ``'ecliptic'`` (ecliptic and mean equinox of reference epoch), ``'earth'`` (Earth mean @@ -905,9 +946,11 @@ def vectors_async(self, get_query_payload=False, See :ref:`Horizons Reference Frames ` in the astroquery documentation for details. + aberrations : string, optional Aberrations to be accounted for: [``'geometric'``, ``'astrometric'``, ``'apparent'``]. Default: ``'geometric'`` + delta_T : boolean, optional Triggers output of time-varying difference between TDB and UT time-scales. Default: False @@ -915,37 +958,40 @@ def vectors_async(self, get_query_payload=False, Returns ------- + response : `requests.Response` The response of the HTTP request. Examples -------- - >>> from astroquery.jplhorizons import Horizons - >>> obj = Horizons(id='2012 TC4', location='257', - ... epochs={'start':'2017-10-01', - ... 'stop':'2017-10-02', - ... 'step':'10m'}) - >>> vec = obj.vectors() # doctest: +SKIP - >>> print(vec) # doctest: +SKIP - targetname datetime_jd ... range range_rate - --- d ... AU AU / d - ---------- ------------- ... --------------- ----------------- - (2012 TC4) 2458027.5 ... 0.0429332099306 -0.00408018711862 - (2012 TC4) 2458027.50694 ... 0.0429048742906 -0.00408040726527 - (2012 TC4) 2458027.51389 ... 0.0428765385796 -0.00408020747595 - (2012 TC4) 2458027.52083 ... 0.0428482057142 -0.0040795878561 - (2012 TC4) 2458027.52778 ... 0.042819878607 -0.00407854931543 - (2012 TC4) 2458027.53472 ... 0.0427915601617 -0.0040770935665 - ... ... ... ... ... - (2012 TC4) 2458028.45833 ... 0.0392489462501 -0.00405496595173 - (2012 TC4) 2458028.46528 ... 0.03922077771 -0.00405750632914 - (2012 TC4) 2458028.47222 ... 0.039192592935 -0.00405964084539 - (2012 TC4) 2458028.47917 ... 0.039164394759 -0.00406136516755 - (2012 TC4) 2458028.48611 ... 0.0391361860433 -0.00406267574646 - (2012 TC4) 2458028.49306 ... 0.0391079696711 -0.0040635698239 - (2012 TC4) 2458028.5 ... 0.0390797485422 -0.00406404543822 - Length = 145 rows + + >>> from astroquery.jplhorizons import Horizons + >>> obj = Horizons(id='2012 TC4', location='257', + ... epochs={'start':'2017-10-01', + ... 'stop':'2017-10-02', + ... 'step':'10m'}) + >>> vec = obj.vectors() # doctest: +SKIP + >>> print(vec) # doctest: +SKIP + targetname datetime_jd ... range range_rate + --- d ... AU AU / d + ---------- ------------- ... --------------- ----------------- + (2012 TC4) 2458027.5 ... 0.0429332099306 -0.00408018711862 + (2012 TC4) 2458027.50694 ... 0.0429048742906 -0.00408040726527 + (2012 TC4) 2458027.51389 ... 0.0428765385796 -0.00408020747595 + (2012 TC4) 2458027.52083 ... 0.0428482057142 -0.0040795878561 + (2012 TC4) 2458027.52778 ... 0.042819878607 -0.00407854931543 + (2012 TC4) 2458027.53472 ... 0.0427915601617 -0.0040770935665 + ... ... ... ... ... + (2012 TC4) 2458028.45833 ... 0.0392489462501 -0.00405496595173 + (2012 TC4) 2458028.46528 ... 0.03922077771 -0.00405750632914 + (2012 TC4) 2458028.47222 ... 0.039192592935 -0.00405964084539 + (2012 TC4) 2458028.47917 ... 0.039164394759 -0.00406136516755 + (2012 TC4) 2458028.48611 ... 0.0391361860433 -0.00406267574646 + (2012 TC4) 2458028.49306 ... 0.0391079696711 -0.0040635698239 + (2012 TC4) 2458028.5 ... 0.0390797485422 -0.00406404543822 + Length = 145 rows + """ URL = conf.horizons_server @@ -1058,14 +1104,16 @@ def _parse_horizons(self, src): Parameters ---------- - self : HorizonsClass instance + src : list raw response from server Returns ------- + data : `astropy.Table` + """ self.raw_response = src @@ -1270,23 +1318,24 @@ def _parse_result(self, response, verbose=None): """ Routine for managing parser calls; - This routine decides based on `self.query_type` which parser has to be used. Parameters ---------- - self : Horizonsclass instance + response : string raw response from server Returns ------- + data : `astropy.Table` """ + self.last_response = response if self.query_type not in ['ephemerides', 'elements', 'vectors']: return None From 1c889d902539d52a312cd4b53234879e0bf9c5ee Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Tue, 24 May 2022 20:32:15 -0400 Subject: [PATCH 02/17] Edit examples, mostly to tag remote_data --- astroquery/jplhorizons/core.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/astroquery/jplhorizons/core.py b/astroquery/jplhorizons/core.py index 1421631629..21325e5776 100644 --- a/astroquery/jplhorizons/core.py +++ b/astroquery/jplhorizons/core.py @@ -91,11 +91,11 @@ def __init__(self, id=None, location=None, epochs=None, >>> from astroquery.jplhorizons import Horizons >>> eros = Horizons(id='433', location='568', - ... epochs={'start':'2017-01-01', - ... 'stop':'2017-02-01', - ... 'step':'1d'}) - >>> print(eros) # doctest: +SKIP - JPLHorizons instance "433"; location=568, epochs={'start': '2017-01-01', 'step': '1d', 'stop': '2017-02-01'}, id_type=None + ... epochs={'start': '2017-01-01', + ... 'stop': '2017-02-01', + ... 'step': '1d'}) + >>> print(eros) + JPLHorizons instance "433"; location=568, epochs={'start': '2017-01-01', 'stop': '2017-02-01', 'step': '1d'}, id_type=None """ @@ -150,8 +150,8 @@ def __str__(self): ... epochs={'start':'2017-01-01', ... 'stop':'2017-02-01', ... 'step':'1d'}) - >>> print(eros) # doctest: +SKIP - JPLHorizons instance "433"; location=568, epochs={'start': '2017-01-01', 'step': '1d', 'stop': '2017-02-01'}, id_type=None + >>> print(eros) + JPLHorizons instance "433"; location=568, epochs={'start': '2017-01-01', 'stop': '2017-02-01', 'step': '1d'}, id_type=None """ @@ -500,7 +500,7 @@ def ephemerides_async(self, airmass_lessthan=99, ... epochs={'start':'2010-01-01', ... 'stop':'2010-03-01', ... 'step':'10d'}) - >>> eph = obj.ephemerides() # doctest: +SKIP + >>> eph = obj.ephemerides() # doctest: +REMOTE_DATA >>> print(eph) # doctest: +SKIP targetname datetime_str datetime_jd ... PABLon PABLat --- --- d ... deg deg @@ -745,10 +745,10 @@ def elements_async(self, get_query_payload=False, >>> from astroquery.jplhorizons import Horizons >>> obj = Horizons(id='433', location='500@10', ... epochs=2458133.33546) - >>> el = obj.elements() # doctest: +SKIP + >>> el = obj.elements() # doctest: +REMOTE_DATA >>> print(el) # doctest: +SKIP targetname datetime_jd ... Q P - --- d ... AU d + --- d ... AU d ------------------ ------------- ... ------------- ------------ 433 Eros (1898 DQ) 2458133.33546 ... 1.78244263804 642.93873484 @@ -968,13 +968,13 @@ def vectors_async(self, get_query_payload=False, >>> from astroquery.jplhorizons import Horizons >>> obj = Horizons(id='2012 TC4', location='257', - ... epochs={'start':'2017-10-01', - ... 'stop':'2017-10-02', - ... 'step':'10m'}) - >>> vec = obj.vectors() # doctest: +SKIP + ... epochs={'start': '2017-10-01', + ... 'stop': '2017-10-02', + ... 'step': '10m'}) + >>> vec = obj.vectors() # doctest: +REMOTE_DATA >>> print(vec) # doctest: +SKIP targetname datetime_jd ... range range_rate - --- d ... AU AU / d + --- d ... AU AU / d ---------- ------------- ... --------------- ----------------- (2012 TC4) 2458027.5 ... 0.0429332099306 -0.00408018711862 (2012 TC4) 2458027.50694 ... 0.0429048742906 -0.00408040726527 @@ -982,7 +982,7 @@ def vectors_async(self, get_query_payload=False, (2012 TC4) 2458027.52083 ... 0.0428482057142 -0.0040795878561 (2012 TC4) 2458027.52778 ... 0.042819878607 -0.00407854931543 (2012 TC4) 2458027.53472 ... 0.0427915601617 -0.0040770935665 - ... ... ... ... ... + ... ... ... ... ... (2012 TC4) 2458028.45833 ... 0.0392489462501 -0.00405496595173 (2012 TC4) 2458028.46528 ... 0.03922077771 -0.00405750632914 (2012 TC4) 2458028.47222 ... 0.039192592935 -0.00405964084539 From e1089727a2d8178ca0c69b0c54608135ff88bd20 Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Tue, 24 May 2022 20:41:57 -0400 Subject: [PATCH 03/17] Fix Ceres remote test. V and surfbright tend to vary a lot more than the other quantities. Giving them a generous test. --- .../tests/test_jplhorizons_remote.py | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/astroquery/jplhorizons/tests/test_jplhorizons_remote.py b/astroquery/jplhorizons/tests/test_jplhorizons_remote.py index 5ab186e801..075d95d510 100644 --- a/astroquery/jplhorizons/tests/test_jplhorizons_remote.py +++ b/astroquery/jplhorizons/tests/test_jplhorizons_remote.py @@ -31,16 +31,18 @@ def test_ephemerides_query(self): assert_quantity_allclose( [2451544.5, - 188.70280, 9.09829, 34.40955, -2.68359, - 8.469, 7.009, 96.17083, - 161.3828, 10.4528, 2.551099014238, 0.1744491, - 2.26315116146176, -21.9390511, 18.822054, - 95.3996, 22.5698, 292.551, 296.850, - 184.3426220, 11.7996521, 289.864329, 71.545655, - 0, 0], + 188.7028, 9.09829, 34.40955, -2.68359, + 96.17083, + 161.3828, 10.4528, 2.551099027865, 0.1744491, + 2.26315121010004, -21.9390512, 18.82205467, + 95.3996, 22.5698, 292.551, + 296.85, + 184.3426241, 11.7996517, 289.864335, + 71.545654, + 0.0, 0.0], [res['datetime_jd'], res['RA'], res['DEC'], res['RA_rate'], res['DEC_rate'], - res['V'], res['surfbright'], res['illumination'], + res['illumination'], res['EclLon'], res['EclLat'], res['r'], res['r_rate'], res['delta'], res['delta_rate'], res['lighttime'], res['elong'], res['alpha'], res['sunTargetPA'], @@ -49,6 +51,10 @@ def test_ephemerides_query(self): res['GlxLat'], res['RA_3sigma'], res['DEC_3sigma']], rtol=1e-3) + # V and surfbright tend to vary a lot more than the others. Give them a + # more generous test: + assert_quantity_allclose([8.239, 6.779], [res['V'], res['surfbright']], rtol=0.1) + def test_ephemerides_query_two(self): # check comet ephemerides using options obj = jplhorizons.Horizons(id='Halley', id_type='comet_name', From 634ef4e81c9bf06f4e3476327fdfa7850b340970 Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Tue, 24 May 2022 20:55:03 -0400 Subject: [PATCH 04/17] Only avoid caching HTTP errored queries. --- astroquery/jplhorizons/core.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/astroquery/jplhorizons/core.py b/astroquery/jplhorizons/core.py index 21325e5776..4c4a548494 100644 --- a/astroquery/jplhorizons/core.py +++ b/astroquery/jplhorizons/core.py @@ -9,6 +9,7 @@ import warnings # 2. third party imports +from requests.exceptions import HTTPError from astropy.table import Table, Column from astropy.io import ascii from astropy.time import Time @@ -1337,19 +1338,18 @@ def _parse_result(self, response, verbose=None): """ self.last_response = response - if self.query_type not in ['ephemerides', 'elements', 'vectors']: - return None - else: + try: + response.raise_for_status() + except HTTPError: + # don't cache any HTTP errored queries (especially when the API is down!) try: - data = self._parse_horizons(response.text) - except Exception as ex: - try: - self._last_query.remove_cache_file(self.cache_location) - except OSError: - # this is allowed: if `cache` was set to False, this - # won't be needed - pass - raise + self._last_query.remove_cache_file(self.cache_location) + except OSError: + # this is allowed: if `cache` was set to False, this + # won't be needed + pass + raise + data = self._parse_horizons(response.text) return data From d54764278fe0adb372af110a8b2426bc251fe03e Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Tue, 24 May 2022 21:02:13 -0400 Subject: [PATCH 05/17] Simplify function calls for query parsing. --- astroquery/jplhorizons/core.py | 64 +++++++++++----------------------- 1 file changed, 20 insertions(+), 44 deletions(-) diff --git a/astroquery/jplhorizons/core.py b/astroquery/jplhorizons/core.py index 4c4a548494..007ea99ce2 100644 --- a/astroquery/jplhorizons/core.py +++ b/astroquery/jplhorizons/core.py @@ -1098,26 +1098,39 @@ def vectors_async(self, get_query_payload=False, # ---------------------------------- parser functions - def _parse_horizons(self, src): + def _parse_result(self, response, verbose=None): """ - Routine for parsing data from JPL Horizons + Parse query result to a `~astropy.table.Table` object. Parameters ---------- - src : list - raw response from server + response : `~requests.Response` + Response from server. Returns ------- - data : `astropy.Table` + data : `~astropy.table.Table` """ - self.raw_response = src + self.last_response = response + try: + response.raise_for_status() + except HTTPError: + # don't cache any HTTP errored queries (especially when the API is down!) + try: + self._last_query.remove_cache_file(self.cache_location) + except OSError: + # this is allowed: if `cache` was set to False, this + # won't be needed + pass + raise + + self.raw_response = response.text # return raw response, if desired if self.return_raw: @@ -1126,7 +1139,7 @@ def _parse_horizons(self, src): return self.raw_response # split response by line break - src = src.split('\n') + src = response.text.split('\n') data_start_idx = 0 data_end_idx = 0 @@ -1315,43 +1328,6 @@ def _parse_horizons(self, src): return data - def _parse_result(self, response, verbose=None): - """ - Routine for managing parser calls; - - This routine decides based on `self.query_type` which parser - has to be used. - - - Parameters - ---------- - - response : string - raw response from server - - - Returns - ------- - - data : `astropy.Table` - - """ - - self.last_response = response - try: - response.raise_for_status() - except HTTPError: - # don't cache any HTTP errored queries (especially when the API is down!) - try: - self._last_query.remove_cache_file(self.cache_location) - except OSError: - # this is allowed: if `cache` was set to False, this - # won't be needed - pass - raise - data = self._parse_horizons(response.text) - return data - # the default tool for users to interact with is an instance of the Class Horizons = HorizonsClass() From 768d05996928c35308cc6c9226c56ec54ec0d08e Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Tue, 24 May 2022 21:06:06 -0400 Subject: [PATCH 06/17] Only grab server/API URL during initialization. --- astroquery/jplhorizons/core.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/astroquery/jplhorizons/core.py b/astroquery/jplhorizons/core.py index 007ea99ce2..f9dd6f7d70 100644 --- a/astroquery/jplhorizons/core.py +++ b/astroquery/jplhorizons/core.py @@ -104,6 +104,8 @@ def __init__(self, id=None, location=None, epochs=None, self.id = id self.location = location + self.server_url = conf.horizons_server + # check for epochs to be dict or list-like; else: make it a list if epochs is not None: if isinstance(epochs, (list, tuple, ndarray)): @@ -515,8 +517,6 @@ def ephemerides_async(self, airmass_lessthan=99, """ - URL = conf.horizons_server - # check for required information if self.id is None: raise ValueError("'id' parameter not set. Query aborted.") @@ -619,7 +619,7 @@ def ephemerides_async(self, airmass_lessthan=99, self.return_raw = True # query and parse - response = self._request('GET', URL, params=request_payload, + response = self._request('GET', self.server_url, params=request_payload, timeout=self.TIMEOUT, cache=cache) self.uri = response.url @@ -755,8 +755,6 @@ def elements_async(self, get_query_payload=False, """ - URL = conf.horizons_server - # check for required information if self.id is None: raise ValueError("'id' parameter not set. Query aborted.") @@ -837,7 +835,7 @@ def elements_async(self, get_query_payload=False, self.return_raw = True # query and parse - response = self._request('GET', URL, params=request_payload, + response = self._request('GET', self.server_url, params=request_payload, timeout=self.TIMEOUT, cache=cache) self.uri = response.url @@ -995,8 +993,6 @@ def vectors_async(self, get_query_payload=False, """ - URL = conf.horizons_server - # check for required information if self.id is None: raise ValueError("'id' parameter not set. Query aborted.") @@ -1083,7 +1079,7 @@ def vectors_async(self, get_query_payload=False, self.return_raw = True # query and parse - response = self._request('GET', URL, params=request_payload, + response = self._request('GET', self.server_url, params=request_payload, timeout=self.TIMEOUT, cache=cache) self.uri = response.url From 03299ddefcce9aa8bc2ef7db3297229577e8f2da Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Tue, 24 May 2022 21:07:53 -0400 Subject: [PATCH 07/17] Use isinstance() not type() --- astroquery/jplhorizons/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/astroquery/jplhorizons/core.py b/astroquery/jplhorizons/core.py index f9dd6f7d70..c9f9e660b5 100644 --- a/astroquery/jplhorizons/core.py +++ b/astroquery/jplhorizons/core.py @@ -809,7 +809,7 @@ def elements_async(self, get_query_payload=False, request_payload['TLIST'] = "\n".join([str(epoch) for epoch in self.epochs]) - elif type(self.epochs) is dict: + elif isinstance(self.epochs, dict): if ('start' not in self.epochs or 'stop' not in self.epochs or 'step' not in self.epochs): raise ValueError("'epochs' must contain start, " @@ -1052,7 +1052,7 @@ def vectors_async(self, get_query_payload=False, if isinstance(self.epochs, (list, tuple, ndarray)): request_payload['TLIST'] = "\n".join([str(epoch) for epoch in self.epochs]) - elif type(self.epochs) is dict: + elif isinstance(self.epochs, dict): if ('start' not in self.epochs or 'stop' not in self.epochs or 'step' not in self.epochs): raise ValueError("'epochs' must contain start, " + From 987b9c509085970d86910c48cb85304cef537c40 Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Tue, 24 May 2022 21:19:31 -0400 Subject: [PATCH 08/17] Remove get_raw_response optional parameters. This functionality is already available with the *_async() methods. --- astroquery/jplhorizons/core.py | 30 ++----------------- .../tests/test_jplhorizons_remote.py | 23 -------------- docs/jplhorizons/jplhorizons.rst | 28 ++++++++--------- 3 files changed, 15 insertions(+), 66 deletions(-) diff --git a/astroquery/jplhorizons/core.py b/astroquery/jplhorizons/core.py index c9f9e660b5..178925ef2a 100644 --- a/astroquery/jplhorizons/core.py +++ b/astroquery/jplhorizons/core.py @@ -176,7 +176,7 @@ def ephemerides_async(self, airmass_lessthan=99, closest_apparition=False, no_fragments=False, quantities=conf.eph_quantities, get_query_payload=False, - get_raw_response=False, cache=True, + cache=True, extra_precision=False): """ Query JPL Horizons for ephemerides. @@ -480,10 +480,6 @@ def ephemerides_async(self, airmass_lessthan=99, When set to `True` the method returns the HTTP request parameters as a dict, default: False - get_raw_response : boolean, optional - Return raw data as obtained by JPL Horizons without parsing the data - into a table, default: False - extra_precision : boolean, optional Enables extra precision in RA and DEC values; default: False @@ -614,10 +610,6 @@ def ephemerides_async(self, airmass_lessthan=99, if get_query_payload: return request_payload - # set return_raw flag, if raw response desired - if get_raw_response: - self.return_raw = True - # query and parse response = self._request('GET', self.server_url, params=request_payload, timeout=self.TIMEOUT, cache=cache) @@ -637,7 +629,7 @@ def elements_async(self, get_query_payload=False, refplane='ecliptic', tp_type='absolute', closest_apparition=False, no_fragments=False, - get_raw_response=False, cache=True): + cache=True): """ Query JPL Horizons for osculating orbital elements. @@ -728,10 +720,6 @@ def elements_async(self, get_query_payload=False, When set to ``True`` the method returns the HTTP request parameters as a dict, default: False - get_raw_response: boolean, optional - Return raw data as obtained by JPL Horizons without parsing the data - into a table, default: False - Returns ------- @@ -830,10 +818,6 @@ def elements_async(self, get_query_payload=False, if get_query_payload: return request_payload - # set return_raw flag, if raw response desired - if get_raw_response: - self.return_raw = True - # query and parse response = self._request('GET', self.server_url, params=request_payload, timeout=self.TIMEOUT, cache=cache) @@ -850,7 +834,7 @@ def elements_async(self, get_query_payload=False, def vectors_async(self, get_query_payload=False, closest_apparition=False, no_fragments=False, - get_raw_response=False, cache=True, + cache=True, refplane='ecliptic', aberrations='geometric', delta_T=False,): """ @@ -933,10 +917,6 @@ def vectors_async(self, get_query_payload=False, When set to `True` the method returns the HTTP request parameters as a dict, default: False - get_raw_response: boolean, optional - Return raw data as obtained by JPL Horizons without parsing the data - into a table, default: False - refplane : string Reference plane for all output quantities: ``'ecliptic'`` (ecliptic and mean equinox of reference epoch), ``'earth'`` (Earth mean @@ -1074,10 +1054,6 @@ def vectors_async(self, get_query_payload=False, if get_query_payload: return request_payload - # set return_raw flag, if raw response desired - if get_raw_response: - self.return_raw = True - # query and parse response = self._request('GET', self.server_url, params=request_payload, timeout=self.TIMEOUT, cache=cache) diff --git a/astroquery/jplhorizons/tests/test_jplhorizons_remote.py b/astroquery/jplhorizons/tests/test_jplhorizons_remote.py index 075d95d510..34c7eb7d84 100644 --- a/astroquery/jplhorizons/tests/test_jplhorizons_remote.py +++ b/astroquery/jplhorizons/tests/test_jplhorizons_remote.py @@ -174,13 +174,6 @@ def test_ephemerides_query_six(self): assert len(res) == 32 - def test_ephemerides_query_raw(self): - res = (jplhorizons.Horizons(id='Ceres', location='500', - id_type='smallbody', epochs=2451544.5). - ephemerides(get_raw_response=True)) - - assert len(res) >= 15400 - def test_elements_query(self): res = jplhorizons.Horizons(id='Ceres', location='500@10', id_type='smallbody', @@ -226,14 +219,6 @@ def test_elements_query_two(self): [res['Omega'], res['w'], res['Tp_jd']], rtol=1e-3) - def test_elements_query_raw(self): - res = jplhorizons.Horizons(id='Ceres', location='500@10', - id_type='smallbody', - epochs=2451544.5).elements( - get_raw_response=True) - - assert len(res) >= 6686 - def test_vectors_query(self): # check values of Ceres for a given epoch # orbital uncertainty of Ceres is basically zero @@ -260,14 +245,6 @@ def test_vectors_query(self): res['lighttime'], res['range'], res['range_rate']], rtol=1e-3) - def test_vectors_query_raw(self): - res = jplhorizons.Horizons(id='Ceres', location='500@10', - id_type='smallbody', - epochs=2451544.5).vectors( - get_raw_response=True) - - assert len(res) >= 6412 - def test_unknownobject(self): with pytest.raises(ValueError): jplhorizons.Horizons(id='spamspamspameggsspam', location='500', diff --git a/docs/jplhorizons/jplhorizons.rst b/docs/jplhorizons/jplhorizons.rst index 51573b3935..62bae3e401 100644 --- a/docs/jplhorizons/jplhorizons.rst +++ b/docs/jplhorizons/jplhorizons.rst @@ -189,9 +189,7 @@ limits fragment matching (73P-B would only match 73P-B), respectively. Note that these options should only be used for comets and will crash the query for other object types. Extra precision in the queried properties can be requested using the ``extra_precision`` option. Furthermore, ``get_query_payload=True`` -skips the query and only returns the query payload, whereas -``get_raw_response=True`` returns the raw query response instead of the astropy -table. +skips the query and only returns the query payload. :meth:`~astroquery.jplhorizons.HorizonsClass.ephemerides` queries by default all available quantities from the JPL Horizons servers. This might take a while. If @@ -243,9 +241,8 @@ absolute representation of the time of perihelion passage. For comets, the options ``closest_apparition`` and ``no_fragments`` are available, which select the closest apparition in time and reject fragments, respectively. Note that these options should only be used for comets and will crash the query for other -object types. Also available are ``get_query_payload=True``, which skips the -query and only returns the query payload, and ``get_raw_response=True``, which -returns the raw query response instead of the astropy table. +object types. Also available is ``get_query_payload=True``, which skips the +query and only returns the query payload. Vectors ------- @@ -290,16 +287,15 @@ The following fields are queried: Similar to the other :class:`~astroquery.jplhorizons.HorizonsClass` functions, -optional parameters of :meth:`~astroquery.jplhorizons.HorizonsClass.vectors` are -``get_query_payload=True``, which skips the query and only returns the query -payload, and ``get_raw_response=True``, which returns the raw query response -instead of the astropy table. For comets, the options ``closest_apparation`` and -``no_fragments`` are available, which select the closest apparition in time and -reject fragments, respectively. Note that these options should only be used for -comets and will crash the query for other object types. Options ``aberrations`` -and ``delta_T`` provide different choices for aberration corrections as well as -a measure for time-varying differences between TDB and UT time-scales, -respectively. +an optional parameter of :meth:`~astroquery.jplhorizons.HorizonsClass.vectors` +is ``get_query_payload=True``, which skips the query and only returns the query +payload for diagnostic purposes. For comets, the options ``closest_apparation`` +and ``no_fragments`` are available, which select the closest apparition in time +and reject fragments, respectively. Note that these options should only be used +for comets and will crash the query for other object types. Options +``aberrations`` and ``delta_T`` provide different choices for aberration +corrections as well as a measure for time-varying differences between TDB and UT +time-scales, respectively. How to Use the Query Tables From 20ef99750abb64943d186493fe1f5f5d1c6028d0 Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Tue, 24 May 2022 21:34:20 -0400 Subject: [PATCH 09/17] Add changelog entry. --- CHANGES.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 5937e3ab65..b1049e3e08 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -31,6 +31,12 @@ ipac.nexsci.nasa_exoplanet_archive - The deprecated methods ``query_planet()`` and ``query_star()`` have been removed. +jplhorizons +^^^^^^^^^^^ + +- Deprecate ``get_raw_response`` options in query methods. The raw response may + be retrieved from the _async() methods. [#2418] + jplsbdb ^^^^^^^ From f0a9418ebbd0776df9ce7639cd585755b88a5f64 Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Fri, 27 May 2022 11:56:01 -0400 Subject: [PATCH 10/17] Revert "Only grab server/API URL during initialization." This reverts commit da856a5d68f513e56960434c10fcbbbd1671f921. --- astroquery/jplhorizons/core.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/astroquery/jplhorizons/core.py b/astroquery/jplhorizons/core.py index 178925ef2a..c06d11a309 100644 --- a/astroquery/jplhorizons/core.py +++ b/astroquery/jplhorizons/core.py @@ -104,8 +104,6 @@ def __init__(self, id=None, location=None, epochs=None, self.id = id self.location = location - self.server_url = conf.horizons_server - # check for epochs to be dict or list-like; else: make it a list if epochs is not None: if isinstance(epochs, (list, tuple, ndarray)): @@ -513,6 +511,8 @@ def ephemerides_async(self, airmass_lessthan=99, """ + URL = conf.horizons_server + # check for required information if self.id is None: raise ValueError("'id' parameter not set. Query aborted.") @@ -611,7 +611,7 @@ def ephemerides_async(self, airmass_lessthan=99, return request_payload # query and parse - response = self._request('GET', self.server_url, params=request_payload, + response = self._request('GET', URL, params=request_payload, timeout=self.TIMEOUT, cache=cache) self.uri = response.url @@ -743,6 +743,8 @@ def elements_async(self, get_query_payload=False, """ + URL = conf.horizons_server + # check for required information if self.id is None: raise ValueError("'id' parameter not set. Query aborted.") @@ -819,7 +821,7 @@ def elements_async(self, get_query_payload=False, return request_payload # query and parse - response = self._request('GET', self.server_url, params=request_payload, + response = self._request('GET', URL, params=request_payload, timeout=self.TIMEOUT, cache=cache) self.uri = response.url @@ -973,6 +975,8 @@ def vectors_async(self, get_query_payload=False, """ + URL = conf.horizons_server + # check for required information if self.id is None: raise ValueError("'id' parameter not set. Query aborted.") @@ -1055,7 +1059,7 @@ def vectors_async(self, get_query_payload=False, return request_payload # query and parse - response = self._request('GET', self.server_url, params=request_payload, + response = self._request('GET', URL, params=request_payload, timeout=self.TIMEOUT, cache=cache) self.uri = response.url From 55642bc09f2932151ce1553d024ecb13c639132b Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Thu, 9 Jun 2022 19:24:01 -0400 Subject: [PATCH 11/17] Revert "Remove get_raw_response optional parameters." This reverts commit 0dbb4e5f1cf053cfa0d93a7cc19cdbf7eca63f97. --- astroquery/jplhorizons/core.py | 30 +++++++++++++++++-- .../tests/test_jplhorizons_remote.py | 23 ++++++++++++++ docs/jplhorizons/jplhorizons.rst | 28 +++++++++-------- 3 files changed, 66 insertions(+), 15 deletions(-) diff --git a/astroquery/jplhorizons/core.py b/astroquery/jplhorizons/core.py index c06d11a309..70757e5932 100644 --- a/astroquery/jplhorizons/core.py +++ b/astroquery/jplhorizons/core.py @@ -174,7 +174,7 @@ def ephemerides_async(self, airmass_lessthan=99, closest_apparition=False, no_fragments=False, quantities=conf.eph_quantities, get_query_payload=False, - cache=True, + get_raw_response=False, cache=True, extra_precision=False): """ Query JPL Horizons for ephemerides. @@ -478,6 +478,10 @@ def ephemerides_async(self, airmass_lessthan=99, When set to `True` the method returns the HTTP request parameters as a dict, default: False + get_raw_response : boolean, optional + Return raw data as obtained by JPL Horizons without parsing the data + into a table, default: False + extra_precision : boolean, optional Enables extra precision in RA and DEC values; default: False @@ -610,6 +614,10 @@ def ephemerides_async(self, airmass_lessthan=99, if get_query_payload: return request_payload + # set return_raw flag, if raw response desired + if get_raw_response: + self.return_raw = True + # query and parse response = self._request('GET', URL, params=request_payload, timeout=self.TIMEOUT, cache=cache) @@ -629,7 +637,7 @@ def elements_async(self, get_query_payload=False, refplane='ecliptic', tp_type='absolute', closest_apparition=False, no_fragments=False, - cache=True): + get_raw_response=False, cache=True): """ Query JPL Horizons for osculating orbital elements. @@ -720,6 +728,10 @@ def elements_async(self, get_query_payload=False, When set to ``True`` the method returns the HTTP request parameters as a dict, default: False + get_raw_response: boolean, optional + Return raw data as obtained by JPL Horizons without parsing the data + into a table, default: False + Returns ------- @@ -820,6 +832,10 @@ def elements_async(self, get_query_payload=False, if get_query_payload: return request_payload + # set return_raw flag, if raw response desired + if get_raw_response: + self.return_raw = True + # query and parse response = self._request('GET', URL, params=request_payload, timeout=self.TIMEOUT, cache=cache) @@ -836,7 +852,7 @@ def elements_async(self, get_query_payload=False, def vectors_async(self, get_query_payload=False, closest_apparition=False, no_fragments=False, - cache=True, + get_raw_response=False, cache=True, refplane='ecliptic', aberrations='geometric', delta_T=False,): """ @@ -919,6 +935,10 @@ def vectors_async(self, get_query_payload=False, When set to `True` the method returns the HTTP request parameters as a dict, default: False + get_raw_response: boolean, optional + Return raw data as obtained by JPL Horizons without parsing the data + into a table, default: False + refplane : string Reference plane for all output quantities: ``'ecliptic'`` (ecliptic and mean equinox of reference epoch), ``'earth'`` (Earth mean @@ -1058,6 +1078,10 @@ def vectors_async(self, get_query_payload=False, if get_query_payload: return request_payload + # set return_raw flag, if raw response desired + if get_raw_response: + self.return_raw = True + # query and parse response = self._request('GET', URL, params=request_payload, timeout=self.TIMEOUT, cache=cache) diff --git a/astroquery/jplhorizons/tests/test_jplhorizons_remote.py b/astroquery/jplhorizons/tests/test_jplhorizons_remote.py index 34c7eb7d84..075d95d510 100644 --- a/astroquery/jplhorizons/tests/test_jplhorizons_remote.py +++ b/astroquery/jplhorizons/tests/test_jplhorizons_remote.py @@ -174,6 +174,13 @@ def test_ephemerides_query_six(self): assert len(res) == 32 + def test_ephemerides_query_raw(self): + res = (jplhorizons.Horizons(id='Ceres', location='500', + id_type='smallbody', epochs=2451544.5). + ephemerides(get_raw_response=True)) + + assert len(res) >= 15400 + def test_elements_query(self): res = jplhorizons.Horizons(id='Ceres', location='500@10', id_type='smallbody', @@ -219,6 +226,14 @@ def test_elements_query_two(self): [res['Omega'], res['w'], res['Tp_jd']], rtol=1e-3) + def test_elements_query_raw(self): + res = jplhorizons.Horizons(id='Ceres', location='500@10', + id_type='smallbody', + epochs=2451544.5).elements( + get_raw_response=True) + + assert len(res) >= 6686 + def test_vectors_query(self): # check values of Ceres for a given epoch # orbital uncertainty of Ceres is basically zero @@ -245,6 +260,14 @@ def test_vectors_query(self): res['lighttime'], res['range'], res['range_rate']], rtol=1e-3) + def test_vectors_query_raw(self): + res = jplhorizons.Horizons(id='Ceres', location='500@10', + id_type='smallbody', + epochs=2451544.5).vectors( + get_raw_response=True) + + assert len(res) >= 6412 + def test_unknownobject(self): with pytest.raises(ValueError): jplhorizons.Horizons(id='spamspamspameggsspam', location='500', diff --git a/docs/jplhorizons/jplhorizons.rst b/docs/jplhorizons/jplhorizons.rst index 62bae3e401..51573b3935 100644 --- a/docs/jplhorizons/jplhorizons.rst +++ b/docs/jplhorizons/jplhorizons.rst @@ -189,7 +189,9 @@ limits fragment matching (73P-B would only match 73P-B), respectively. Note that these options should only be used for comets and will crash the query for other object types. Extra precision in the queried properties can be requested using the ``extra_precision`` option. Furthermore, ``get_query_payload=True`` -skips the query and only returns the query payload. +skips the query and only returns the query payload, whereas +``get_raw_response=True`` returns the raw query response instead of the astropy +table. :meth:`~astroquery.jplhorizons.HorizonsClass.ephemerides` queries by default all available quantities from the JPL Horizons servers. This might take a while. If @@ -241,8 +243,9 @@ absolute representation of the time of perihelion passage. For comets, the options ``closest_apparition`` and ``no_fragments`` are available, which select the closest apparition in time and reject fragments, respectively. Note that these options should only be used for comets and will crash the query for other -object types. Also available is ``get_query_payload=True``, which skips the -query and only returns the query payload. +object types. Also available are ``get_query_payload=True``, which skips the +query and only returns the query payload, and ``get_raw_response=True``, which +returns the raw query response instead of the astropy table. Vectors ------- @@ -287,15 +290,16 @@ The following fields are queried: Similar to the other :class:`~astroquery.jplhorizons.HorizonsClass` functions, -an optional parameter of :meth:`~astroquery.jplhorizons.HorizonsClass.vectors` -is ``get_query_payload=True``, which skips the query and only returns the query -payload for diagnostic purposes. For comets, the options ``closest_apparation`` -and ``no_fragments`` are available, which select the closest apparition in time -and reject fragments, respectively. Note that these options should only be used -for comets and will crash the query for other object types. Options -``aberrations`` and ``delta_T`` provide different choices for aberration -corrections as well as a measure for time-varying differences between TDB and UT -time-scales, respectively. +optional parameters of :meth:`~astroquery.jplhorizons.HorizonsClass.vectors` are +``get_query_payload=True``, which skips the query and only returns the query +payload, and ``get_raw_response=True``, which returns the raw query response +instead of the astropy table. For comets, the options ``closest_apparation`` and +``no_fragments`` are available, which select the closest apparition in time and +reject fragments, respectively. Note that these options should only be used for +comets and will crash the query for other object types. Options ``aberrations`` +and ``delta_T`` provide different choices for aberration corrections as well as +a measure for time-varying differences between TDB and UT time-scales, +respectively. How to Use the Query Tables From 21844a74413bcb5aef0596cd502a89d8188e868c Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Thu, 9 Jun 2022 19:55:53 -0400 Subject: [PATCH 12/17] Deprecate get_raw_response. --- astroquery/jplhorizons/core.py | 20 ++++++++++- .../tests/test_jplhorizons_remote.py | 36 ++++++++++++------- docs/jplhorizons/jplhorizons.rst | 14 +++----- 3 files changed, 48 insertions(+), 22 deletions(-) diff --git a/astroquery/jplhorizons/core.py b/astroquery/jplhorizons/core.py index 70757e5932..0f9cc61847 100644 --- a/astroquery/jplhorizons/core.py +++ b/astroquery/jplhorizons/core.py @@ -14,6 +14,7 @@ from astropy.io import ascii from astropy.time import Time from astropy.utils.exceptions import AstropyDeprecationWarning +from astropy.utils.decorators import deprecated_renamed_argument # 3. local imports - use relative imports # commonly required local imports shown below as example @@ -165,6 +166,8 @@ def __str__(self): # ---------------------------------- query functions + @deprecated_renamed_argument("get_raw_response", None, since="0.4.7", + alternative="async methods") def ephemerides_async(self, airmass_lessthan=99, solar_elongation=(0, 180), max_hour_angle=0, rate_cutoff=None, @@ -179,6 +182,10 @@ def ephemerides_async(self, airmass_lessthan=99, """ Query JPL Horizons for ephemerides. + .. deprecated:: 0.4.7 + The ``get_raw_response`` keyword argument is deprecated. The + `~HorizonsClass.ephemerides_async` method will return a raw response. + The ``location`` parameter in ``HorizonsClass`` refers in this case to the location of the observer. @@ -492,7 +499,6 @@ def ephemerides_async(self, airmass_lessthan=99, response : `requests.Response` The response of the HTTP request. - Examples -------- @@ -632,6 +638,8 @@ def ephemerides_async(self, airmass_lessthan=99, return response + @deprecated_renamed_argument("get_raw_response", None, since="0.4.7", + alternative="async methods") def elements_async(self, get_query_payload=False, refsystem='ICRF', refplane='ecliptic', @@ -641,6 +649,10 @@ def elements_async(self, get_query_payload=False, """ Query JPL Horizons for osculating orbital elements. + .. deprecated:: 0.4.7 + The ``get_raw_response`` keyword argument is deprecated. The + `~HorizonsClass.elements_async` method will return a raw response. + The ``location`` parameter in ``HorizonsClass`` refers in this case to the center body relative to which the elements are provided. @@ -850,6 +862,8 @@ def elements_async(self, get_query_payload=False, return response + @deprecated_renamed_argument("get_raw_response", None, since="0.4.7", + alternative="async methods") def vectors_async(self, get_query_payload=False, closest_apparition=False, no_fragments=False, get_raw_response=False, cache=True, @@ -858,6 +872,10 @@ def vectors_async(self, get_query_payload=False, """ Query JPL Horizons for state vectors. + .. deprecated:: 0.4.7 + The ``get_raw_response`` keyword argument is deprecated. The + `~HorizonsClass.vectors_async` method will return a raw response. + The ``location`` parameter in ``HorizonsClass`` refers in this case to the center body relative to which the vectors are provided. diff --git a/astroquery/jplhorizons/tests/test_jplhorizons_remote.py b/astroquery/jplhorizons/tests/test_jplhorizons_remote.py index 075d95d510..4f69be6821 100644 --- a/astroquery/jplhorizons/tests/test_jplhorizons_remote.py +++ b/astroquery/jplhorizons/tests/test_jplhorizons_remote.py @@ -2,9 +2,11 @@ import pytest -from astropy.tests.helper import assert_quantity_allclose from numpy.ma import is_masked +from astropy.tests.helper import assert_quantity_allclose +from astropy.utils.exceptions import AstropyDeprecationWarning + from ... import jplhorizons @@ -175,9 +177,13 @@ def test_ephemerides_query_six(self): assert len(res) == 32 def test_ephemerides_query_raw(self): - res = (jplhorizons.Horizons(id='Ceres', location='500', - id_type='smallbody', epochs=2451544.5). - ephemerides(get_raw_response=True)) + # deprecated as of #2418 + with pytest.warns(AstropyDeprecationWarning): + res = (jplhorizons.Horizons(id='Ceres', + location='500', + id_type='smallbody', + epochs=2451544.5) + .ephemerides(get_raw_response=True)) assert len(res) >= 15400 @@ -227,10 +233,13 @@ def test_elements_query_two(self): rtol=1e-3) def test_elements_query_raw(self): - res = jplhorizons.Horizons(id='Ceres', location='500@10', - id_type='smallbody', - epochs=2451544.5).elements( - get_raw_response=True) + # deprecated as of #2418 + with pytest.warns(AstropyDeprecationWarning): + res = (jplhorizons.Horizons(id='Ceres', + location='500@10', + id_type='smallbody', + epochs=2451544.5) + .elements(get_raw_response=True)) assert len(res) >= 6686 @@ -261,10 +270,13 @@ def test_vectors_query(self): res['range_rate']], rtol=1e-3) def test_vectors_query_raw(self): - res = jplhorizons.Horizons(id='Ceres', location='500@10', - id_type='smallbody', - epochs=2451544.5).vectors( - get_raw_response=True) + # deprecated as of #2418 + with pytest.warns(AstropyDeprecationWarning): + res = (jplhorizons.Horizons(id='Ceres', + location='500@10', + id_type='smallbody', + epochs=2451544.5) + .vectors(get_raw_response=True)) assert len(res) >= 6412 diff --git a/docs/jplhorizons/jplhorizons.rst b/docs/jplhorizons/jplhorizons.rst index 51573b3935..aa3f3b998a 100644 --- a/docs/jplhorizons/jplhorizons.rst +++ b/docs/jplhorizons/jplhorizons.rst @@ -189,9 +189,7 @@ limits fragment matching (73P-B would only match 73P-B), respectively. Note that these options should only be used for comets and will crash the query for other object types. Extra precision in the queried properties can be requested using the ``extra_precision`` option. Furthermore, ``get_query_payload=True`` -skips the query and only returns the query payload, whereas -``get_raw_response=True`` returns the raw query response instead of the astropy -table. +skips the query and only returns the query payload. :meth:`~astroquery.jplhorizons.HorizonsClass.ephemerides` queries by default all available quantities from the JPL Horizons servers. This might take a while. If @@ -243,9 +241,8 @@ absolute representation of the time of perihelion passage. For comets, the options ``closest_apparition`` and ``no_fragments`` are available, which select the closest apparition in time and reject fragments, respectively. Note that these options should only be used for comets and will crash the query for other -object types. Also available are ``get_query_payload=True``, which skips the -query and only returns the query payload, and ``get_raw_response=True``, which -returns the raw query response instead of the astropy table. +object types. Also available is ``get_query_payload=True``, which skips the +query and only returns the query payload. Vectors ------- @@ -290,10 +287,9 @@ The following fields are queried: Similar to the other :class:`~astroquery.jplhorizons.HorizonsClass` functions, -optional parameters of :meth:`~astroquery.jplhorizons.HorizonsClass.vectors` are +optional parameters of :meth:`~astroquery.jplhorizons.HorizonsClass.vectors` is ``get_query_payload=True``, which skips the query and only returns the query -payload, and ``get_raw_response=True``, which returns the raw query response -instead of the astropy table. For comets, the options ``closest_apparation`` and +payload. For comets, the options ``closest_apparation`` and ``no_fragments`` are available, which select the closest apparition in time and reject fragments, respectively. Note that these options should only be used for comets and will crash the query for other object types. Options ``aberrations`` From aa466a38514404538a32da6862e1523840942a17 Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Fri, 10 Jun 2022 12:34:03 -0400 Subject: [PATCH 13/17] Up testing coverage with time ranges. --- astroquery/jplhorizons/core.py | 2 +- astroquery/jplhorizons/tests/data/README | 15 +- .../tests/data/ceres_elements_range.txt | 133 +++++ ...elements.txt => ceres_elements_single.txt} | 0 .../tests/data/ceres_ephemerides_range.txt | 511 ++++++++++++++++++ ...rides.txt => ceres_ephemerides_single.txt} | 0 .../tests/data/ceres_vectors_range.txt | 129 +++++ ...s_vectors.txt => ceres_vectors_single.txt} | 0 .../jplhorizons/tests/test_jplhorizons.py | 26 +- 9 files changed, 804 insertions(+), 12 deletions(-) create mode 100644 astroquery/jplhorizons/tests/data/ceres_elements_range.txt rename astroquery/jplhorizons/tests/data/{ceres_elements.txt => ceres_elements_single.txt} (100%) create mode 100644 astroquery/jplhorizons/tests/data/ceres_ephemerides_range.txt rename astroquery/jplhorizons/tests/data/{ceres_ephemerides.txt => ceres_ephemerides_single.txt} (100%) create mode 100644 astroquery/jplhorizons/tests/data/ceres_vectors_range.txt rename astroquery/jplhorizons/tests/data/{ceres_vectors.txt => ceres_vectors_single.txt} (100%) diff --git a/astroquery/jplhorizons/core.py b/astroquery/jplhorizons/core.py index 0f9cc61847..c4a7c96e01 100644 --- a/astroquery/jplhorizons/core.py +++ b/astroquery/jplhorizons/core.py @@ -31,7 +31,7 @@ @async_to_sync class HorizonsClass(BaseQuery): """ - Query the `JPL Horizons` `_ service. + Query the `JPL Horizons `_ service. """ TIMEOUT = conf.timeout diff --git a/astroquery/jplhorizons/tests/data/README b/astroquery/jplhorizons/tests/data/README index 12cf5764f9..c35807cea0 100644 --- a/astroquery/jplhorizons/tests/data/README +++ b/astroquery/jplhorizons/tests/data/README @@ -1,14 +1,23 @@ Generate these files from the following URIs: -ceres_elements.txt +ceres_elements_single.txt https://ssd.jpl.nasa.gov/api/horizons.api?format=text&EPHEM_TYPE=ELEMENTS&MAKE_EPHEM=YES&OUT_UNITS=AU-D&COMMAND=%22Ceres%3B%22&CENTER=%27500%4010%27&CSV_FORMAT=YES&ELEM_LABELS=YES&OBJ_DATA=YES&REF_SYSTEM=ICRF&REF_PLANE=ECLIPTIC&TP_TYPE=ABSOLUTE&TLIST=2451544.5 -ceres_ephemerides.txt +ceres_ephemerides_single.txt https://ssd.jpl.nasa.gov/api/horizons.api?format=text&EPHEM_TYPE=OBSERVER&QUANTITIES=%271%2C2%2C3%2C4%2C5%2C6%2C7%2C8%2C9%2C10%2C11%2C12%2C13%2C14%2C15%2C16%2C17%2C18%2C19%2C20%2C21%2C22%2C23%2C24%2C25%2C26%2C27%2C28%2C29%2C30%2C31%2C32%2C33%2C34%2C35%2C36%2C37%2C38%2C39%2C40%2C41%2C42%2C43%27&COMMAND=%22Ceres%3B%22&SOLAR_ELONG=%220%2C180%22&LHA_CUTOFF=0&CSV_FORMAT=YES&CAL_FORMAT=BOTH&ANG_FORMAT=DEG&APPARENT=AIRLESS&REF_SYSTEM=ICRF&EXTRA_PREC=NO&CENTER=%27500%27&TLIST=2451544.5&SKIP_DAYLT=NO -ceres_vectors.txt +ceres_vectors_single.txt https://ssd.jpl.nasa.gov/api/horizons.api?format=text&EPHEM_TYPE=VECTORS&OUT_UNITS=AU-D&COMMAND=%22Ceres%3B%22&CENTER=%27500%4010%27&CSV_FORMAT=%22YES%22&REF_PLANE=ECLIPTIC&REF_SYSTEM=ICRF&TP_TYPE=ABSOLUTE&VEC_LABELS=YES&VEC_CORR=%22NONE%22&VEC_DELTA_T=NO&OBJ_DATA=YES&TLIST=2451544.5 +ceres_elements_range.txt +https://ssd.jpl.nasa.gov/api/horizons.api?format=text&EPHEM_TYPE=ELEMENTS&MAKE_EPHEM=YES&OUT_UNITS=AU-D&COMMAND=%22Ceres%3B%22&CENTER=%27500%4010%27&CSV_FORMAT=YES&ELEM_LABELS=YES&OBJ_DATA=YES&REF_SYSTEM=ICRF&REF_PLANE=ECLIPTIC&TP_TYPE=ABSOLUTE&START_TIME=2022-06-10&STOP_TIME=2022-07-10&STEP_SIZE=10d + +ceres_ephemerides_range.txt +https://ssd.jpl.nasa.gov/api/horizons.api?format=text&EPHEM_TYPE=OBSERVER&QUANTITIES=%271%2C2%2C3%2C4%2C5%2C6%2C7%2C8%2C9%2C10%2C11%2C12%2C13%2C14%2C15%2C16%2C17%2C18%2C19%2C20%2C21%2C22%2C23%2C24%2C25%2C26%2C27%2C28%2C29%2C30%2C31%2C32%2C33%2C34%2C35%2C36%2C37%2C38%2C39%2C40%2C41%2C42%2C43%27&COMMAND=%22Ceres%3B%22&SOLAR_ELONG=%220%2C180%22&LHA_CUTOFF=0&CSV_FORMAT=YES&CAL_FORMAT=BOTH&ANG_FORMAT=DEG&APPARENT=AIRLESS&REF_SYSTEM=ICRF&EXTRA_PREC=NO&CENTER=%27500%27&SKIP_DAYLT=NO&START_TIME=2022-06-10&STOP_TIME=2022-07-10&STEP_SIZE=10d + +ceres_vectors_range.txt +https://ssd.jpl.nasa.gov/api/horizons.api?format=text&EPHEM_TYPE=VECTORS&OUT_UNITS=AU-D&COMMAND=%22Ceres%3B%22&CENTER=%27500%4010%27&CSV_FORMAT=%22YES%22&REF_PLANE=ECLIPTIC&REF_SYSTEM=ICRF&TP_TYPE=ABSOLUTE&VEC_LABELS=YES&VEC_CORR=%22NONE%22&VEC_DELTA_T=NO&OBJ_DATA=YES&START_TIME=2022-06-10&STOP_TIME=2022-07-10&STEP_SIZE=10d + no_H.txt https://ssd.jpl.nasa.gov/api/horizons.api?format=text&EPHEM_TYPE=OBSERVER&QUANTITIES=%271%2C2%2C3%2C4%2C5%2C6%2C7%2C8%2C9%2C10%2C11%2C12%2C13%2C14%2C15%2C16%2C17%2C18%2C19%2C20%2C21%2C22%2C23%2C24%2C25%2C26%2C27%2C28%2C29%2C30%2C31%2C32%2C33%2C34%2C35%2C36%2C37%2C38%2C39%2C40%2C41%2C42%2C43%27&COMMAND=%221935+UZ%3B%22&SOLAR_ELONG=%220%2C180%22&LHA_CUTOFF=0&CSV_FORMAT=YES&CAL_FORMAT=BOTH&ANG_FORMAT=DEG&APPARENT=AIRLESS&REF_SYSTEM=ICRF&EXTRA_PREC=NO&CENTER=%27500%40399%27&TLIST=2459480.5004416634&SKIP_DAYLT=NO diff --git a/astroquery/jplhorizons/tests/data/ceres_elements_range.txt b/astroquery/jplhorizons/tests/data/ceres_elements_range.txt new file mode 100644 index 0000000000..f134f25616 --- /dev/null +++ b/astroquery/jplhorizons/tests/data/ceres_elements_range.txt @@ -0,0 +1,133 @@ +API VERSION: 1.1 +API SOURCE: NASA/JPL Horizons API + +******************************************************************************* +JPL/HORIZONS 1 Ceres (A801 AA) 2022-Jun-10 08:56:42 +Rec #: 1 (+COV) Soln.date: 2021-Apr-13_11:04:44 # obs: 1075 (1995-2021) + +IAU76/J2000 helio. ecliptic osc. elements (au, days, deg., period=Julian yrs): + + EPOCH= 2458849.5 ! 2020-Jan-01.00 (TDB) Residual RMS= .24563 + EC= .07687465013145245 QR= 2.556401146697176 TP= 2458240.1791309435 + OM= 80.3011901917491 W= 73.80896808746482 IN= 10.59127767086216 + A= 2.769289292143484 MA= 130.3159688200986 ADIST= 2.982177437589792 + PER= 4.60851 N= .213870839 ANGMOM= .028541613 + DAN= 2.69515 DDN= 2.81323 L= 153.8445988 + B= 10.1666388 MOID= 1.59231997 TP= 2018-May-01.6791309435 + +Asteroid physical parameters (km, seconds, rotational period in hours): + GM= 62.6284 RAD= 469.7 ROTPER= 9.07417 + H= 3.33 G= .120 B-V= .713 + ALBEDO= .090 STYP= C + +ASTEROID comments: +1: soln ref.= JPL#48, OCC=0 radar(60 delay, 0 Dop.) +2: source=ORB +******************************************************************************* + + +******************************************************************************* +Ephemeris / API_USER Fri Jun 10 08:56:43 2022 Pasadena, USA / Horizons +******************************************************************************* +Target body name: 1 Ceres (A801 AA) {source: JPL#48} +Center body name: Sun (10) {source: DE441} +Center-site name: BODY CENTER +******************************************************************************* +Start time : A.D. 2022-Jun-10 00:00:00.0000 TDB +Stop time : A.D. 2022-Jul-10 00:00:00.0000 TDB +Step-size : 14400 minutes +******************************************************************************* +Center geodetic : 0.00000000,0.00000000,0.0000000 {E-lon(deg),Lat(deg),Alt(km)} +Center cylindric: 0.00000000,0.00000000,0.0000000 {E-lon(deg),Dxy(km),Dz(km)} +Center radii : 696000.0 x 696000.0 x 696000.0 k{Equator, meridian, pole} +Keplerian GM : 2.9591220828411951E-04 au^3/d^2 +Small perturbers: Yes {source: SB441-N16} +Output units : AU-D, deg, Julian Day Number (Tp) +Output type : GEOMETRIC osculating elements +Output format : 10 +Reference frame : Ecliptic of J2000.0 +******************************************************************************* +Initial IAU76/J2000 heliocentric ecliptic osculating elements (au, days, deg.): + EPOCH= 2458849.5 ! 2020-Jan-01.00 (TDB) Residual RMS= .24563 + EC= .07687465013145245 QR= 2.556401146697176 TP= 2458240.1791309435 + OM= 80.3011901917491 W= 73.80896808746482 IN= 10.59127767086216 + Equivalent ICRF heliocentric cartesian coordinates (au, au/d): + X= 1.007608869613381E+00 Y=-2.390064275223502E+00 Z=-1.332124522752402E+00 + VX= 9.201724467227128E-03 VY= 3.370381135398406E-03 VZ=-2.850337057661093E-04 +Asteroid physical parameters (km, seconds, rotational period in hours): + GM= 62.6284 RAD= 469.7 ROTPER= 9.07417 + H= 3.33 G= .120 B-V= .713 + ALBEDO= .090 STYP= C +******************************************************************************* + JDTDB, Calendar Date (TDB), EC, QR, IN, OM, W, Tp, N, MA, TA, A, AD, PR, +************************************************************************************************************************************************************************************************************************************************************************************************************************************************** +$$SOE +2459740.500000000, A.D. 2022-Jun-10 00:00:00.0000, 7.857509431507990E-02, 2.549012173144731E+00, 1.058712597794349E+01, 8.026775296710701E+01, 7.356968535036279E+01, 2.459920525171203E+06, 2.142082187859277E-01, 3.214371287399738E+02, 3.153704983697174E+02, 2.766380805878023E+00, 2.983749438611315E+00, 1.680607784520964E+03, +2459750.500000000, A.D. 2022-Jun-20 00:00:00.0000, 7.858376292112841E-02, 2.549023692352033E+00, 1.058706771204556E+01, 8.026756872640345E+01, 7.356246662775156E+01, 2.459920495273060E+06, 2.142037439326482E-01, 3.235863760597782E+02, 3.177937805117618E+02, 2.766419333387372E+00, 2.983814974422712E+00, 1.680642893493002E+03, +2459760.500000000, A.D. 2022-Jun-30 00:00:00.0000, 7.859345715357316E-02, 2.549034456775973E+00, 1.058700882991960E+01, 8.026736396328340E+01, 7.355524826865661E+01, 2.459920465228080E+06, 2.141990066488527E-01, 3.257356070468648E+02, 3.202273031907437E+02, 2.766460121827925E+00, 2.983885786879876E+00, 1.680680063050742E+03, +2459770.500000000, A.D. 2022-Jul-10 00:00:00.0000, 7.860414361068520E-02, 2.549043873533912E+00, 1.058695038677373E+01, 8.026714122872585E+01, 7.354835812167732E+01, 2.459920436348567E+06, 2.141940933158067E-01, 3.278845197635605E+02, 3.226703112488304E+02, 2.766502427656752E+00, 2.983960981779593E+00, 1.680718615658639E+03, +$$EOE +************************************************************************************************************************************************************************************************************************************************************************************************************************************************** + +TIME + + Barycentric Dynamical Time ("TDB" or T_eph) output was requested. This +continuous relativistic coordinate time is equivalent to the relativistic +proper time of a clock at rest in a reference frame comoving with the +solar system barycenter but outside the system's gravity well. It is the +independent variable in the solar system relativistic equations of motion. + + TDB runs at a uniform rate of one SI second per second and is independent +of irregularities in Earth's rotation. + + Calendar dates prior to 1582-Oct-15 are in the Julian calendar system. +Later calendar dates are in the Gregorian system. + +REFERENCE FRAME AND COORDINATES + + Ecliptic at the standard reference epoch + + Reference epoch: J2000.0 + X-Y plane: adopted Earth orbital plane at the reference epoch + Note: IAU76 obliquity of 84381.448 arcseconds wrt ICRF X-Y plane + X-axis : ICRF + Z-axis : perpendicular to the X-Y plane in the directional (+ or -) sense + of Earth's north pole at the reference epoch. + + Symbol meaning [1 au= 149597870.700 km, 1 day= 86400.0 s]: + + JDTDB Julian Day Number, Barycentric Dynamical Time + EC Eccentricity, e + QR Periapsis distance, q (au) + IN Inclination w.r.t X-Y plane, i (degrees) + OM Longitude of Ascending Node, OMEGA, (degrees) + W Argument of Perifocus, w (degrees) + Tp Time of periapsis (Julian Day Number) + N Mean motion, n (degrees/day) + MA Mean anomaly, M (degrees) + TA True anomaly, nu (degrees) + A Semi-major axis, a (au) + AD Apoapsis distance (au) + PR Sidereal orbit period (day) + +ABERRATIONS AND CORRECTIONS + + Geometric osculating elements have NO corrections or aberrations applied. + +Computations by ... + + Solar System Dynamics Group, Horizons On-Line Ephemeris System + 4800 Oak Grove Drive, Jet Propulsion Laboratory + Pasadena, CA 91109 USA + + General site: https://ssd.jpl.nasa.gov/ + Mailing list: https://ssd.jpl.nasa.gov/email_list.html + System news : https://ssd.jpl.nasa.gov/horizons/news.html + User Guide : https://ssd.jpl.nasa.gov/horizons/manual.html + Connect : browser https://ssd.jpl.nasa.gov/horizons/app.html#/x + API https://ssd-api.jpl.nasa.gov/doc/horizons.html + command-line telnet ssd.jpl.nasa.gov 6775 + e-mail/batch https://ssd.jpl.nasa.gov/ftp/ssd/hrzn_batch.txt + scripts https://ssd.jpl.nasa.gov/ftp/ssd/SCRIPTS + Author : Jon.D.Giorgini@jpl.nasa.gov +******************************************************************************* diff --git a/astroquery/jplhorizons/tests/data/ceres_elements.txt b/astroquery/jplhorizons/tests/data/ceres_elements_single.txt similarity index 100% rename from astroquery/jplhorizons/tests/data/ceres_elements.txt rename to astroquery/jplhorizons/tests/data/ceres_elements_single.txt diff --git a/astroquery/jplhorizons/tests/data/ceres_ephemerides_range.txt b/astroquery/jplhorizons/tests/data/ceres_ephemerides_range.txt new file mode 100644 index 0000000000..fc8d842c45 --- /dev/null +++ b/astroquery/jplhorizons/tests/data/ceres_ephemerides_range.txt @@ -0,0 +1,511 @@ +API VERSION: 1.1 +API SOURCE: NASA/JPL Horizons API + +******************************************************************************* +JPL/HORIZONS 1 Ceres (A801 AA) 2022-Jun-10 08:57:28 +Rec #: 1 (+COV) Soln.date: 2021-Apr-13_11:04:44 # obs: 1075 (1995-2021) + +IAU76/J2000 helio. ecliptic osc. elements (au, days, deg., period=Julian yrs): + + EPOCH= 2458849.5 ! 2020-Jan-01.00 (TDB) Residual RMS= .24563 + EC= .07687465013145245 QR= 2.556401146697176 TP= 2458240.1791309435 + OM= 80.3011901917491 W= 73.80896808746482 IN= 10.59127767086216 + A= 2.769289292143484 MA= 130.3159688200986 ADIST= 2.982177437589792 + PER= 4.60851 N= .213870839 ANGMOM= .028541613 + DAN= 2.69515 DDN= 2.81323 L= 153.8445988 + B= 10.1666388 MOID= 1.59231997 TP= 2018-May-01.6791309435 + +Asteroid physical parameters (km, seconds, rotational period in hours): + GM= 62.6284 RAD= 469.7 ROTPER= 9.07417 + H= 3.33 G= .120 B-V= .713 + ALBEDO= .090 STYP= C + +ASTEROID comments: +1: soln ref.= JPL#48, OCC=0 radar(60 delay, 0 Dop.) +2: source=ORB +******************************************************************************* + + +******************************************************************************* +Ephemeris / API_USER Fri Jun 10 08:57:29 2022 Pasadena, USA / Horizons +******************************************************************************* +Target body name: 1 Ceres (A801 AA) {source: JPL#48} +Center body name: Earth (399) {source: DE441} +Center-site name: GEOCENTRIC +******************************************************************************* +Start time : A.D. 2022-Jun-10 00:00:00.0000 UT +Stop time : A.D. 2022-Jul-10 00:00:00.0000 UT +Step-size : 14400 minutes +******************************************************************************* +Target pole/equ : IAU {West-longitude positive} +Target radii : 482.1 x 482.1 x 445.9 km {Equator, meridian, pole} +Center geodetic : 0.00000000,0.00000000,0.0000000 {E-lon(deg),Lat(deg),Alt(km)} +Center cylindric: 0.00000000,0.00000000,0.0000000 {E-lon(deg),Dxy(km),Dz(km)} +Center pole/equ : ITRF93 {East-longitude positive} +Center radii : 6378.1 x 6378.1 x 6356.8 km {Equator, meridian, pole} +Target primary : Sun +Vis. interferer : MOON (R_eq= 1737.400) km {source: DE441} +Rel. light bend : Sun, EARTH {source: DE441} +Rel. lght bnd GM: 1.3271E+11, 3.9860E+05 km^3/s^2 +Small-body perts: Yes {source: SB441-N16} +Atmos refraction: NO (AIRLESS) +RA format : DEG +Time format : BOTH +EOP file : eop.220608.p220901 +EOP coverage : DATA-BASED 1962-JAN-20 TO 2022-JUN-08. PREDICTS-> 2022-AUG-31 +Units conversion: 1 au= 149597870.700 km, c= 299792.458 km/s, 1 day= 86400.0 s +Table cut-offs 1: Elevation (-90.0deg=NO ),Airmass (>38.000=NO), Daylight (NO ) +Table cut-offs 2: Solar elongation ( 0.0,180.0=NO ),Local Hour Angle( 0.0=NO ) +Table cut-offs 3: RA/DEC angular rate ( 0.0=NO ) +Table format : Comma Separated Values (spreadsheet) +******************************************************************************* +Initial IAU76/J2000 heliocentric ecliptic osculating elements (au, days, deg.): + EPOCH= 2458849.5 ! 2020-Jan-01.00 (TDB) Residual RMS= .24563 + EC= .07687465013145245 QR= 2.556401146697176 TP= 2458240.1791309435 + OM= 80.3011901917491 W= 73.80896808746482 IN= 10.59127767086216 + Equivalent ICRF heliocentric cartesian coordinates (au, au/d): + X= 1.007608869613381E+00 Y=-2.390064275223502E+00 Z=-1.332124522752402E+00 + VX= 9.201724467227128E-03 VY= 3.370381135398406E-03 VZ=-2.850337057661093E-04 +Asteroid physical parameters (km, seconds, rotational period in hours): + GM= 62.6284 RAD= 469.7 ROTPER= 9.07417 + H= 3.33 G= .120 B-V= .713 + ALBEDO= .090 STYP= C +******************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************* + Date__(UT)__HR:MN, Date_________JDUT, , , R.A._(ICRF), DEC_(ICRF), R.A._(a-app), DEC_(a-app), dRA*cosD, d(DEC)/dt, Azi_(a-app), Elev_(a-app), dAZ*cosE, d(ELV)/dt, X_(sat-prim), Y_(sat-prim), SatPANG, L_Ap_Sid_Time, a-mass, mag_ex, APmag, S-brt, Illu%, Def_illu, ang-sep, vis., Ang-diam, ObsSub-LON, ObsSub-LAT, SunSub-LON, SunSub-LAT, SN.ang, SN.dist, NP.ang, NP.dist, hEcl-Lon,hEcl-Lat, r, rdot, delta, deldot, 1-way_down_LT, VmagSn, VmagOb, S-O-T,/r, S-T-O, T-O-M, MN_Illu%, O-P-T, PsAng, PsAMV, PlAng, Cnst, TDB-UT, ObsEcLon, ObsEcLat, N.Pole-RA, N.Pole-DC, GlxLon, GlxLat, L_Ap_SOL_Time, 399_ins_LT, RA_3sigma, DEC_3sigma, SMAA_3sig, SMIA_3sig, Theta, Area_3sig, POS_3sigma, RNG_3sigma, RNGRT_3sig, DOP_S_3sig, DOP_X_3sig, RT_delay_3sig, Tru_Anom, L_Ap_Hour_Ang, phi, PAB-LON, PAB-LAT, +******************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************* +$$SOE + 2022-Jun-10 00:00, 2459740.500000000, , , 101.73343, 26.78554, 102.07267, 26.76211, 64.31742, -1.85528, n.a., n.a., n.a., n.a., 79188.677, 13568.996, 75.189, n.a., n.a., n.a., 8.741, 6.360, 99.46575, 0.0020, 79088.71, *, 0.377968, 262.465211, -4.479302, 254.063163, -4.592377, 265.38, 0.03, 356.3150, -0.174, 108.7886, 5.0999, 2.603715306632, -0.9916566, 3.51731638211972, 7.2339189, 29.25262835, 18.9934330, 46.1647682, 21.9691,/T, 8.3884, 97.1, 74.2811, 149.6389, 85.235, 264.706, -0.10808, Gem, 69.184717, 100.7867811, 3.7751601, 291.42763, 66.76033, 188.305637, 10.941149, n.a., 0.000000, 0.000, 0.000, 0.00008, 0.00002, -85.755, 0.0000000, 0.000, 0.0129, 0.0000000, 0.00, 0.00, 0.000000, 315.3658, n.a., 8.3833, 104.6299, 4.4474, + 2022-Jun-20 00:00, 2459750.500000000, , , 106.56175, 26.59903, 106.89983, 26.56560, 65.04421, -4.03596, n.a., n.a., n.a., n.a., 60579.378, 11283.967, 75.508, n.a., n.a., n.a., 8.672, 6.271, 99.67620, 0.0012, 60835.95, *, 0.374118, 59.491337, -4.009794, 52.975408, -4.632334, 263.32, 0.02, 358.2091, -0.173, 111.1837, 5.4854, 2.598112111260, -0.9484020, 3.55351777391857, 5.3011903, 29.55370614, 19.0321982, 46.9548417, 16.8989,/T, 6.5293, 120.8, 62.3079, 156.5681, 83.185, 266.975, 0.39272, Gem, 69.184450, 105.1084081, 4.0097249, 291.42763, 66.76033, 190.288988, 14.801572, n.a., 0.000000, 0.000, 0.000, 0.00007, 0.00002, -87.815, 0.0000000, 0.000, 0.0113, 0.0000000, 0.00, 0.00, 0.000000, 317.7890, n.a., 6.5242, 107.9883, 4.7532, + 2022-Jun-30 00:00, 2459760.500000000, , , 111.42655, 26.26772, 111.76255, 26.22440, 65.56345, -6.18733, n.a., n.a., n.a., n.a., 42408.400, 10948.714, 72.732, n.a., n.a., n.a., 8.586, 6.172, 99.83310, 0.0006, 43295.38, *, 0.371512, 216.530192, -3.537825, 211.939210, -4.664167, 258.12, 0.02, 0.1262, -0.171, 113.5920, 5.8629, 2.592764176742, -0.9032594, 3.57844492658187, 3.3228409, 29.76101895, 19.0692914, 47.5923849, 12.0265,/T, 4.6879, 1.678, 0.8385, 163.2820, 77.981, 269.238, 0.87466, Gem, 69.184175, 109.4822081, 4.2464186, 291.42763, 66.76033, 192.347837, 18.700029, n.a., 0.000000, 0.000, 0.000, 0.00007, 0.00002, -89.911, 0.0000000, 0.000, 0.0099, 0.0000000, 0.00, 0.00, 0.000000, 320.2225, n.a., 4.6828, 111.3799, 5.0567, + 2022-Jul-10 00:00, 2459770.500000000, , , 116.30339, 25.79505, 116.63659, 25.74219, 65.81537, -8.26018, n.a., n.a., n.a., n.a., 24646.746, 12536.045, 61.268, n.a., n.a., n.a., 8.487, 6.065, 99.93260, 0.0002, 27360.89, *, 0.370121, 13.594372, -3.071989, 10.956180, -4.687710, 244.31, 0.01, 2.0456, -0.171, 116.0133, 6.2315, 2.587682204769, -0.8563013, 3.59188943334117, 1.3394328, 29.87283350, 19.1046252, 48.0186168, 7.6002,/T, 2.9797, 120.9, 80.2316, 169.4168, 64.160, 271.475, 1.32903, Gem, 69.183895, 113.8960191, 4.4869397, 291.42763, 66.76033, 194.497592, 22.621680, n.a., 0.000000, 0.000, 0.000, 0.00007, 0.00002, 87.980, 0.0000000, 0.000, 0.0088, 0.0000000, 0.00, 0.00, 0.000000, 322.6654, n.a., 2.9753, 114.7983, 5.3588, +$$EOE +******************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************* +Column meaning: + +TIME + + Times PRIOR to 1962 are UT1, a mean-solar time closely related to the +prior but now-deprecated GMT. Times AFTER 1962 are in UTC, the current +civil or "wall-clock" time-scale. UTC is kept within 0.9 seconds of UT1 +using integer leap-seconds for 1972 and later years. + + Conversion from the internal Barycentric Dynamical Time (TDB) of solar +system dynamics to the non-uniform civil UT time-scale requested for output +has not been determined for UTC times after the next July or January 1st. +Therefore, the last known leap-second is used as a constant over future +intervals. + + Time tags refer to the UT time-scale conversion from TDB on Earth +regardless of observer location within the solar system, although clock +rates may differ due to the local gravity field and no analog to "UT" +may be defined for that location. + + Any 'b' symbol in the 1st-column denotes a B.C. date. First-column blank +(" ") denotes an A.D. date. Calendar dates prior to 1582-Oct-15 are in the +Julian calendar system. Later calendar dates are in the Gregorian system. + + NOTE: "n.a." in output means quantity "not available" at the print-time. + +STATISTICAL UNCERTAINTIES + + Output includes formal +/- 3 standard-deviation statistical orbit uncertainty +quantities. There is a 99.7% chance the actual value is within given bounds. +These statistical calculations assume observational data errors are random. If +there are systematic biases (such as timing, reduction or star-catalog errors), +results can be optimistic. Because the epoch covariance is mapped using +linearized variational partial derivatives, results can also be optimistic for +times far from the solution epoch, particularly for objects having close +planetary encounters. + + 'R.A._(ICRF), DEC_(ICRF),' = + Astrometric right ascension and declination of the target center with +respect to the observing site (coordinate origin) in the reference frame of +the planetary ephemeris (ICRF). Compensated for down-leg light-time delay +aberration. + + Units: RA in decimal degrees, ddd.fffff{ffff} + DEC in decimal degrees, sdd.fffff{ffff} + + 'R.A._(a-app), DEC_(a-app),' = + Airless apparent right ascension and declination of the target center with +respect to an instantaneous reference frame defined by the Earth equator of-dat +(z-axis) and meridian containing the Earth equinox of-date (x-axis, EOP-correct +IAU76/80). Compensated for down-leg light-time delay, gravitational deflection +of light, stellar aberration, precession & nutation. Note: equinox (RA origin) +is offset -53 mas from the of-date frame defined by the IAU06/00a P & N system. + + Units: RA in decimal degrees, ddd.fffff{ffff} + DEC in decimal degrees sdd.fffff{ffff} + + + 'dRA*cosD, d(DEC)/dt,' = + The angular rate of change in aparent RA and DEC of the target. This is +with respect to the non-inertial IAU76/80 Earth true equator and equinox +of-date reference frame. d(RA)/dt is multiplied by the cosine of declination +to provide a linear rate in the plane-of-sky. Units: ARCSECONDS PER HOUR + + 'Azi_(a-app), Elev_(a-app),' = + Airless apparent azimuth and elevation of target center. Compensated +for light-time, the gravitational deflection of light, stellar aberration, +precession and nutation. Azimuth is measured clockwise from north: + + North(0) -> East(90) -> South(180) -> West(270) -> North (360) + +Elevation angle is with respect to a plane perpendicular to the reference +surface local zenith direction. TOPOCENTRIC ONLY. Units: DEGREES + + 'dAZ*cosE, d(ELV)/dt,' = + The rate of change of target center apparent azimuth and elevation +(airless). d(AZ)/dt is multiplied by the cosine of the elevation angle. +TOPOCENTRIC ONLY. Units: ARCSECOND PER MINUTE + + 'X_(sat-prim), Y_(sat-prim), SatPANG,' = + Satellite apparent differential coordinates in the plane-of-sky with +respect to the primary body along with the satellite position angle. +Differential coordinates are defined in RA as: + + X= ((RA_sat - RA_primary) * cosine(DEC_primary)) + +... and in DEC as: + + Y= (DEC_sat - DEC_primary) + +Non-lunar satellites only. "SatPANG" is the counter-clockwise (CCW) position +angle from the reference-frame of-date north-pole to a line from the primary +center to the satellite center. Units: ARCSECONDS (X & Y), DEGREES (pos, angle) + + 'L_Ap_Sid_Time,' = + Local Apparent Sidereal Time. The angle measured westward in the body +true-equator of-date plane from the meridian containing the body-fixed +observer to the meridian containing the true Earth equinox (defined by +intersection of the true Earth equator of date with the ecliptic of date). +TOPOCENTRIC ONLY. Units: HH.fffffffffff (decimal hours) + + 'a-mass, mag_ex,' = + RELATIVE optical airmass and visual magnitude extinction. Airmass is the +ratio between the absolute optical airmass for the targets' refracted CENTER +point to the absolute optical airmass at zenith. Also output is the estimated +visual magnitude extinction due to the atmosphere, as seen by the observer. +AVAILABLE ONLY FOR TOPOCENTRIC EARTH SITES WHEN THE TARGET IS ABOVE THE +HORIZON. Units: none (airmass) and magnitudes (extinction). + + 'APmag, S-brt,' = + The asteroids' approximate apparent airless visual magnitude and surface +brightness using the standard IAU H-G system magnitude model: + + APmag = H + 5*log10(delta) + 5*log10(r) - 2.5*log10((1-G)*phi_1 + G*phi_2) + + For solar phase angles >90 deg, the error could exceed 1 magnitude. For +phase angles >120 degrees, output values are rounded to the nearest integer to +indicate error could be large and unknown. For Earth-based observers, the +estimated dimming due to atmospheric absorption (extinction) is available as +a separate, requestable quantity. + + Surface brightness is the average airless visual magnitude of a +square-arcsecond of the illuminated portion of the apparent disk. It is +computed only if the target radius is known. + + Units: MAGNITUDES & MAGNITUDES PER SQUARE ARCSECOND + + 'Illu%,' = + Fraction of the target objects' assumed circular disk illuminated by Sun +(phase), as seen by the observer. Units: PERCENT + + 'Def_illu,' = + Defect of illumination. The maximum angular width of the target body's +assumed circular disk diameter NOT illuminated by the Sun. Units: ARCSECONDS + + 'ang-sep, vis.,' = + The angular separation between the center of the target object and the center +of the (remote) primary body it revolves around, as seen by the observer, with +target visibility code. The observer cannot be on the primary body. + + Visibility codes (refers to limb-to-limb): + + /t = Transiting primary body disk /O = Occulted by primary body disk + /p = Partial umbral eclipse /P = Occulted partial umbral eclipse + /u = Total umbral eclipse /U = Occulted total umbral eclipse + /- = Target is the primary body /* = None of above ("free and clear") + + The radius of both primary and target body is taken to be the equatorial +value (maximum, given a triaxial shape). Atmospheric effects and oblateness +aspect are NOT currently considered. Light-time is considered. + + Units: ARCSECONDS and visibility code + + 'Ang-diam,' = + The equatorial angular width of the target body full disk, if it were fully +illuminated and visible to the observer. If the target body diameter is unknown +"n.a." is output. + + Units: ARCSECONDS + + 'ObsSub-LON, ObsSub-LAT,' = + Apparent planetodetic longitude and latitude of the center of the target +disc seen by the OBSERVER at print-time. This is NOT exactly the same as the +"nearest" sub-point for a non-spherical target shape (since the center of +the disc might not be the point closest to the observer), but is generally +very close if not a very irregular body shape. Down-leg light travel-time +from target to observer is taken into account. Latitude is the angle between +the equatorial plane and the line perpendicular to the reference ellipsoid of +the body, so includes body oblateness. The reference ellipsoid is an oblate +spheroid with a single flatness coefficient in which the y-axis body radius +is taken to be the same value as the x-axis radius. Positive longitude is to +the WEST for this target. Cartographic system is given in the header. + Units: DEGREES DEGREES + + 'SunSub-LON, SunSub-LAT,' = + Apparent sub-solar longitude and latitude of the Sun on the target. The +apparent planetodetic longitude and latitude of the center of the target disc +as seen from the Sun, as seen by the observer at print-time. This is NOT +exactly the same as the "sub-solar" (nearest) point for a non-spherical target +shape (since the center of the disc seen from the Sun might not be the closest +point to the Sun), but is very close if not a highly irregular body shape. +Light travel-time from Sun to target and from target to observer is taken into +account. Latitude is the angle between the equatorial plane and the line +perpendicular to the reference ellipsoid of the body. The reference ellipsoid +is an oblate spheroid with a single flatness coefficient in which the y-axis +body radius is taken to be the same value as the x-axis radius. Positive +longitude is to the WEST for this target. Cartographic system is given in the +header. Units: DEGREES DEGREES + + 'SN.ang, SN.dist,' = + Targets' apparent sub-solar point position angle (counter-clockwise with +respect to the direction of the true-of-date reference-frame north-pole) and +its angular distance from the sub-observer point (center of disk) at print +time. A negative distance indicates the sub-solar point is on the hidden +hemisphere. Units: DEGREES and ARCSECONDS + + 'NP.ang, NP.dist,' = + Targets' apparent north-pole position angle (counter-clockwise with respect +to the direction of the true-of-date reference-frame north-pole) and its +angular distance from the sub-observer point (center of disk) at observation +time. A negative distance indicates the planets' north-pole is on the hidden +hemisphere. Units: DEGREES and ARCSECONDS + + 'hEcl-Lon,hEcl-Lat,' = + Geometric heliocentric J2000 ecliptic longitude and latitude of target +center at the instant light leaves it to be observed at print time (print time +minus down-leg light-time). Units: DEGREES + + 'r, rdot,' = + The Sun's apparent range ("r", light-time aberrated) and range-rate ("rdot") +relative to the target center, as seen by the observer. A positive "rdot" means +the target center was moving away from the Sun, negative means moving toward +the Sun. Units: AU and KM/S + + 'delta, deldot,' = + Apparent range ("delta", light-time aberrated) and range-rate ("delta-dot") +of the target center relative to the observer. A positive "deldot" means the +target center is moving away from the observer, negative indicates movement +toward the observer. Units: AU and KM/S + + '1-way_down_LT,' = + 1-way down-leg light-time from target center to observer. The elapsed time +since light (observed at print-time) would have left or reflected off a point +at the center of the target. Units: MINUTES + + 'VmagSn, VmagOb,' = + Magnitude of target centers' velocity with respect to the Sun ("VmagSn") +and the observer ("VmagOb") at the time light left the target center to be +observed (print time minus down-leg light-time). These are absolute values +of the velocity vectors (total speeds) and do NOT indicate direction of motion. +Units: KM/S + + 'S-O-T,/r,' = + Sun-Observer-Target apparent SOLAR ELONGATION ANGLE seen from the observers' +location at print-time. + + The '/r' column provides a code indicating the targets' apparent position +relative to the Sun in the observers' sky, as described below: + + Case A: For an observing location on the surface of a rotating body, that +body rotational sense is considered: + + /T indicates target TRAILS Sun (evening sky: rises and sets AFTER Sun) + /L indicates target LEADS Sun (morning sky: rises and sets BEFORE Sun) + + Case B: For an observing point that does not have a rotational model (such +as a spacecraft), the "leading" and "trailing" condition is defined by the +observers' heliocentric ORBITAL motion: + + * If continuing in the observers' current direction of heliocentric + motion would encounter the targets' apparent longitude first, followed + by the Sun's, the target LEADS the Sun as seen by the observer. + + * If the Sun's apparent longitude would be encountered first, followed + by the targets', the target TRAILS the Sun. + + Two other codes can be output: + /* indicates observer is Sun-centered (undefined) + /? Target is aligned with Sun center (no lead or trail) + + The S-O-T solar elongation angle is numerically the minimum separation +angle of the Sun and target in the sky in any direction. It does NOT indicate +the amount of separation in the leading or trailing directions, which would +be defined along the equator of a spherical coordinate system. + + Units: DEGREES + + 'S-T-O,' = + The Sun-Target-Observer angle; the interior vertex angle at target center +formed by a vector from the target to the apparent center of the Sun (at +reflection time on the target) and the apparent vector from target to the +observer at print-time. Slightly different from true PHASE ANGLE (requestable +separately) at the few arcsecond level in that it includes stellar aberration +on the down-leg from target to observer. Units: DEGREES + + 'T-O-M, MN_Illu%,' = + Target-Observer-Moon LUNAR ELONGATION angle and illuminated percentage. +The apparent lunar elongation angle between target body center and Moon +center, seen from the observing site, along with fraction of the lunar disk +illuminated by the Sun. A negative lunar elongation angle indicates the target +center is behind the Moon. Units: DEGREES & PERCENT + + 'O-P-T,' = + Observer-Primary-Target angle; apparent angle between a target satellite, +its primarys' center and an observer at print time. Interior vertex angle at +the primary. Units: DEGREES + + 'PsAng, PsAMV,' = + The position angles of the extended Sun-to-target radius vector ("PsAng") +and the negative of the targets' heliocentric velocity vector ("PsAMV"), as +seen in the observers' plane-of-sky, measured counter-clockwise (east) from +reference-frame north-pole. Primarily intended for ACTIVE COMETS, "PsAng" +is an indicator of the comets' gas-tail orientation in the sky (being in the +anti-sunward direction) while "PsAMV" is an indicator of dust-tail orientation. +Units: DEGREES + + 'PlAng,' = + Angle between observer and target orbital plane, measured from center +of target at the moment light seen at observation time leaves the target. +Positive values indicate observer is above the objects' orbital plane, in +the direction of reference-frame +z axis. Units: DEGREES + + 'Cnst,' = + Constellation ID; the 3-letter abbreviation for the name of the +constellation containing the target centers' astrometric position, +as defined by IAU (1930) boundary delineation. See documentation +for list of abbreviations. + + 'TDB-UT,' = + Difference between the uniform Barycentric Dynamical time-scale and the +Earth-rotation dependent Universal Time. Prior to 1962, the difference is with +respect to UT1 (TDB-UT1) and the 0.002 second maximum amplitude distinction +between TT and TDB is not maintained. For 1962 and later, the difference is +with respect to UTC (TDB-UTC) and periodic terms less than 1.e-6 second are +ignored. Values beyond the next July or January 1st may change if a leap-second +is later required by the IERS. Values from the present date forward through +the next ~78 days are predictions. Beyond that prediction interval, the last +prediction is taken as a constant for all future dates. Units: SECONDS + + 'ObsEcLon, ObsEcLat,' = + Observer-centered IAU76/80 ecliptic-of-date longitude and latitude of the +target centers' apparent position, with light-time, gravitational deflection of +light, and stellar aberrations. Units: DEGREES + + 'N.Pole-RA, N.Pole-DC,' = + ICRF right ascension and declination of the target body's north-pole +direction at the time light left the body to be observed at print time. +Target pole/rotation model is given in the header. Units: DEGREES + + 'GlxLon, GlxLat,' = + Observer-centered Galactic System II (post WW II) longitude and latitude +of the target centers' apparent position, with light-time, gravitational +deflection of light, and stellar aberrations. Units: DEGREES + + 'L_Ap_SOL_Time,' = + Local Apparent SOLAR Time at observing site. This is the time indicated by +a sundial. TOPOCENTRIC ONLY. Units: HH.fffffffffff (decimal angular hours) + + '399_ins_LT,' = + Instantaneous light-time of the station with respect to Earth center at +print-time. The geometric (or "true") separation of site and Earth center, +divided by the speed of light. Units: MINUTES + + 'RA_3sigma, DEC_3sigma,' = + Uncertainty in Right-Ascension and Declination. Output values are the formal ++/- 3 standard-deviations (sigmas) around nominal position. Units: ARCSECONDS + + 'SMAA_3sig, SMIA_3sig, Theta, Area_3sig,' = + Plane-of-sky (POS) error ellipse data. These quantities summarize the +targets' 3-dimensional 3-standard-deviation formal uncertainty volume projected +into a reference plane perpendicular to the observers' line-of-sight. + + SMAA_3sig = Angular width of the 3-sigma error ellipse semi-major + axis in POS. Units: ARCSECONDS. + + SMIA_3sig = Angular width of the 3-sigma error ellipse semi-minor + axis in POS. Units: ARCSECONDS. + + Theta = Orientation angle of the error ellipse in POS; the + clockwise angle from the direction of increasing RA to + the semi-major axis of the error ellipse, in the + direction of increasing DEC. Units: DEGREES. + + Area_3sig = Area of sky enclosed by the 3-sigma error ellipse. + Units: ARCSECONDS ^ 2. + + 'POS_3sigma,' = + The Root-Sum-of-Squares (RSS) of the 3-standard deviation plane-of-sky error +ellipse major and minor axes. This single pointing uncertainty number gives an +angular distance (a circular radius) from the targets' nominal position in the +sky that encompasses the error-ellipse. Units: ARCSECONDS. + + 'RNG_3sigma, RNGRT_3sig,' = + Range and range rate (radial velocity) formal 3-standard-deviation +uncertainties. Units: KM, KM/S + + 'DOP_S_3sig, DOP_X_3sig, RT_delay_3sig,' = + Doppler radar uncertainties at S-band (2380 MHz) and X-band (8560 MHz) +frequencies, along with the round-trip (total) delay to first-order. +Units: HERTZ and SECONDS + + 'Tru_Anom,' = + Apparent true anomaly angle of the targets' heliocentric orbit position; +the angle in the targets' instantaneous orbit plane from the orbital periapse +direction to the target, measured positively in the direction of motion. +The position of the target is taken to be at the moment light seen by the +observer at print-time would have left the center of the object. That is, +the heliocentric position of the target used to compute the true anomaly is +one down-leg light-time prior to the print-time. Units: DEGREES + + 'L_Ap_Hour_Ang,' = + Local apparent HOUR ANGLE of target at observing site. The angle between the +observers' meridian plane, containing Earth's axis of-date and local zenith +direction, and a great circle passing through Earth's axis-of-date and the +targets' direction, measured westward from the zenith meridian to target +meridian along the equator. Negative values are angular times UNTIL transit. +Positive values are angular times SINCE transit. Exactly 24_hrs/360_degrees. +EARTH TOPOCENTRIC ONLY. Units: sHH.fffffffff (decimal angular hours) + + 'phi, PAB-LON, PAB-LAT,' = + "phi" is the true PHASE ANGLE at the observers' location at print time. +"PAB-LON" and "PAB-LAT" are the J2000 ecliptic longitude and latitude of the +phase angle bisector direction; the outward directed angle bisecting the arc +created by the apparent vector from Sun to target center and the astrometric +vector from observer to target center. For an otherwise uniform ellipsoid, the +time when its long-axis is perpendicular to the PAB direction approximately +corresponds to lightcurve maximum (or maximum brightness) of the body. PAB is +discussed in Harris et al., Icarus 57, 251-258 (1984). + + Units: DEGREES, DEGREES, DEGREES + +Computations by ... + + Solar System Dynamics Group, Horizons On-Line Ephemeris System + 4800 Oak Grove Drive, Jet Propulsion Laboratory + Pasadena, CA 91109 USA + + General site: https://ssd.jpl.nasa.gov/ + Mailing list: https://ssd.jpl.nasa.gov/email_list.html + System news : https://ssd.jpl.nasa.gov/horizons/news.html + User Guide : https://ssd.jpl.nasa.gov/horizons/manual.html + Connect : browser https://ssd.jpl.nasa.gov/horizons/app.html#/x + API https://ssd-api.jpl.nasa.gov/doc/horizons.html + command-line telnet ssd.jpl.nasa.gov 6775 + e-mail/batch https://ssd.jpl.nasa.gov/ftp/ssd/hrzn_batch.txt + scripts https://ssd.jpl.nasa.gov/ftp/ssd/SCRIPTS + Author : Jon.D.Giorgini@jpl.nasa.gov + +******************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************* diff --git a/astroquery/jplhorizons/tests/data/ceres_ephemerides.txt b/astroquery/jplhorizons/tests/data/ceres_ephemerides_single.txt similarity index 100% rename from astroquery/jplhorizons/tests/data/ceres_ephemerides.txt rename to astroquery/jplhorizons/tests/data/ceres_ephemerides_single.txt diff --git a/astroquery/jplhorizons/tests/data/ceres_vectors_range.txt b/astroquery/jplhorizons/tests/data/ceres_vectors_range.txt new file mode 100644 index 0000000000..038fd84a35 --- /dev/null +++ b/astroquery/jplhorizons/tests/data/ceres_vectors_range.txt @@ -0,0 +1,129 @@ +API VERSION: 1.1 +API SOURCE: NASA/JPL Horizons API + +******************************************************************************* +JPL/HORIZONS 1 Ceres (A801 AA) 2022-Jun-10 08:57:46 +Rec #: 1 (+COV) Soln.date: 2021-Apr-13_11:04:44 # obs: 1075 (1995-2021) + +IAU76/J2000 helio. ecliptic osc. elements (au, days, deg., period=Julian yrs): + + EPOCH= 2458849.5 ! 2020-Jan-01.00 (TDB) Residual RMS= .24563 + EC= .07687465013145245 QR= 2.556401146697176 TP= 2458240.1791309435 + OM= 80.3011901917491 W= 73.80896808746482 IN= 10.59127767086216 + A= 2.769289292143484 MA= 130.3159688200986 ADIST= 2.982177437589792 + PER= 4.60851 N= .213870839 ANGMOM= .028541613 + DAN= 2.69515 DDN= 2.81323 L= 153.8445988 + B= 10.1666388 MOID= 1.59231997 TP= 2018-May-01.6791309435 + +Asteroid physical parameters (km, seconds, rotational period in hours): + GM= 62.6284 RAD= 469.7 ROTPER= 9.07417 + H= 3.33 G= .120 B-V= .713 + ALBEDO= .090 STYP= C + +ASTEROID comments: +1: soln ref.= JPL#48, OCC=0 radar(60 delay, 0 Dop.) +2: source=ORB +******************************************************************************* + + +******************************************************************************* +Ephemeris / API_USER Fri Jun 10 08:57:46 2022 Pasadena, USA / Horizons +******************************************************************************* +Target body name: 1 Ceres (A801 AA) {source: JPL#48} +Center body name: Sun (10) {source: DE441} +Center-site name: BODY CENTER +******************************************************************************* +Start time : A.D. 2022-Jun-10 00:00:00.0000 TDB +Stop time : A.D. 2022-Jul-10 00:00:00.0000 TDB +Step-size : 14400 minutes +******************************************************************************* +Center geodetic : 0.00000000,0.00000000,0.0000000 {E-lon(deg),Lat(deg),Alt(km)} +Center cylindric: 0.00000000,0.00000000,0.0000000 {E-lon(deg),Dxy(km),Dz(km)} +Center radii : 696000.0 x 696000.0 x 696000.0 k{Equator, meridian, pole} +Small perturbers: Yes {source: SB441-N16} +Output units : AU-D +Output type : GEOMETRIC cartesian states +Output format : 3 (position, velocity, LT, range, range-rate) +Reference frame : Ecliptic of J2000.0 +******************************************************************************* +Initial IAU76/J2000 heliocentric ecliptic osculating elements (au, days, deg.): + EPOCH= 2458849.5 ! 2020-Jan-01.00 (TDB) Residual RMS= .24563 + EC= .07687465013145245 QR= 2.556401146697176 TP= 2458240.1791309435 + OM= 80.3011901917491 W= 73.80896808746482 IN= 10.59127767086216 + Equivalent ICRF heliocentric cartesian coordinates (au, au/d): + X= 1.007608869613381E+00 Y=-2.390064275223502E+00 Z=-1.332124522752402E+00 + VX= 9.201724467227128E-03 VY= 3.370381135398406E-03 VZ=-2.850337057661093E-04 +Asteroid physical parameters (km, seconds, rotational period in hours): + GM= 62.6284 RAD= 469.7 ROTPER= 9.07417 + H= 3.33 G= .120 B-V= .713 + ALBEDO= .090 STYP= C +******************************************************************************* + JDTDB, Calendar Date (TDB), X, Y, Z, VX, VY, VZ, LT, RG, RR, +************************************************************************************************************************************************************************************************************************************************************************** +$$SOE +2459740.500000000, A.D. 2022-Jun-10 00:00:00.0000, -8.354726583796999E-01, 2.455132459520164E+00, 2.314862198331841E-01, -1.000026022185188E-02, -4.171663864644086E-03, 1.710462301123233E-03, 1.503774163127625E-02, 2.603704250997457E+00, -5.726821390832905E-04, +2459750.500000000, A.D. 2022-Jun-20 00:00:00.0000, -9.347458493663700E-01, 2.411365344494129E+00, 2.483916160514805E-01, -9.851435289847136E-03, -4.580973827631285E-03, 1.670099559230883E-03, 1.500538241577036E-02, 2.598101426515064E+00, -5.476978463936174E-04, +2459760.500000000, A.D. 2022-Jun-30 00:00:00.0000, -1.032442649066608E+00, 2.363530154574458E+00, 2.648779352961165E-01, -9.684997432621705E-03, -4.985132136836112E-03, 1.626654404453855E-03, 1.497449784523915E-02, 2.592753928895136E+00, -5.216233014813530E-04, +2459770.500000000, A.D. 2022-Jul-10 00:00:00.0000, -1.128387470845915E+00, 2.311682815778683E+00, 2.809145935195726E-01, -9.501062945928338E-03, -5.383255974656968E-03, 1.580176376657430E-03, 1.494514969917747E-02, 2.587672454925616E+00, -4.945005055314659E-04, +$$EOE +************************************************************************************************************************************************************************************************************************************************************************** + +TIME + + Barycentric Dynamical Time ("TDB" or T_eph) output was requested. This +continuous relativistic coordinate time is equivalent to the relativistic +proper time of a clock at rest in a reference frame comoving with the +solar system barycenter but outside the system's gravity well. It is the +independent variable in the solar system relativistic equations of motion. + + TDB runs at a uniform rate of one SI second per second and is independent +of irregularities in Earth's rotation. + + Calendar dates prior to 1582-Oct-15 are in the Julian calendar system. +Later calendar dates are in the Gregorian system. + +REFERENCE FRAME AND COORDINATES + + Ecliptic at the standard reference epoch + + Reference epoch: J2000.0 + X-Y plane: adopted Earth orbital plane at the reference epoch + Note: IAU76 obliquity of 84381.448 arcseconds wrt ICRF X-Y plane + X-axis : ICRF + Z-axis : perpendicular to the X-Y plane in the directional (+ or -) sense + of Earth's north pole at the reference epoch. + + Symbol meaning [1 au= 149597870.700 km, 1 day= 86400.0 s]: + + JDTDB Julian Day Number, Barycentric Dynamical Time + X X-component of position vector (au) + Y Y-component of position vector (au) + Z Z-component of position vector (au) + VX X-component of velocity vector (au/day) + VY Y-component of velocity vector (au/day) + VZ Z-component of velocity vector (au/day) + LT One-way down-leg Newtonian light-time (day) + RG Range; distance from coordinate center (au) + RR Range-rate; radial velocity wrt coord. center (au/day) + +ABERRATIONS AND CORRECTIONS + + Geometric state vectors have NO corrections or aberrations applied. + +Computations by ... + + Solar System Dynamics Group, Horizons On-Line Ephemeris System + 4800 Oak Grove Drive, Jet Propulsion Laboratory + Pasadena, CA 91109 USA + + General site: https://ssd.jpl.nasa.gov/ + Mailing list: https://ssd.jpl.nasa.gov/email_list.html + System news : https://ssd.jpl.nasa.gov/horizons/news.html + User Guide : https://ssd.jpl.nasa.gov/horizons/manual.html + Connect : browser https://ssd.jpl.nasa.gov/horizons/app.html#/x + API https://ssd-api.jpl.nasa.gov/doc/horizons.html + command-line telnet ssd.jpl.nasa.gov 6775 + e-mail/batch https://ssd.jpl.nasa.gov/ftp/ssd/hrzn_batch.txt + scripts https://ssd.jpl.nasa.gov/ftp/ssd/SCRIPTS + Author : Jon.D.Giorgini@jpl.nasa.gov +******************************************************************************* diff --git a/astroquery/jplhorizons/tests/data/ceres_vectors.txt b/astroquery/jplhorizons/tests/data/ceres_vectors_single.txt similarity index 100% rename from astroquery/jplhorizons/tests/data/ceres_vectors.txt rename to astroquery/jplhorizons/tests/data/ceres_vectors_single.txt diff --git a/astroquery/jplhorizons/tests/test_jplhorizons.py b/astroquery/jplhorizons/tests/test_jplhorizons.py index af1296e7fd..688dc4f549 100644 --- a/astroquery/jplhorizons/tests/test_jplhorizons.py +++ b/astroquery/jplhorizons/tests/test_jplhorizons.py @@ -1,23 +1,27 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst +from curses.ascii import HT from multiprocessing import Value import pytest import os from collections import OrderedDict from numpy.ma import is_masked +from requests.exceptions import HTTPError from astropy.tests.helper import assert_quantity_allclose from astropy.utils.exceptions import AstropyDeprecationWarning from astroquery.utils.mocks import MockResponse from ...query import AstroQuery -from ...exceptions import TableParseError from ... import jplhorizons # files in data/ for different query types -DATA_FILES = {'ephemerides': 'ceres_ephemerides.txt', - 'elements': 'ceres_elements.txt', - 'vectors': 'ceres_vectors.txt', +DATA_FILES = {'ephemerides-single': 'ceres_ephemerides_single.txt', + 'elements-single': 'ceres_elements_single.txt', + 'vectors-single': 'ceres_vectors_single.txt', + 'ephemerides-range': 'ceres_ephemerides_range.txt', + 'elements-range': 'ceres_elements_range.txt', + 'vectors-range': 'ceres_vectors_range.txt', '"1935 UZ"': 'no_H.txt', '"tlist_error"': 'tlist_error.txt'} @@ -29,13 +33,19 @@ def data_path(filename): # monkeypatch replacement request function def nonremote_request(self, request_type, url, **kwargs): - if kwargs['params']['COMMAND'] == '"Ceres"': - # pick DATA_FILE based on query type + # pick DATA_FILE based on query type and time request query_type = {'OBSERVER': 'ephemerides', 'ELEMENTS': 'elements', 'VECTORS': 'vectors'}[kwargs['params']['EPHEM_TYPE']] + if ('TLIST' in kwargs['params']): + query_type += '-single' + elif ('START_TIME' in kwargs['params'] + and 'STOP_TIME' in kwargs['params'] + and 'STEP_SIZE' in kwargs['params']): + query_type += '-range' + with open(data_path(DATA_FILES[query_type]), 'rb') as f: response = MockResponse(content=f.read(), url=url) else: @@ -231,8 +241,8 @@ def test_no_H(patch_request): def test_id_type_deprecation(): """Test deprecation warnings based on issue 1742. - - https://github.com/astropy/astroquery/pull/2161 + + https://github.com/astropy/astroquery/pull/2161 """ From 628f6731007906c9bb9cb0d6cc6e66062a84d9a8 Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Mon, 13 Jun 2022 09:04:07 -0400 Subject: [PATCH 14/17] Remove parentheses. --- astroquery/jplhorizons/tests/test_jplhorizons.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/astroquery/jplhorizons/tests/test_jplhorizons.py b/astroquery/jplhorizons/tests/test_jplhorizons.py index 688dc4f549..d1d16f1fc7 100644 --- a/astroquery/jplhorizons/tests/test_jplhorizons.py +++ b/astroquery/jplhorizons/tests/test_jplhorizons.py @@ -39,7 +39,7 @@ def nonremote_request(self, request_type, url, **kwargs): 'ELEMENTS': 'elements', 'VECTORS': 'vectors'}[kwargs['params']['EPHEM_TYPE']] - if ('TLIST' in kwargs['params']): + if 'TLIST' in kwargs['params']: query_type += '-single' elif ('START_TIME' in kwargs['params'] and 'STOP_TIME' in kwargs['params'] From 96e0bc491bc4b01b6bb27c88e2248748e3a0f105 Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Mon, 13 Jun 2022 09:41:58 -0400 Subject: [PATCH 15/17] Deprecate raw_response property. --- astroquery/jplhorizons/core.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/astroquery/jplhorizons/core.py b/astroquery/jplhorizons/core.py index c4a7c96e01..9ad83dacb1 100644 --- a/astroquery/jplhorizons/core.py +++ b/astroquery/jplhorizons/core.py @@ -14,7 +14,7 @@ from astropy.io import ascii from astropy.time import Time from astropy.utils.exceptions import AstropyDeprecationWarning -from astropy.utils.decorators import deprecated_renamed_argument +from astropy.utils.decorators import deprecated_renamed_argument, deprecated_attribute # 3. local imports - use relative imports # commonly required local imports shown below as example @@ -36,6 +36,12 @@ class HorizonsClass(BaseQuery): TIMEOUT = conf.timeout + raw_response = deprecated_attribute( + 'raw_response', '0.4.7', + alternative=("an `_async` method (e.g., `ephemerides_async`) to " + "return a response object, and access the content with " + "`response.text`")) + def __init__(self, id=None, location=None, epochs=None, id_type=None): """ @@ -137,7 +143,7 @@ def __init__(self, id=None, location=None, epochs=None, self.query_type = None # ['ephemerides', 'elements', 'vectors'] self.uri = None # will contain query URL - self.raw_response = None # will contain raw response from server + self._raw_response = None # will contain raw response from server def __str__(self): """ @@ -1148,13 +1154,13 @@ def _parse_result(self, response, verbose=None): pass raise - self.raw_response = response.text + self._raw_response = response.text # return raw response, if desired if self.return_raw: # reset return_raw flag self.return_raw = False - return self.raw_response + return self._raw_response # split response by line break src = response.text.split('\n') @@ -1264,7 +1270,7 @@ def _parse_result(self, response, verbose=None): else: raise ValueError(('Query failed without known error message; ' 'received the following response:\n' - '{}').format(self.raw_response)) + '{}').format(response.text)) # strip whitespaces from column labels headerline = [h.strip() for h in headerline] From 6e53bba62b6e220b8d605e635628f166a46fa8cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Mon, 13 Jun 2022 10:17:06 -0700 Subject: [PATCH 16/17] Cleanup to make tests pass --- astroquery/jplhorizons/tests/test_jplhorizons.py | 3 --- docs/jplhorizons/jplhorizons.rst | 6 +++--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/astroquery/jplhorizons/tests/test_jplhorizons.py b/astroquery/jplhorizons/tests/test_jplhorizons.py index d1d16f1fc7..956fd3d0bf 100644 --- a/astroquery/jplhorizons/tests/test_jplhorizons.py +++ b/astroquery/jplhorizons/tests/test_jplhorizons.py @@ -1,13 +1,10 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst -from curses.ascii import HT -from multiprocessing import Value import pytest import os from collections import OrderedDict from numpy.ma import is_masked -from requests.exceptions import HTTPError from astropy.tests.helper import assert_quantity_allclose from astropy.utils.exceptions import AstropyDeprecationWarning diff --git a/docs/jplhorizons/jplhorizons.rst b/docs/jplhorizons/jplhorizons.rst index aa3f3b998a..46834a95aa 100644 --- a/docs/jplhorizons/jplhorizons.rst +++ b/docs/jplhorizons/jplhorizons.rst @@ -115,9 +115,9 @@ respective id number or record number as ``id`` and use ``id_type=None``: Record # Epoch-yr Primary Desig >MATCH NAME< -------- -------- ------------- ------------------------- 9134 4822 P-L Encke - 90000034 1786 2P Encke - 90000035 1796 2P Encke - 90000036 1805 2P Encke + 90000031 1786 2P Encke + 90000032 1796 2P Encke + 90000033 1805 2P Encke ... ... ... ... >>> print(Horizons(id='90000034', id_type=None).ephemerides()) # doctest: +IGNORE_OUTPUT targetname datetime_str datetime_jd ... RA_3sigma DEC_3sigma From d699f4ab408573b6969dce3988a4e9c91b9954db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Mon, 13 Jun 2022 12:03:15 -0700 Subject: [PATCH 17/17] Fixing sphinx build --- astroquery/jplhorizons/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/astroquery/jplhorizons/core.py b/astroquery/jplhorizons/core.py index 9ad83dacb1..47b2dfcde3 100644 --- a/astroquery/jplhorizons/core.py +++ b/astroquery/jplhorizons/core.py @@ -38,9 +38,9 @@ class HorizonsClass(BaseQuery): raw_response = deprecated_attribute( 'raw_response', '0.4.7', - alternative=("an `_async` method (e.g., `ephemerides_async`) to " + alternative=("an ``_async`` method (e.g., ``ephemerides_async``) to " "return a response object, and access the content with " - "`response.text`")) + "``response.text``")) def __init__(self, id=None, location=None, epochs=None, id_type=None):