Skip to content

Commit 65f5167

Browse files
emolterbsipocz
authored andcommitted
changes suggested by @bsipocz
1 parent 66c87f2 commit 65f5167

File tree

4 files changed

+31
-24
lines changed

4 files changed

+31
-24
lines changed

astroquery/solarsystem/pds/core.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,12 @@ def __init__(self, url='', timeout=None):
8484
def _url(self):
8585
return self.url or conf.url
8686

87-
@property
88-
def _timeout(self):
89-
return conf.timeout if self.timeout is None else self.timeout
90-
9187
def __str__(self):
9288

9389
return "PDSRingNode instance"
9490

9591
def ephemeris_async(self, planet, *, epoch=None, location=None, neptune_arcmodel=3,
96-
get_query_payload=False, get_raw_response=False, cache=True):
92+
get_query_payload=False, cache=True):
9793
"""
9894
send query to Planetary Ring Node server
9995
@@ -117,6 +113,8 @@ def ephemeris_async(self, planet, *, epoch=None, location=None, neptune_arcmodel
117113
get_query_payload : boolean, optional
118114
When set to `True` the method returns the HTTP request parameters as
119115
a dict, default: False
116+
cache : boolean, optional
117+
When set to `True` the method caches the download, default: True
120118
121119
122120
Returns
@@ -230,7 +228,7 @@ def ephemeris_async(self, planet, *, epoch=None, location=None, neptune_arcmodel
230228

231229
# query and parse
232230
response = self._request(
233-
"GET", self._url, params=request_payload, timeout=self._timeout, cache=cache
231+
"GET", self._url, params=request_payload, timeout=self.timeout, cache=cache
234232
)
235233

236234
return response
@@ -251,7 +249,6 @@ def _parse_result(self, response, verbose=None):
251249
bodytable : `astropy.QTable`
252250
ringtable : `astropy.QTable`
253251
"""
254-
self.last_response = response
255252
try:
256253
self._last_query.remove_cache_file(self.cache_location)
257254
except FileNotFoundError:

astroquery/solarsystem/pds/tests/test_ringnode.py renamed to astroquery/solarsystem/pds/tests/test_pds.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ def test_parse_result(patch_request):
5353

5454
def test_ephemeris_query_Uranus(patch_request):
5555

