Skip to content

Commit ba4bec0

Browse files
ManonMarchandbsipocz
authored andcommitted
fix: rename C into sky
this makes this parameter different from the one the server understands, but it's more consistant with the other possible values for spacesys
1 parent d61632f commit ba4bec0

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

astroquery/mocserver/core.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def query_region(
7575
fields. The complete list of fields can be obtained with `list_fields`.
7676
spacesys: str, optional
7777
This is the space system on which the coordinates are expressed. Can take
78-
the values ``C`` (for the sky), ``mars``, ``moon``... The extended list can
78+
the values ``sky``, ``mars``, ``moon``... The extended list can
7979
be printed with `list_spacesys`. Default is None, meaning that the results
8080
will have mixed frames.
8181
intersect : str, optional
@@ -162,7 +162,7 @@ def query_hips(
162162
fields. The complete list of fields can be obtained with `list_fields`.
163163
spacesys: str, optional
164164
This is the space system on which the coordinates are expressed. Can take
165-
the values ``C`` (for the sky), ``mars``, ``moon``... The extended list can
165+
the values ``sky``, ``mars``, ``moon``... The extended list can
166166
be printed with `list_spacesys`. Default is None, meaning that the results
167167
will have mixed frames.
168168
region : `regions.CircleSkyRegion`, `regions.PolygonSkyRegion`, `mocpy.MOC`,
@@ -254,7 +254,7 @@ def find_datasets(
254254
fields. The complete list of fields can be obtained with `list_fields`.
255255
spacesys: str, optional
256256
This is the space system on which the coordinates are expressed. Can take
257-
the values ``C`` (for the sky), ``mars``, ``moon``... The extended list can
257+
the values ``sky``, ``mars``, ``moon``... The extended list can
258258
be printed with `list_spacesys`. Default is None, meaning that the results
259259
will have mixed frames.
260260
region : `regions.CircleSkyRegion`, `regions.PolygonSkyRegion`, `mocpy.MOC`,
@@ -342,7 +342,7 @@ def query_async(
342342
fields. The complete list of fields can be obtained with `list_fields`.
343343
spacesys: str, optional
344344
This is the space system on which the coordinates are expressed. Can take
345-
the values ``C`` (for the sky), ``mars``, ``moon``... The extended list can
345+
the values ``sky``, ``mars``, ``moon``... The extended list can
346346
be printed with `list_spacesys`. Default is None, meaning that the results
347347
will have mixed frames.
348348
region : `regions.CircleSkyRegion`, `regions.PolygonSkyRegion`, `mocpy.MOC`,
@@ -521,7 +521,7 @@ def list_spacesys(self):
521521
fields=["ID", "hips_frame"],
522522
spacesys=None)["hips_frame"]))
523523
# `C` is a special case that corresponds to both equatorial and galactic frames
524-
frames.append("C")
524+
frames.append("sky")
525525
frames.sort()
526526
return frames
527527

@@ -553,7 +553,7 @@ def _args_to_payload(
553553
"get": "record",
554554
"fields": _get_fields(fields, default_fields),
555555
"intersect": intersect.replace("encloses", "enclosed"),
556-
"spacesys": spacesys,
556+
"spacesys": "C" if spacesys == "sky" else spacesys,
557557
}
558558

559559
if region and not isinstance(region, (MOC, STMOC, TimeMOC)):

astroquery/mocserver/tests/test_mocserver.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def _mock_list_spacesys(monkeypatch):
153153
@pytest.mark.usefixtures("_mock_list_spacesys")
154154
def test_list_spacesys():
155155
list_spacesys = MOCServer.list_spacesys()
156-
assert "C" in list_spacesys and "equatorial" in list_spacesys
156+
assert "sky" in list_spacesys and "equatorial" in list_spacesys
157157

158158

159159
# ---------------------
@@ -224,6 +224,14 @@ def test_return_moc():
224224
assert payload["order"] == "max"
225225

226226

227+
def test_spacesys():
228+
payload = MOCServer.query_region(
229+
spacesys="sky", meta_data="", return_moc=True,
230+
max_norder=5, get_query_payload=True
231+
)
232+
assert payload["spacesys"] == "C"
233+
234+
227235
# ----------------
228236
# Helper functions
229237
# ----------------

docs/mocserver/mocserver.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,10 +362,12 @@ sky and all other possible frames. This can take all the values listed by
362362

363363
>>> from astroquery.mocserver import MOCServer
364364
>>> MOCServer.list_spacesys()
365-
['C', 'ariel', 'callisto', 'ceres', 'charon', 'dione', 'earth', 'enceladus', 'equatorial', 'europa', 'galactic', 'ganymede', 'iapetus', 'io', 'jupiter', 'mars', 'mars-pia20284', 'mars-pia24422', 'mars-stimson', 'mercury', 'mimas', 'miranda', 'moon', 'moon-pan1', 'neptune', 'oberon', 'pluto', 'rhea', 'sun', 'tethys', 'titan', 'titania', 'triton', 'umbriel', 'venus']
365+
['ariel', 'callisto', 'ceres', 'charon', 'dione', 'earth', 'enceladus', 'equatorial', 'europa', 'galactic', 'ganymede', 'iapetus', 'io', 'jupiter', 'mars', 'mars-pia20284', 'mars-pia24422', 'mars-stimson', 'mercury', 'mimas', 'miranda', 'moon', 'moon-pan1', 'neptune', 'oberon', 'pluto', 'rhea', 'sky', 'sun', 'tethys', 'titan', 'titania', 'triton', 'umbriel', 'venus']
366366

367-
Where the special value ``C`` means any celestial frame (mainly ``equatorial`` and
368-
``galactic``). This can be used in any of the query methods like so:
367+
Where the special value ``sky`` means any celestial frame (mainly ``equatorial`` and
368+
``galactic``).
369+
370+
The ``spacesys`` can be used in any of the query methods like so:
369371

370372
.. doctest-remote-data::
371373

0 commit comments

Comments
 (0)