Skip to content

Commit

Permalink
Remove get_raw_response optional parameters.
Browse files Browse the repository at this point in the history
This functionality is already available with the *_async() methods.
  • Loading branch information
mkelley committed May 25, 2022
1 parent 22f7e4d commit 0dbb4e5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 66 deletions.
30 changes: 3 additions & 27 deletions astroquery/jplhorizons/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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.
Expand Down Expand Up @@ -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
-------
Expand Down Expand Up @@ -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)
Expand All @@ -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,):
"""
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
23 changes: 0 additions & 23 deletions astroquery/jplhorizons/tests/test_jplhorizons_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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
Expand All @@ -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',
Expand Down
28 changes: 12 additions & 16 deletions docs/jplhorizons/jplhorizons.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
-------
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0dbb4e5

Please sign in to comment.