From 0dbb4e5f1cf053cfa0d93a7cc19cdbf7eca63f97 Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Tue, 24 May 2022 21:19:31 -0400 Subject: [PATCH] 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