From 819ca22a59e65899b006bbc96a36144520afdccb Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Mon, 2 Sep 2024 08:23:59 -0400 Subject: [PATCH 01/16] Remove unused get_raw_response parameter. --- astroquery/mpc/core.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/astroquery/mpc/core.py b/astroquery/mpc/core.py index a41a83324c..860e8ba49c 100644 --- a/astroquery/mpc/core.py +++ b/astroquery/mpc/core.py @@ -344,8 +344,7 @@ def get_ephemeris_async(self, target, *, location='500', start=None, step='1d', proper_motion='total', proper_motion_unit='arcsec/h', suppress_daytime=False, suppress_set=False, perturbed=True, unc_links=False, - get_query_payload=False, - get_raw_response=False, cache=False): + get_query_payload=False, cache=False): r""" Object ephemerides from the Minor Planet Ephemeris Service. @@ -436,10 +435,6 @@ def get_ephemeris_async(self, target, *, location='500', start=None, step='1d', Return the HTTP request parameters as a dictionary (default: ``False``). - get_raw_response : bool, optional - Return raw data without parsing into a table (default: - ``False``). - cache : bool Defaults to False. If set overrides global caching behavior. See :ref:`caching documentation `. @@ -486,7 +481,7 @@ def get_ephemeris_async(self, target, *, location='500', start=None, step='1d', | P/2003 CP7 | Comet P/2003 CP7 (LINEAR-NEAT) | +------------+-----------------------------------+ - For comets, P/ and C/ are interchangable. The designation + For comets, P/ and C/ are interchangeable. The designation may also be in a packed format: +------------+-----------------------------------+ @@ -606,16 +601,13 @@ def get_ephemeris_async(self, target, *, location='500', start=None, step='1d', return response @class_or_instance - def get_observatory_codes_async(self, *, get_raw_response=False, cache=True): + def get_observatory_codes_async(self, *, cache=True): """ Table of observatory codes from the IAU Minor Planet Center. Parameters ---------- - get_raw_response : bool, optional - Return raw data without parsing into a table (default: - `False`). cache : bool Defaults to True. If set overrides global caching behavior. From f7a37379bfb5ff38d96575f79982019426a81120 Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Mon, 2 Sep 2024 08:25:40 -0400 Subject: [PATCH 02/16] Remove unused comettype parameter. --- astroquery/mpc/core.py | 1 - 1 file changed, 1 deletion(-) diff --git a/astroquery/mpc/core.py b/astroquery/mpc/core.py index 860e8ba49c..902f28bcbd 100644 --- a/astroquery/mpc/core.py +++ b/astroquery/mpc/core.py @@ -765,7 +765,6 @@ def _args_to_ephemeris_payload(self, **kwargs): @class_or_instance def get_observations_async(self, targetid, *, id_type=None, - comettype=None, get_mpcformat=False, get_raw_response=False, get_query_payload=False, From 906917c1da01c2124072250c05787f2edae1642e Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Mon, 2 Sep 2024 08:27:58 -0400 Subject: [PATCH 03/16] Rename undocumented private method. --- astroquery/mpc/core.py | 6 +++--- astroquery/mpc/tests/test_mpc.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/astroquery/mpc/core.py b/astroquery/mpc/core.py index 902f28bcbd..04e3d21fff 100644 --- a/astroquery/mpc/core.py +++ b/astroquery/mpc/core.py @@ -186,7 +186,7 @@ def query_object_async(self, target_type, *, get_query_payload=False, **kwargs): """ - self.get_mpc_object_endpoint(target_type) + self._get_mpc_object_endpoint(target_type) kwargs['limit'] = 1 return self.query_objects_async(target_type, get_query_payload=get_query_payload, **kwargs) @@ -315,7 +315,7 @@ def query_objects_async(self, target_type, *, get_query_payload=False, **kwargs) Limit the number of results to the given value """ - mpc_endpoint = self.get_mpc_object_endpoint(target_type) + mpc_endpoint = self._get_mpc_object_endpoint(target_type) if (target_type == 'comet'): kwargs['order_by_desc'] = "epoch" @@ -329,7 +329,7 @@ def query_objects_async(self, target_type, *, get_query_payload=False, **kwargs) auth = (self.MPC_USERNAME, self.MPC_PASSWORD) return self._request('GET', mpc_endpoint, params=request_args, auth=auth) - def get_mpc_object_endpoint(self, target_type): + def _get_mpc_object_endpoint(self, target_type): mpc_endpoint = self.MPC_URL if target_type == 'asteroid': mpc_endpoint = mpc_endpoint + '/search_orbits' diff --git a/astroquery/mpc/tests/test_mpc.py b/astroquery/mpc/tests/test_mpc.py index 80e69823da..2d740f4e58 100644 --- a/astroquery/mpc/tests/test_mpc.py +++ b/astroquery/mpc/tests/test_mpc.py @@ -156,7 +156,7 @@ def test_args_to_object_payload(): ('asteroid', 'https://minorplanetcenter.net/web_service/search_orbits')]) def test_get_mpc_object_endpoint(type, url): - query_url = mpc.core.MPC.get_mpc_object_endpoint(target_type=type) + query_url = mpc.core.MPC._get_mpc_object_endpoint(target_type=type) assert query_url == url From f1c2791e3378b31a9b3cddfaa75108f62947b3fc Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Mon, 2 Sep 2024 08:29:06 -0400 Subject: [PATCH 04/16] Respsect cache parameter. --- astroquery/mpc/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/astroquery/mpc/core.py b/astroquery/mpc/core.py index 04e3d21fff..ff2a66823b 100644 --- a/astroquery/mpc/core.py +++ b/astroquery/mpc/core.py @@ -596,7 +596,7 @@ def get_ephemeris_async(self, target, *, location='500', start=None, step='1d', return request_args self.query_type = 'ephemeris' - response = self._request('POST', self.MPES_URL, data=request_args) + response = self._request('POST', self.MPES_URL, data=request_args, cache=cache) return response From cd91eae4c6b7bdd43f75bdbe7a96ff936b807076 Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Mon, 2 Sep 2024 08:32:41 -0400 Subject: [PATCH 05/16] Deprecate get_raw_response --- astroquery/mpc/core.py | 8 ++++++++ astroquery/mpc/tests/test_mpc.py | 6 ++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/astroquery/mpc/core.py b/astroquery/mpc/core.py index ff2a66823b..37770d8425 100644 --- a/astroquery/mpc/core.py +++ b/astroquery/mpc/core.py @@ -17,6 +17,7 @@ from . import conf from ..utils import async_to_sync, class_or_instance from ..exceptions import InvalidQueryError, EmptyResponseError +from astropy.utils.decorators import deprecated_renamed_argument __all__ = ['MPCClass'] @@ -763,6 +764,8 @@ def _args_to_ephemeris_payload(self, **kwargs): return request_args @class_or_instance + @deprecated_renamed_argument("get_raw_response", None, since="0.4.9", + alternative="async methods") def get_observations_async(self, targetid, *, id_type=None, get_mpcformat=False, @@ -774,6 +777,11 @@ def get_observations_async(self, targetid, *, from the `Minor Planet Center observations database `_. + .. deprecated:: 0.4.9 + The ``get_raw_response`` keyword argument is deprecated. The + `~MPCClass.get_observationsephemerides_async` method will return a raw response. + + Parameters ---------- targetid : int or str diff --git a/astroquery/mpc/tests/test_mpc.py b/astroquery/mpc/tests/test_mpc.py index 2d740f4e58..92879f0377 100644 --- a/astroquery/mpc/tests/test_mpc.py +++ b/astroquery/mpc/tests/test_mpc.py @@ -415,10 +415,8 @@ def test_get_observations(patch_get): assert result['DEC'].unit == u.deg assert result['epoch'].unit == u.d - result = mpc.core.MPC.get_observations('12893', - get_raw_response=True) - - assert result[0]['designation'] == "1998 QS55" + result = mpc.core.MPC.get_observations_async('12893') + assert result.json()[0]['designation'] == "1998 QS55" result = mpc.core.MPC.get_observations('12893', get_mpcformat=True) From c56a4fe39d4a0f1e796e7f11f400b9460930b028 Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Mon, 2 Sep 2024 09:32:24 -0400 Subject: [PATCH 06/16] Use a comet that does not fail; Use mocked data for uncertainty tests. 2024 AA does not return uncertainty info anymore. Rather than continuously chase objects with uncertianties, just test mocked data. --- astroquery/mpc/tests/test_mpc.py | 13 ++++++++++--- astroquery/mpc/tests/test_mpc_remote.py | 13 +------------ 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/astroquery/mpc/tests/test_mpc.py b/astroquery/mpc/tests/test_mpc.py index 92879f0377..e1bbc46fac 100644 --- a/astroquery/mpc/tests/test_mpc.py +++ b/astroquery/mpc/tests/test_mpc.py @@ -383,9 +383,16 @@ def test_get_ephemeris_perturbed(perturbed, val): @pytest.mark.parametrize('unc_links', (True, False)) def test_get_ephemeris_unc_links(unc_links, patch_post): - tab = mpc.core.MPC.get_ephemeris('1994 XG', unc_links=unc_links) - assert ('Unc. map' in tab.colnames) == unc_links - assert ('Unc. offsets' in tab.colnames) == unc_links + result = mpc.core.MPC.get_ephemeris('1994 XG', unc_links=unc_links) + assert np.all(result['Uncertainty 3sig'].quantity > 0 * u.arcsec) + assert ('Unc. map' in result.colnames) == unc_links + assert ('Unc. offsets' in result.colnames) == unc_links + + +def test_get_ephemeris_Moon_phase_and_Uncertainty(patch_post): + result = mpc.core.MPC.get_ephemeris('1994 XG', location='G37') + assert np.all(result['Moon phase'][0] >= 0) + assert np.all(result['Uncertainty 3sig'].quantity > 0 * u.arcsec) def test_get_observatory_codes(patch_get): diff --git a/astroquery/mpc/tests/test_mpc_remote.py b/astroquery/mpc/tests/test_mpc_remote.py index 4ae66b0cf6..517490504e 100644 --- a/astroquery/mpc/tests/test_mpc_remote.py +++ b/astroquery/mpc/tests/test_mpc_remote.py @@ -72,7 +72,7 @@ def test_get_observatory_codes(self): greenwich = ['000', 0.0, 0.62411, 0.77873, 'Greenwich'] assert all([r == g for r, g in zip(response[0], greenwich)]) - @pytest.mark.parametrize('target', ['(3202)', 'C/2003 A2']) + @pytest.mark.parametrize('target', ['(3202)', 'C/2024 N4']) def test_get_ephemeris_by_target(self, target): # test that query succeeded response = mpc.MPC.get_ephemeris(target) @@ -82,17 +82,6 @@ def test_get_ephemeris_Moon_phase(self): result = mpc.core.MPC.get_ephemeris('2P', location='G37') assert result['Moon phase'][0] >= 0 - def test_get_ephemeris_Uncertainty(self): - # this test requires an object with uncertainties != N/A - result = mpc.core.MPC.get_ephemeris('2024 AA', start='2024-06-15') - assert result['Uncertainty 3sig'].quantity[0] > 0 * u.arcsec - - def test_get_ephemeris_Moon_phase_and_Uncertainty(self): - # this test requires an object with uncertainties != N/A - result = mpc.core.MPC.get_ephemeris('2024 AA', location='G37', start='2024-06-15') - assert result['Moon phase'][0] >= 0 - assert result['Uncertainty 3sig'].quantity[0] > 0 * u.arcsec - def test_get_ephemeris_target_fail(self): # test that query failed with pytest.raises(InvalidQueryError): From 087b0f069cab3d492f471ae5fa3f10287e26cd02 Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Mon, 2 Sep 2024 09:41:17 -0400 Subject: [PATCH 07/16] Remove unused import. --- astroquery/mpc/tests/test_mpc_remote.py | 1 - 1 file changed, 1 deletion(-) diff --git a/astroquery/mpc/tests/test_mpc_remote.py b/astroquery/mpc/tests/test_mpc_remote.py index 517490504e..605e48d1c6 100644 --- a/astroquery/mpc/tests/test_mpc_remote.py +++ b/astroquery/mpc/tests/test_mpc_remote.py @@ -1,7 +1,6 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst import requests import pytest -import astropy.units as u from astroquery.exceptions import InvalidQueryError from astroquery import mpc From 289408c4bec09c9ae7334d1291d8ff78b8056a70 Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Mon, 2 Sep 2024 09:41:24 -0400 Subject: [PATCH 08/16] Remove misplaced code. --- astroquery/mpc/tests/test_mpc.py | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/astroquery/mpc/tests/test_mpc.py b/astroquery/mpc/tests/test_mpc.py index e1bbc46fac..f4f161a916 100644 --- a/astroquery/mpc/tests/test_mpc.py +++ b/astroquery/mpc/tests/test_mpc.py @@ -176,19 +176,6 @@ def test_get_ephemeris_Moon_phase(patch_post): assert result['Moon phase'][0] >= 0 -def test_get_ephemeris_Uncertainty(patch_post): - # this test requires an object with uncertainties != N/A - result = mpc.core.MPC.get_ephemeris('2024 AA') - assert result['Uncertainty 3sig'].quantity[0] > 0 * u.arcsec - - -def test_get_ephemeris_Moon_phase_and_Uncertainty(patch_post): - # this test requires an object with uncertainties != N/A - result = mpc.core.MPC.get_ephemeris('2024 AA', location='G37') - assert result['Moon phase'][0] >= 0 - assert result['Uncertainty 3sig'].quantity[0] > 0 * u.arcsec - - def test_get_ephemeris_by_name_empty(patch_post): with pytest.raises(EmptyResponseError): mpc.core.MPC.get_ephemeris('340P', location='G37') From 783d7e34d9625541c8d31632e205b29ab5728998 Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Mon, 2 Sep 2024 09:43:48 -0400 Subject: [PATCH 09/16] Changelog entry --- CHANGES.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 830f829f55..d29c8f5d55 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -44,7 +44,9 @@ mpc - Parse star catalog information when querying observations database [#2957] - Parse ephemeris with sky motion with three digit precision [#3026] -- Raise EmptyResponseError when empty ephemeris reponse is returned [#3026] +- Raise EmptyResponseError when empty ephemeris response is returned [#3026] +- Deprecate ``get_raw_response`` parameter in query methods. The raw response + may be retrieved from the _async() methods. [#3089] linelists.cdms ^^^^^^^^^^^^^^ From c3ac42a295891da0d81c54892a3d22aa15910ad1 Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Mon, 2 Sep 2024 14:59:21 -0400 Subject: [PATCH 10/16] Fix method name in docstring. --- astroquery/mpc/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/astroquery/mpc/core.py b/astroquery/mpc/core.py index 37770d8425..646b43365e 100644 --- a/astroquery/mpc/core.py +++ b/astroquery/mpc/core.py @@ -779,7 +779,7 @@ def get_observations_async(self, targetid, *, .. deprecated:: 0.4.9 The ``get_raw_response`` keyword argument is deprecated. The - `~MPCClass.get_observationsephemerides_async` method will return a raw response. + `~MPCClass.get_observations_async` method will return a raw response. Parameters From bd1079aebdff52e7588207fdc0544e271340c1ba Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Mon, 2 Sep 2024 18:23:25 -0400 Subject: [PATCH 11/16] Also comment on fixed bug. --- CHANGES.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index d29c8f5d55..14fddfd15b 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -193,6 +193,11 @@ mast - Support for case-insensitive criteria keyword arguments in ``mast.Observations.query_criteria`` and ``mast.Catalogs.query_criteria``. [#3087] +mpc +^^^ + +- Fix bug in ``MPC.get_ephemeris`` that caused the ``cache`` keyword parameter to be ignored. [#3089] + 0.4.7 (2024-03-08) ================== From 88e103e18a50e565b96e3faea525f19f1623dc43 Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Thu, 5 Sep 2024 19:55:49 -0400 Subject: [PATCH 12/16] Revert "Remove misplaced code." This reverts commit 289408c4bec09c9ae7334d1291d8ff78b8056a70. --- astroquery/mpc/tests/test_mpc.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/astroquery/mpc/tests/test_mpc.py b/astroquery/mpc/tests/test_mpc.py index f4f161a916..e1bbc46fac 100644 --- a/astroquery/mpc/tests/test_mpc.py +++ b/astroquery/mpc/tests/test_mpc.py @@ -176,6 +176,19 @@ def test_get_ephemeris_Moon_phase(patch_post): assert result['Moon phase'][0] >= 0 +def test_get_ephemeris_Uncertainty(patch_post): + # this test requires an object with uncertainties != N/A + result = mpc.core.MPC.get_ephemeris('2024 AA') + assert result['Uncertainty 3sig'].quantity[0] > 0 * u.arcsec + + +def test_get_ephemeris_Moon_phase_and_Uncertainty(patch_post): + # this test requires an object with uncertainties != N/A + result = mpc.core.MPC.get_ephemeris('2024 AA', location='G37') + assert result['Moon phase'][0] >= 0 + assert result['Uncertainty 3sig'].quantity[0] > 0 * u.arcsec + + def test_get_ephemeris_by_name_empty(patch_post): with pytest.raises(EmptyResponseError): mpc.core.MPC.get_ephemeris('340P', location='G37') From 258f945d58023ca95f955c67180de0938cbe0ec4 Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Thu, 5 Sep 2024 20:05:47 -0400 Subject: [PATCH 13/16] Remove redundant 1994 XG based tests in favor of 2024 AA. --- .../tests/data/1994XG_ephemeris_500-a-t.html | 61 ------------------- .../tests/data/1994XG_ephemeris_G37-a-t.html | 61 ------------------- astroquery/mpc/tests/test_mpc.py | 12 +--- 3 files changed, 3 insertions(+), 131 deletions(-) delete mode 100644 astroquery/mpc/tests/data/1994XG_ephemeris_500-a-t.html delete mode 100644 astroquery/mpc/tests/data/1994XG_ephemeris_G37-a-t.html diff --git a/astroquery/mpc/tests/data/1994XG_ephemeris_500-a-t.html b/astroquery/mpc/tests/data/1994XG_ephemeris_500-a-t.html deleted file mode 100644 index 7aefb70142..0000000000 --- a/astroquery/mpc/tests/data/1994XG_ephemeris_500-a-t.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - Minor Planet Ephemeris Service: Query Results - - -

Minor Planet Ephemeris Service: Query Results

- Below are the results of your request from the Minor Planet Center's - Minor Planet Ephemeris Service. - Ephemerides are for - the geocenter. -


-

- 1994 XG -

Display all designations for this object / # of variant orbits available = 3 -

Perturbed ephemeris below is based on - 7-opp - unperturbed elements from - MPO 397717. - Last observed on 2016 Dec. 5. -Object has been observed on only one night at the latest opposition. -

Further observations? Useful for orbit improvement (based on orbit uncertainty). Useful for numbering. -

-     J94X00G       [H=18.6]
-Date       UT      R.A. (J2000) Decl.    Delta     r     El.    Ph.   V      Sky Motion       Uncertainty info
-            h m s                                                            "/hr     P.A.    3-sig/" P.A.
-2018 07 30 174614 04 49 53.0 +23 32 08   2.091   1.693   53.3  28.7  22.6   68.29    090.0         2 309.2 / Map / Offsets
-2018 07 31 174614 04 51 51.7 +23 32 04   2.088   1.699   53.8  28.8  22.6   67.74    090.3         2 310.6 / Map / Offsets
-2018 08 01 174614 04 53 49.4 +23 31 53   2.085   1.705   54.3  28.9  22.6   67.20    090.5         2 312.2 / Map / Offsets
-2018 08 02 174614 04 55 46.2 +23 31 35   2.082   1.712   54.8  29.0  22.6   66.65    090.8         2 313.8 / Map / Offsets
-2018 08 03 174614 04 57 42.0 +23 31 10   2.078   1.718   55.3  29.1  22.6   66.11    091.1         2 315.5 / Map / Offsets
-2018 08 04 174614 04 59 36.9 +23 30 37   2.075   1.724   55.9  29.2  22.6   65.55    091.3         2 317.2 / Map / Offsets
-2018 08 05 174614 05 01 30.7 +23 29 57   2.071   1.730   56.4  29.2  22.6   65.00    091.6         2 319.0 / Map / Offsets
-2018 08 06 174614 05 03 23.6 +23 29 10   2.068   1.736   56.9  29.3  22.7   64.45    091.9         2 320.9 / Map / Offsets
-2018 08 07 174614 05 05 15.5 +23 28 17   2.064   1.742   57.5  29.4  22.7   63.89    092.1         2 322.8 / Map / Offsets
-2018 08 08 174614 05 07 06.3 +23 27 16   2.060   1.748   58.0  29.5  22.7   63.32    092.4         2 324.8 / Map / Offsets
-2018 08 09 174614 05 08 56.1 +23 26 09   2.056   1.754   58.5  29.5  22.7   62.75    092.7         2 326.9 / Map / Offsets
-2018 08 10 174614 05 10 44.9 +23 24 55   2.051   1.760   59.1  29.6  22.7   62.18    093.0         2 329.1 / Map / Offsets
-2018 08 11 174614 05 12 32.7 +23 23 34   2.047   1.766   59.6  29.7  22.7   61.60    093.3         2 331.3 / Map / Offsets
-2018 08 12 174614 05 14 19.4 +23 22 07   2.042   1.772   60.2  29.7  22.7   61.02    093.5         2 333.6 / Map / Offsets
-2018 08 13 174614 05 16 05.0 +23 20 33   2.038   1.778   60.7  29.8  22.7   60.44    093.8         2 336.0 / Map / Offsets
-2018 08 14 174614 05 17 49.5 +23 18 53   2.033   1.784   61.3  29.9  22.7   59.85    094.1         2 338.4 / Map / Offsets
-2018 08 15 174614 05 19 33.0 +23 17 07   2.028   1.790   61.9  29.9  22.7   59.26    094.4         1 340.9 / Map / Offsets
-2018 08 16 174614 05 21 15.4 +23 15 15   2.023   1.795   62.5  30.0  22.7   58.66    094.7         1 343.5 / Map / Offsets
-2018 08 17 174614 05 22 56.6 +23 13 16   2.018   1.801   63.0  30.1  22.7   58.07    095.0         1 346.1 / Map / Offsets
-2018 08 18 174614 05 24 36.8 +23 11 12   2.013   1.807   63.6  30.1  22.7   57.47    095.3         1 348.7 / Map / Offsets
-2018 08 19 174614 05 26 15.8 +23 09 01   2.008   1.813   64.2  30.2  22.7   56.87    095.6         1 351.4 / Map / Offsets
-
-


- These calculations have been performed on the - Tamkin - Foundation Computing Network. -


-

- Valid HTML 4.01! -

- - diff --git a/astroquery/mpc/tests/data/1994XG_ephemeris_G37-a-t.html b/astroquery/mpc/tests/data/1994XG_ephemeris_G37-a-t.html deleted file mode 100644 index 21035b8bb4..0000000000 --- a/astroquery/mpc/tests/data/1994XG_ephemeris_G37-a-t.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - Minor Planet Ephemeris Service: Query Results - - -

Minor Planet Ephemeris Service: Query Results

- Below are the results of your request from the Minor Planet Center's - Minor Planet Ephemeris Service. - Ephemerides are for - observatory code G37. -


-

- 1994 XG -

Display all designations for this object / # of variant orbits available = 3 -

Perturbed ephemeris below is based on - 7-opp - unperturbed elements from - MPO 397717. - Last observed on 2016 Dec. 5. -Object has been observed on only one night at the latest opposition. -

Further observations? Useful for orbit improvement (based on orbit uncertainty). Useful for numbering. -

-     J94X00G       [H=18.6]
-Date       UT      R.A. (J2000) Decl.    Delta     r     El.    Ph.   V      Sky Motion        Object    Sun   Moon                Uncertainty info
-            h m s                                                            "/hr     P.A.    Azi. Alt.  Alt.  Phase Dist. Alt.    3-sig/" P.A.
-2018 07 30 174614 04 49 52.9 +23 32 07   2.091   1.693   53.3  28.7  22.6   67.51    090.1    256  +61   +62   0.93   095  -33         2 309.2 / Map / Offsets
-2018 07 31 174614 04 51 51.6 +23 32 03   2.088   1.699   53.8  28.8  22.6   66.97    090.4    257  +61   +62   0.87   084  -22         2 310.6 / Map / Offsets
-2018 08 01 174614 04 53 49.3 +23 31 52   2.085   1.705   54.3  28.9  22.6   66.43    090.7    257  +60   +61   0.79   072  -11         2 312.2 / Map / Offsets
-2018 08 02 174614 04 55 46.1 +23 31 34   2.082   1.712   54.8  29.0  22.6   65.89    091.0    257  +60   +61   0.71   060  +01         2 313.8 / Map / Offsets
-2018 08 03 174614 04 57 41.9 +23 31 09   2.078   1.718   55.3  29.1  22.6   65.34    091.2    258  +59   +61   0.61   047  +12         2 315.5 / Map / Offsets
-2018 08 04 174614 04 59 36.7 +23 30 36   2.075   1.724   55.9  29.2  22.6   64.80    091.5    258  +59   +61   0.50   035  +24         2 317.2 / Map / Offsets
-2018 08 05 174614 05 01 30.6 +23 29 56   2.071   1.730   56.4  29.2  22.6   64.25    091.8    259  +58   +61   0.40   022  +36         2 319.0 / Map / Offsets
-2018 08 06 174614 05 03 23.5 +23 29 09   2.067   1.736   56.9  29.3  22.7   63.69    092.1    259  +58   +61   0.29   009  +49         2 320.9 / Map / Offsets
-2018 08 07 174614 05 05 15.3 +23 28 16   2.064   1.742   57.5  29.4  22.7   63.14    092.4    259  +58   +60   0.19   007  +61         2 322.8 / Map / Offsets
-2018 08 08 174614 05 07 06.2 +23 27 15   2.060   1.748   58.0  29.5  22.7   62.58    092.6    260  +57   +60   0.11   021  +71         2 324.8 / Map / Offsets
-2018 08 09 174614 05 08 56.0 +23 26 08   2.055   1.754   58.5  29.5  22.7   62.02    092.9    260  +57   +60   0.04   035  +76         2 326.9 / Map / Offsets
-2018 08 10 174614 05 10 44.8 +23 24 54   2.051   1.760   59.1  29.6  22.7   61.45    093.2    261  +56   +60   0.01   050  +68         2 329.1 / Map / Offsets
-2018 08 11 174614 05 12 32.5 +23 23 33   2.047   1.766   59.6  29.7  22.7   60.88    093.5    261  +56   +60   0.00   064  +56         2 331.3 / Map / Offsets
-2018 08 12 174614 05 14 19.2 +23 22 06   2.042   1.772   60.2  29.7  22.7   60.30    093.8    261  +55   +60   0.03   079  +43         2 333.6 / Map / Offsets
-2018 08 13 174614 05 16 04.8 +23 20 32   2.038   1.778   60.7  29.8  22.7   59.72    094.1    262  +55   +59   0.08   093  +30         2 336.0 / Map / Offsets
-2018 08 14 174614 05 17 49.4 +23 18 52   2.033   1.784   61.3  29.9  22.7   59.14    094.4    262  +54   +59   0.15   107  +17         2 338.4 / Map / Offsets
-2018 08 15 174614 05 19 32.8 +23 17 06   2.028   1.790   61.9  29.9  22.7   58.55    094.7    262  +54   +59   0.24   120  +05         1 340.9 / Map / Offsets
-2018 08 16 174614 05 21 15.2 +23 15 14   2.023   1.795   62.5  30.0  22.7   57.97    095.0    263  +54   +59   0.34   133  -08         1 343.4 / Map / Offsets
-2018 08 17 174614 05 22 56.5 +23 13 15   2.018   1.801   63.0  30.1  22.7   57.37    095.3    263  +53   +59   0.44   146  -19         1 346.1 / Map / Offsets
-2018 08 18 174614 05 24 36.6 +23 11 10   2.013   1.807   63.6  30.1  22.7   56.78    095.6    263  +53   +58   0.54   158  -30         1 348.7 / Map / Offsets
-2018 08 19 174614 05 26 15.6 +23 09 00   2.008   1.813   64.2  30.2  22.7   56.18    095.9    264  +52   +58   0.64   169  -41         1 351.4 / Map / Offsets
-
-


- These calculations have been performed on the - Tamkin - Foundation Computing Network. -


-

- Valid HTML 4.01! -

- - diff --git a/astroquery/mpc/tests/test_mpc.py b/astroquery/mpc/tests/test_mpc.py index e1bbc46fac..9422e86d89 100644 --- a/astroquery/mpc/tests/test_mpc.py +++ b/astroquery/mpc/tests/test_mpc.py @@ -28,8 +28,8 @@ '2P_ephemeris_500-a-t': ('2P', {'proper_motion': 'total'}), '2P_ephemeris_500-a-c': ('2P', {'proper_motion': 'coordinate'}), '2P_ephemeris_500-a-s': ('2P', {'proper_motion': 'sky'}), - '1994XG_ephemeris_500-a-t': ('1994 XG', {}), - '1994XG_ephemeris_G37-a-t': ('1994 XG', {'location': 'G37'}), + '2024AA_ephemeris_500-a-t': ('2024 AA', {}), + '2024AA_ephemeris_G37-a-t': ('2024 AA', {'location': 'G37'}), 'testfail_ephemeris_500-a-t': ('test fail', {}), '2008JG_ephemeris_500-a-t': ('2008 JG', {}), } @@ -383,18 +383,12 @@ def test_get_ephemeris_perturbed(perturbed, val): @pytest.mark.parametrize('unc_links', (True, False)) def test_get_ephemeris_unc_links(unc_links, patch_post): - result = mpc.core.MPC.get_ephemeris('1994 XG', unc_links=unc_links) + result = mpc.core.MPC.get_ephemeris('2024 AA', unc_links=unc_links) assert np.all(result['Uncertainty 3sig'].quantity > 0 * u.arcsec) assert ('Unc. map' in result.colnames) == unc_links assert ('Unc. offsets' in result.colnames) == unc_links -def test_get_ephemeris_Moon_phase_and_Uncertainty(patch_post): - result = mpc.core.MPC.get_ephemeris('1994 XG', location='G37') - assert np.all(result['Moon phase'][0] >= 0) - assert np.all(result['Uncertainty 3sig'].quantity > 0 * u.arcsec) - - def test_get_observatory_codes(patch_get): result = mpc.core.MPC.get_observatory_codes() greenwich = ['000', 0.0, 0.62411, 0.77873, 'Greenwich'] From f29553a6d2039ca540456c37eeb15cfdff806e74 Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Thu, 5 Sep 2024 20:06:50 -0400 Subject: [PATCH 14/16] Fix deprecation: since 0.4.8 --- astroquery/mpc/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/astroquery/mpc/core.py b/astroquery/mpc/core.py index 646b43365e..0ee3288fe2 100644 --- a/astroquery/mpc/core.py +++ b/astroquery/mpc/core.py @@ -764,7 +764,7 @@ def _args_to_ephemeris_payload(self, **kwargs): return request_args @class_or_instance - @deprecated_renamed_argument("get_raw_response", None, since="0.4.9", + @deprecated_renamed_argument("get_raw_response", None, since="0.4.8", alternative="async methods") def get_observations_async(self, targetid, *, id_type=None, @@ -777,7 +777,7 @@ def get_observations_async(self, targetid, *, from the `Minor Planet Center observations database `_. - .. deprecated:: 0.4.9 + .. deprecated:: 0.4.8 The ``get_raw_response`` keyword argument is deprecated. The `~MPCClass.get_observations_async` method will return a raw response. From e6b7b8df5aaa6ce4bee3053eafff97080136bc72 Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Thu, 5 Sep 2024 20:15:34 -0400 Subject: [PATCH 15/16] More thoroughly identify changes. --- CHANGES.rst | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 14fddfd15b..3becc87463 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -43,10 +43,23 @@ mpc ^^^ - Parse star catalog information when querying observations database [#2957] + - Parse ephemeris with sky motion with three digit precision [#3026] + - Raise EmptyResponseError when empty ephemeris response is returned [#3026] -- Deprecate ``get_raw_response`` parameter in query methods. The raw response - may be retrieved from the _async() methods. [#3089] + +- Deprecate ``get_raw_response`` parameter from ``MPC.get_observations``. The + raw response may be retrieved from the _async() method. [#3089] + +- Remove ``get_raw_response`` parameter from ``MPC.get_ephemeris`` and + ``MPC.get_observatory_codes`` without deprecation as the parameters were + ignored and had no effect. [#3089] + +- Fix bug in ``MPC.get_ephemeris`` that caused the ``cache`` keyword parameter + to be ignored. [#3089] + +- Remove ``comettype`` parameter from ``MPC.get_observations`` without + deprecation: it was undocumented, ignored, and had no effect. [#3089] linelists.cdms ^^^^^^^^^^^^^^ @@ -196,7 +209,8 @@ mast mpc ^^^ -- Fix bug in ``MPC.get_ephemeris`` that caused the ``cache`` keyword parameter to be ignored. [#3089] +- Rename ``MPC.get_mpc_object_endpoint`` to ``MPC._get_mpc_object_endpoint`` to + indicate that it is a private method. [#3089] 0.4.7 (2024-03-08) From 274984fdf7b32d68873dd4ba6bd067db130992f8 Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Thu, 5 Sep 2024 20:24:45 -0400 Subject: [PATCH 16/16] Use 2P/Encke for doctest since Hyakutake isn't currently available. --- docs/mpc/mpc.rst | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/mpc/mpc.rst b/docs/mpc/mpc.rst index 31db48f981..26f83eb67a 100644 --- a/docs/mpc/mpc.rst +++ b/docs/mpc/mpc.rst @@ -351,15 +351,17 @@ Working with ephemeris tables Columns in the returned ephemeris tables carry the appropriate units. Convert the columns to Astropy quantities using the ``.quantity`` -attribute. To find comet Hyakutake's peak proper motion in the sky in +attribute. To find comet Encke's peak proper motion in the sky around +the time of its closest approach to Earth in November 2003: degrees per hour: .. doctest-remote-data:: - >>> eph = MPC.get_ephemeris('C/1996 B2', start='1996-03-01', step='1h', number=30 * 24) - >>> print(eph['Proper motion'].quantity.to('deg/h').max()) - 0.17234444444444447 deg / h + >>> eph = MPC.get_ephemeris('2P', start='2003-10-15', step='1d', number=60) + >>> print(eph['Proper motion'].quantity.to('deg/h').max()) # doctest: +FLOAT_CMP + 0.1259361111111111 deg / h + Sky coordinates are returned as quantities carrying units of degrees. If a sexagesimal representation is desired, they may be replaced with