Skip to content

Commit 2ced5b3

Browse files
ManonMarchandbsipocz
authored andcommitted
feat: rename spacesys into coordinate_system
note that this change is only user-facing, the upstream name is spacesys
1 parent 2312a31 commit 2ced5b3

File tree

5 files changed

+51
-51
lines changed

5 files changed

+51
-51
lines changed

CHANGES.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ mocserver
4141
- Add ``casesensitive`` parameter in the queries (previously, this was hardcoded
4242
to ``True``) [#3139]
4343

44-
- Add ``spacesys`` parameter to the queries to allow to filter on the different bodies
45-
or frames. The list of available space systems can be printed with the new method
46-
``MOCServer.list_spacesys`` [#3139]
44+
- Add ``coordinate_system`` parameter to the queries to allow to filter on the different
45+
bodies or frames. The list of available space systems can be printed with the new
46+
method ``MOCServer.list_coordinates_systems`` [#3139]
4747

4848
- Add ``query_hips`` method, which is convenient to filter only Hierarchical progressive
4949
surveys [#3139]

astroquery/mocserver/core.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def query_region(
4949
fields=None,
5050
max_rec=None,
5151
casesensitive=False,
52-
spacesys=None,
52+
coordinate_system=None,
5353
get_query_payload=False,
5454
verbose=False,
5555
cache=True,
@@ -74,11 +74,11 @@ def query_region(
7474
fields : [str], optional
7575
Specifies which columns to retrieve. Defaults to a pre-defined subset of
7676
fields. The complete list of fields can be obtained with `list_fields`.
77-
spacesys: str, optional
77+
coordinate_system : str, optional
7878
This is the space system on which the coordinates are expressed. Can take
7979
the values ``sky``, ``mars``, ``moon``... The extended list can
80-
be printed with `list_spacesys`. Default is None, meaning that the results
81-
will have mixed frames.
80+
be printed with `~astroquery.mocserver.MOCServer.list_coordinate_systems`.
81+
Default is None, meaning that the results will have mixed frames.
8282
intersect : str, optional
8383
This parameter can take three different values:
8484
@@ -122,7 +122,7 @@ def query_region(
122122
fields=fields,
123123
max_rec=max_rec,
124124
casesensitive=casesensitive,
125-
spacesys=spacesys,
125+
coordinate_system=coordinate_system,
126126
get_query_payload=get_query_payload,
127127
cache=cache,
128128
)
@@ -141,7 +141,7 @@ def query_hips(
141141
fields=None,
142142
max_rec=None,
143143
casesensitive=False,
144-
spacesys=None,
144+
coordinate_system=None,
145145
get_query_payload=False,
146146
verbose=False,
147147
cache=True,
@@ -161,11 +161,11 @@ def query_hips(
161161
fields : [str], optional
162162
Specifies which columns to retrieve. Defaults to a pre-defined subset of
163163
fields. The complete list of fields can be obtained with `list_fields`.
164-
spacesys: str, optional
164+
coordinate_system : str, optional
165165
This is the space system on which the coordinates are expressed. Can take
166166
the values ``sky``, ``mars``, ``moon``... The extended list can
167-
be printed with `list_spacesys`. Default is None, meaning that the results
168-
will have mixed frames.
167+
be printed with `~astroquery.mocserver.MOCServer.list_coordinate_systems`.
168+
Default is None, meaning that the results will have mixed frames.
169169
region : `regions.CircleSkyRegion`, `regions.PolygonSkyRegion`, `mocpy.MOC`,
170170
`mocpy.TimeMOC`, or `mocpy.STMOC`
171171
The region to query the MOCServer with. Note that this can also be a
@@ -217,7 +217,7 @@ def query_hips(
217217
fields=fields,
218218
max_rec=max_rec,
219219
casesensitive=casesensitive,
220-
spacesys=spacesys,
220+
coordinate_system=coordinate_system,
221221
get_query_payload=get_query_payload,
222222
verbose=verbose,
223223
cache=cache,
@@ -235,7 +235,7 @@ def find_datasets(
235235
fields=None,
236236
max_rec=None,
237237
casesensitive=False,
238-
spacesys=None,
238+
coordinate_system=None,
239239
get_query_payload=False,
240240
verbose=False,
241241
cache=True,
@@ -255,11 +255,11 @@ def find_datasets(
255255
fields : [str], optional
256256
Specifies which columns to retrieve. Defaults to a pre-defined subset of
257257
fields. The complete list of fields can be obtained with `list_fields`.
258-
spacesys: str, optional
258+
coordinate_system : str, optional
259259
This is the space system on which the coordinates are expressed. Can take
260260
the values ``sky``, ``mars``, ``moon``... The extended list can
261-
be printed with `list_spacesys`. Default is None, meaning that the results
262-
will have mixed frames.
261+
be printed with `~astroquery.mocserver.MOCServer.list_coordinate_systems`.
262+
Default is None, meaning that the results will have mixed frames.
263263
region : `regions.CircleSkyRegion`, `regions.PolygonSkyRegion`, `mocpy.MOC`,
264264
`mocpy.TimeMOC`, or `mocpy.STMOC`
265265
The region to query the MOCServer with. Note that this can also be a
@@ -307,7 +307,7 @@ def find_datasets(
307307
fields=fields,
308308
max_rec=max_rec,
309309
casesensitive=casesensitive,
310-
spacesys=spacesys,
310+
coordinate_system=coordinate_system,
311311
get_query_payload=get_query_payload,
312312
verbose=verbose,
313313
cache=cache,
@@ -323,7 +323,7 @@ def query_async(
323323
fields=None,
324324
max_rec=None,
325325
intersect="overlaps",
326-
spacesys=None,
326+
coordinate_system=None,
327327
casesensitive=False,
328328
get_query_payload=False,
329329
cache=True,
@@ -343,11 +343,11 @@ def query_async(
343343
fields : [str], optional
344344
Specifies which columns to retrieve. Defaults to a pre-defined subset of
345345
fields. The complete list of fields can be obtained with `list_fields`.
346-
spacesys: str, optional
346+
coordinate_system : str, optional
347347
This is the space system on which the coordinates are expressed. Can take
348348
the values ``sky``, ``mars``, ``moon``... The extended list can
349-
be printed with `list_spacesys`. Default is None, meaning that the results
350-
will have mixed frames.
349+
be printed with `~astroquery.mocserver.MOCServer.list_coordinate_systems`.
350+
Default is None, meaning that the results will have mixed frames.
351351
region : `regions.CircleSkyRegion`, `regions.PolygonSkyRegion`, `mocpy.MOC`,
352352
`mocpy.TimeMOC`, or `mocpy.STMOC`
353353
The region to query the MOCServer with. Note that this can also be a
@@ -392,7 +392,7 @@ def query_async(
392392
max_rec=max_rec,
393393
region=region,
394394
intersect=intersect,
395-
spacesys=spacesys,
395+
coordinate_system=coordinate_system,
396396
casesensitive=casesensitive,
397397
default_fields=self.DEFAULT_FIELDS,
398398
)
@@ -509,20 +509,20 @@ def list_fields_async(self, cache=True):
509509
params={"get": "example", "fmt": "json"},
510510
)
511511

512-
def list_spacesys(self):
513-
"""Return the list of "spacesys" currently available in the MOC Server.
512+
def list_coordinate_systems(self):
513+
"""Return the list of coordinate systems currently available in the MOC Server.
514514
515515
This list may be enriched later, as new datasets are added into the MOC Server.
516516
517517
Returns
518518
-------
519519
list
520-
The list of spacesys currently available in the MOC Server
520+
The list of coordinate systems currently available in the MOC Server
521521
522522
"""
523523
frames = list(set(self.query_region(meta_data="hips_frame=*",
524524
fields=["ID", "hips_frame"],
525-
spacesys=None)["hips_frame"]))
525+
coordinate_system=None)["hips_frame"]))
526526
# `C` is a special case that corresponds to both equatorial and galactic frames
527527
frames.append("sky")
528528
frames.sort()
@@ -538,7 +538,7 @@ def _args_to_payload(
538538
max_rec=None,
539539
region=None,
540540
intersect="overlaps",
541-
spacesys=None,
541+
coordinate_system=None,
542542
casesensitive=False,
543543
default_fields=None,
544544
):
@@ -556,7 +556,7 @@ def _args_to_payload(
556556
"get": "record",
557557
"fields": _get_fields(fields, default_fields),
558558
"intersect": intersect.replace("encloses", "enclosed"),
559-
"spacesys": "C" if spacesys == "sky" else spacesys,
559+
"spacesys": "C" if coordinate_system == "sky" else coordinate_system,
560560
}
561561

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

astroquery/mocserver/tests/test_mocserver.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -129,18 +129,18 @@ def test_list_fields():
129129
assert "ID" in fields["field_name"]
130130

131131

132-
# -------------
133-
# List spacesys
134-
# -------------
132+
# -----------------------
133+
# List coordinate systems
134+
# -----------------------
135135

136136

137137
@pytest.fixture
138-
def _mock_list_spacesys(monkeypatch):
138+
def _mock_list_coordinate_systems(monkeypatch):
139139
# This list changes upstream. To regenerate it, do:
140140
# >>> from astroquery.mocserver import MOCServer
141141
# >>> hips_frames = MOCServer.query_region(meta_data="hips_frame=*",
142142
# ... fields=["hips_frame"],
143-
# ... spacesys=None, max_rec=100)
143+
# ... coordinate_system=None, max_rec=100)
144144
# >>> hips_frames.remove_column("ID")
145145
# >>> hips_frames.write("hips_frames.vot", format="votable", overwrite=True)
146146
with open(Path(__file__).parent / "data" / "hips_frames.vot", "rb") as f:
@@ -151,10 +151,10 @@ def _mock_list_spacesys(monkeypatch):
151151

152152

153153
@pytest.mark.skipif(not HAS_MOCPY, reason="mocpy is required")
154-
@pytest.mark.usefixtures("_mock_list_spacesys")
155-
def test_list_spacesys():
156-
list_spacesys = MOCServer.list_spacesys()
157-
assert "sky" in list_spacesys and "equatorial" in list_spacesys
154+
@pytest.mark.usefixtures("_mock_list_coordinate_systems")
155+
def test_list_coordinate_systems():
156+
list_coordinate_system = MOCServer.list_coordinate_systems()
157+
assert "sky" in list_coordinate_system and "equatorial" in list_coordinate_system
158158

159159

160160
# ---------------------
@@ -225,9 +225,9 @@ def test_return_moc():
225225
assert payload["order"] == "max"
226226

227227

228-
def test_spacesys():
228+
def test_coordinate_system():
229229
payload = MOCServer.query_region(
230-
spacesys="sky", meta_data="", return_moc=True,
230+
coordinate_system="sky", meta_data="", return_moc=True,
231231
max_norder=5, get_query_payload=True
232232
)
233233
assert payload["spacesys"] == "C"

astroquery/mocserver/tests/test_mocserver_remote.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def test_no_region(self):
8585
assert all(result["moc_sky_fraction"] > 0.5)
8686

8787
def test_query_hips(self):
88-
result = MOCServer.query_hips(spacesys="venus", fields="hips_frame")
88+
result = MOCServer.query_hips(coordinate_system="venus", fields="hips_frame")
8989
assert all(result["hips_frame"] == "venus")
9090

9191
def test_list_fields(self):

docs/mocserver/mocserver.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Performing a query on a cone region
7878

7979
Let's get the datasets for which all the data is comprised in a cone (this is
8080
what the ``enclosed`` option means for intersect). We also restrict our search to
81-
datasets describing the sky (with ``spacesys=sky``).
81+
datasets describing the sky (with ``coordinate_system=sky``).
8282

8383
.. doctest-remote-data::
8484

@@ -88,7 +88,7 @@ datasets describing the sky (with ``spacesys=sky``).
8888
>>> center = coordinates.SkyCoord(10.8, 32.2, unit='deg')
8989
>>> radius = coordinates.Angle(0.5, unit='deg')
9090
>>> cone = CircleSkyRegion(center, radius)
91-
>>> MOCServer.query_region(region=cone, intersect="enclosed", spacesys="sky") # doctest: +IGNORE_OUTPUT
91+
>>> MOCServer.query_region(region=cone, intersect="enclosed", coordinate_system="sky") # doctest: +IGNORE_OUTPUT
9292
<Table length=450>
9393
ID ...
9494
str49 ...
@@ -116,7 +116,7 @@ datasets describing the sky (with ``spacesys=sky``).
116116

117117
You can also use this method with `regions.PolygonSkyRegion`, `mocpy.MOC`, `mocpy.TimeMOC`,
118118
and `mocpy.STMOC`. Not providing the region parameter means that the search is done on
119-
the whole sky (or the whole planet, if we chose a different ``spacesys``).
119+
the whole sky (or the whole planet, if we chose a different ``coordinate_system``).
120120

121121
Querying by meta-data
122122
=====================
@@ -217,7 +217,7 @@ methods. The only difference is that the output will only contain HiPS data.
217217
.. doctest-remote-data::
218218

219219
>>> from astroquery.mocserver import MOCServer
220-
>>> MOCServer.query_hips(spacesys="mars") # doctest: +IGNORE_OUTPUT
220+
>>> MOCServer.query_hips(coordinate_system="mars") # doctest: +IGNORE_OUTPUT
221221
<Table length=25>
222222
ID ...
223223
str35 ...
@@ -361,25 +361,25 @@ object) of the ``GALEXGR6/AIS/FUV`` survey.
361361
Finding data on a specific solar system body
362362
--------------------------------------------
363363

364-
The default value for ``spacesys`` is None. It means that we're looking for data for the
365-
sky and all other possible frames. This parameter can take all the values listed by
366-
`astroquery.mocserver.MOCServerClass.list_spacesys`:
364+
The default value for ``coordinate_system`` is ``None``. It means that we're looking for
365+
data for the sky and all other possible frames. This parameter can take all the values
366+
listed by `astroquery.mocserver.MOCServerClass.list_coordinate_systems`:
367367

368368
.. doctest-remote-data::
369369

370370
>>> from astroquery.mocserver import MOCServer
371-
>>> MOCServer.list_spacesys()
371+
>>> MOCServer.list_coordinate_systems()
372372
['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']
373373

374374
Where the special value ``sky`` means any celestial frame (mainly ``equatorial`` and
375375
``galactic``).
376376

377-
The ``spacesys`` parameter can be used in any of the query methods like so:
377+
The ``coordinate_system`` parameter can be used in any of the query methods like so:
378378

379379
.. doctest-remote-data::
380380

381381
>>> from astroquery.mocserver import MOCServer
382-
>>> MOCServer.query_hips(spacesys="ariel")
382+
>>> MOCServer.query_hips(coordinate_system="ariel")
383383
<Table length=1>
384384
ID obs_title ... dataproduct_type
385385
str19 str13 ... str5

0 commit comments

Comments
 (0)