From 183d06ddce46424d038d7f29e037f8a032326579 Mon Sep 17 00:00:00 2001 From: Volodymyr Savchenko Date: Tue, 29 Mar 2022 11:19:07 +0200 Subject: [PATCH 1/3] freeze rounding --- astroquery/heasarc/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/astroquery/heasarc/core.py b/astroquery/heasarc/core.py index e5cabd9d33..8cefb44182 100644 --- a/astroquery/heasarc/core.py +++ b/astroquery/heasarc/core.py @@ -171,7 +171,7 @@ def query_region_async(self, position: Union[coordinates.SkyCoord, str], # Generate the request request_payload = self._args_to_payload( mission=mission, - entry="{},{}".format(c.ra.degree, c.dec.degree), + entry="{:10f},{:.10f}".format(c.ra.degree, c.dec.degree), radius=u.Quantity(radius), **kwargs ) From 714e6fd347816d3087442011d0bae7158ab98bb7 Mon Sep 17 00:00:00 2001 From: Volodymyr Savchenko Date: Tue, 29 Mar 2022 11:19:07 +0200 Subject: [PATCH 2/3] freeze rounding in heasarc query, adapted data files --- astroquery/heasarc/core.py | 2 +- .../heasarc/tests/data/{0f36aba7.dat => 10f92917.dat} | 0 .../heasarc/tests/data/{69b39684.dat => 6ad7a587.dat} | 0 .../heasarc/tests/data/{31b1e555.dat => 6df5af53.dat} | 0 .../heasarc/tests/data/{29872e7f.dat => eb62ea7d.dat} | 0 .../heasarc/tests/data/{26550aeb.dat => f3778475.dat} | 0 astroquery/heasarc/tests/parametrization.py | 7 ++++++- astroquery/heasarc/tests/test_heasarc_remote.py | 1 + astroquery/heasarc/tests/test_heasarc_remote_isdc.py | 1 + 9 files changed, 9 insertions(+), 2 deletions(-) rename astroquery/heasarc/tests/data/{0f36aba7.dat => 10f92917.dat} (100%) rename astroquery/heasarc/tests/data/{69b39684.dat => 6ad7a587.dat} (100%) rename astroquery/heasarc/tests/data/{31b1e555.dat => 6df5af53.dat} (100%) rename astroquery/heasarc/tests/data/{29872e7f.dat => eb62ea7d.dat} (100%) rename astroquery/heasarc/tests/data/{26550aeb.dat => f3778475.dat} (100%) diff --git a/astroquery/heasarc/core.py b/astroquery/heasarc/core.py index 8cefb44182..70cafbfd05 100644 --- a/astroquery/heasarc/core.py +++ b/astroquery/heasarc/core.py @@ -171,7 +171,7 @@ def query_region_async(self, position: Union[coordinates.SkyCoord, str], # Generate the request request_payload = self._args_to_payload( mission=mission, - entry="{:10f},{:.10f}".format(c.ra.degree, c.dec.degree), + entry=f"{c.ra.degree:.10f},{c.dec.degree:.10f}", radius=u.Quantity(radius), **kwargs ) diff --git a/astroquery/heasarc/tests/data/0f36aba7.dat b/astroquery/heasarc/tests/data/10f92917.dat similarity index 100% rename from astroquery/heasarc/tests/data/0f36aba7.dat rename to astroquery/heasarc/tests/data/10f92917.dat diff --git a/astroquery/heasarc/tests/data/69b39684.dat b/astroquery/heasarc/tests/data/6ad7a587.dat similarity index 100% rename from astroquery/heasarc/tests/data/69b39684.dat rename to astroquery/heasarc/tests/data/6ad7a587.dat diff --git a/astroquery/heasarc/tests/data/31b1e555.dat b/astroquery/heasarc/tests/data/6df5af53.dat similarity index 100% rename from astroquery/heasarc/tests/data/31b1e555.dat rename to astroquery/heasarc/tests/data/6df5af53.dat diff --git a/astroquery/heasarc/tests/data/29872e7f.dat b/astroquery/heasarc/tests/data/eb62ea7d.dat similarity index 100% rename from astroquery/heasarc/tests/data/29872e7f.dat rename to astroquery/heasarc/tests/data/eb62ea7d.dat diff --git a/astroquery/heasarc/tests/data/26550aeb.dat b/astroquery/heasarc/tests/data/f3778475.dat similarity index 100% rename from astroquery/heasarc/tests/data/26550aeb.dat rename to astroquery/heasarc/tests/data/f3778475.dat diff --git a/astroquery/heasarc/tests/parametrization.py b/astroquery/heasarc/tests/parametrization.py index e40de7655c..8cac67559b 100644 --- a/astroquery/heasarc/tests/parametrization.py +++ b/astroquery/heasarc/tests/parametrization.py @@ -1,3 +1,4 @@ +import json import os import glob import hashlib @@ -40,7 +41,11 @@ def fileid_for_request(url, params): def filename_for_request(url, params, output=False): fileid = fileid_for_request(url, params) - return data_path(fileid, output=output) + + filename = data_path(fileid, output=output) + log.debug(f'constructed filename {filename} for request: ' + json.dumps(dict(url=url, params=params), sort_keys=True, indent=4)) + + return filename def get_mockreturn(session, method, url, params=None, timeout=10, **kwargs): diff --git a/astroquery/heasarc/tests/test_heasarc_remote.py b/astroquery/heasarc/tests/test_heasarc_remote.py index e6f7455762..50693e1d63 100644 --- a/astroquery/heasarc/tests/test_heasarc_remote.py +++ b/astroquery/heasarc/tests/test_heasarc_remote.py @@ -24,6 +24,7 @@ def test_custom_args(self): time="2020-09-01 .. 2020-12-01", resultmax=10, good_isgri=">1000", + cache=False ) def test_filter_custom_args(self): diff --git a/astroquery/heasarc/tests/test_heasarc_remote_isdc.py b/astroquery/heasarc/tests/test_heasarc_remote_isdc.py index c43cac094a..0f3765ec49 100644 --- a/astroquery/heasarc/tests/test_heasarc_remote_isdc.py +++ b/astroquery/heasarc/tests/test_heasarc_remote_isdc.py @@ -32,6 +32,7 @@ def test_custom_args(self): time="2020-09-01 .. 2020-12-01", resultmax=10, good_isgri=">1000", + cache=False ) def test_filter_custom_args(self): From a1beaaf1f23a9bb11e81dd28fb3ad1620ecfbcb5 Mon Sep 17 00:00:00 2001 From: Volodymyr Savchenko Date: Wed, 30 Mar 2022 21:43:50 +0200 Subject: [PATCH 3/3] comment about fixed representation --- astroquery/heasarc/core.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/astroquery/heasarc/core.py b/astroquery/heasarc/core.py index 70cafbfd05..aeed1d068b 100644 --- a/astroquery/heasarc/core.py +++ b/astroquery/heasarc/core.py @@ -169,6 +169,8 @@ def query_region_async(self, position: Union[coordinates.SkyCoord, str], kwargs['equinox'] = 2000 # Generate the request + # Fixed string representation of coordinates ensures that request payload + # does not depend on python/astropy version for the same input coordinates request_payload = self._args_to_payload( mission=mission, entry=f"{c.ra.degree:.10f},{c.dec.degree:.10f}",