56-
bodytable, ringtable = pds.RingNode.ephemeris(
56+
pds_inst = pds.RingNode()
57+
pds_inst._last_query = AstroQuery('GET', 'http://dummy')
58+
bodytable, ringtable = pds_inst.ephemeris(
5759
planet="Uranus",
5860
epoch="2022-05-03 00:00",
5961
location=(-120.355 * u.deg, 10.0 * u.deg, 1000 * u.m),
@@ -128,7 +130,9 @@ def test_ephemeris_query_Uranus(patch_request):
128130

129131
def test_ephemeris_query_Pluto(patch_request):
130132

131-
bodytable, ringtable = pds.RingNode.ephemeris(
133+
pds_inst = pds.RingNode()
134+
pds_inst._last_query = AstroQuery('GET', 'http://dummy')
135+
bodytable, ringtable = pds_inst.ephemeris(
132136
planet="Pluto",
133137
epoch="2021-10-07 07:25",
134138
)
@@ -201,7 +205,9 @@ def test_ephemeris_query_Pluto(patch_request):
201205
def test_ephemeris_query_Neptune(patch_request):
202206
'''Verify that the Neptune ring arcs are queried properly'''
203207

204-
bodytable, ringtable = pds.RingNode.ephemeris(
208+
pds_inst = pds.RingNode()
209+
pds_inst._last_query = AstroQuery('GET', 'http://dummy')
210+
bodytable, ringtable = pds_inst.ephemeris(
205211
planet="Neptune",
206212
epoch="2021-10-07 07:25",
207213
neptune_arcmodel=2
@@ -233,7 +239,9 @@ def test_ephemeris_query_Neptune(patch_request):
233239

234240
def test_ephemeris_query_Saturn(patch_request):
235241
'''Check Saturn F ring is queried properly'''
236-
bodytable, ringtable = pds.RingNode.ephemeris(
242+
pds_inst = pds.RingNode()
243+
pds_inst._last_query = AstroQuery('GET', 'http://dummy')
244+
bodytable, ringtable = pds_inst.ephemeris(
237245
planet="Saturn",
238246
epoch="2021-10-07 07:25",
239247
)
@@ -249,7 +257,9 @@ def test_ephemeris_query_Saturn(patch_request):
249257

250258

251259
def test_ephemeris_query_payload():
252-
res = pds.RingNode.ephemeris(
260+
pds_inst = pds.RingNode()
261+
pds_inst._last_query = AstroQuery('GET', 'http://dummy')
262+
res = pds_inst.ephemeris(
253263
planet="Neptune",
254264
epoch="2022-05-03 00:00",
255265
neptune_arcmodel=1,

docs/solarsystem/pds/pds.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ In order to query information for a specific Solar System body, a
1818
``RingNode`` object is instantiated and the :meth:`~astroquery.solarsystem.pds.RingNodeClass.ephemeris` method is called. The following example queries the
1919
ephemerides of the rings and small moons around Uranus as viewed from ALMA:
2020

21-
.. code-block:: python
21+
.. code-block:: python
2222
2323
>>> from astroquery.solarsystem.pds import RingNode
2424
>>> import astropy.units as u
2525
>>> bodytable, ringtable = RingNode.ephemeris(planet='Uranus',
2626
... epoch='2024-05-08 22:39',
27-
... location = (-67.755 * u.deg, -23.029 * u.deg, 5000 * u.m)) # doctest: +REMOTE_DATA
27+
... location = (-67.755 * u.deg, -23.029 * u.deg, 5000 * u.m)) # doctest: +REMOTE_DATA
2828
>>> print(ringtable) # doctest: +REMOTE_DATA
2929
ring pericenter ascending node
3030
deg deg
@@ -42,11 +42,11 @@ ephemerides of the rings and small moons around Uranus as viewed from ALMA:
4242
4343
``planet`` must be one of ['mars', 'jupiter', 'uranus', 'saturn', 'neptune', 'pluto'] (case-insensitive)
4444

45-
.. code-block:: python
45+
.. code-block:: python
4646
4747
>>> bodytable, ringtable = RingNode.ephemeris(planet='Venus',
4848
... epoch='2024-05-08 22:39',
49-
... location = (-67.755 * u.deg, -23.029 * u.deg, 5000 * u.m))
49+
... location = (-67.755 * u.deg, -23.029 * u.deg, 5000 * u.m)) # doctest: +REMOTE_DATA
5050
Traceback (most recent call last):
5151
...
5252
ValueError: illegal value for 'planet' parameter (must be 'Mars', 'Jupiter', 'Saturn', 'Uranus', 'Neptune', or 'Pluto')
@@ -61,24 +61,24 @@ Outputs
6161
---------
6262
``bodytable`` is a `~astropy.table.QTable` containing ephemeris information on the moons in the planetary system. Every column is assigned a unit from `~astropy.units`. We can get a list of all the columns in this table with:
6363

64-
.. code-block:: python
64+
.. code-block:: python
6565
66-
>>> print(bodytable.columns)
66+
>>> print(bodytable.columns) # doctest: +REMOTE_DATA
6767
<TableColumns names=('NAIF ID','Body','RA','Dec','RA (deg)','Dec (deg)','dRA','dDec','sub_obs_lon','sub_obs_lat','sub_sun_lon','sub_sun_lat','phase','distance')>
6868
6969
``ringtable`` is a `~astropy.table.QTable` containing ephemeris information on the individual rings in the planetary system. Every column is assigned a unit from `~astropy.units`. We can get a list of all the columns in this table with:
7070

7171
.. code-block:: python
7272
73-
>>> print(ringtable.columns)
73+
>>> print(ringtable.columns) # doctest: +REMOTE_DATA
7474
<TableColumns names=('ring','pericenter','ascending node')>
7575
7676
Note that the behavior of ``ringtable`` changes depending on the planet you query. For Uranus and Saturn the table columns are as above. For Jupiter, Mars, and Pluto, there are no individual named rings returned by the Ring Node, so ``ringtable`` returns None; ephemeris for the ring systems of these bodies is still contained in ``systemtable`` as usual. For Neptune, the ring table shows the minimum and maximum longitudes (from the ring plane ascending node) of the five ring arcs according to the orbital evolution assumed by ``neptune_arcmodel``, e.g.:
7777

78-
.. code-block:: python
78+
.. code-block:: python
7979
8080
>>> bodytable, ringtable = RingNode.ephemeris(planet='Neptune', epoch='2022-05-24 00:00') # doctest: +REMOTE_DATA
81-
>>> print(ringtable)
81+
>>> print(ringtable) # doctest: +REMOTE_DATA
8282
ring min_angle max_angle
8383
deg deg
8484
---------- --------- ---------
@@ -90,10 +90,10 @@ Note that the behavior of ``ringtable`` changes depending on the planet you quer
9090
9191
System-wide data are available as metadata in both ``bodytable`` and ``ringtable`` (if ``ringtable`` exists), e.g.:
9292

93-
.. code-block:: python
93+
.. code-block:: python
9494
95-
>>> systemtable = bodytable.meta
96-
>>> print(systemtable.keys())
95+
>>> systemtable = bodytable.meta # doctest: +REMOTE_DATA
96+
>>> print(systemtable.keys()) # doctest: +REMOTE_DATA
9797
dict_keys(['sub_sun_lat', 'sub_sun_lat_min', 'sub_sun_lat_max', 'opening_angle', 'phase_angle', 'sub_sun_lon', 'sub_obs_lon', 'd_sun', 'd_obs', 'light_time', 'epoch'])
9898
9999

0 commit comments

Comments
 (0)