From 950a56dd5d054c8a271b072fe73f15479d56be78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Mon, 7 Aug 2023 12:25:15 -0700 Subject: [PATCH 1/3] TST: test for 1 warning --- astroquery/simbad/tests/test_simbad.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/astroquery/simbad/tests/test_simbad.py b/astroquery/simbad/tests/test_simbad.py index 0237987f2b..d188119703 100644 --- a/astroquery/simbad/tests/test_simbad.py +++ b/astroquery/simbad/tests/test_simbad.py @@ -347,17 +347,14 @@ def test_votable_fields(): sb.add_votable_fields('rot', 'z_value', 'velocity') assert (set(sb.get_votable_fields()) == set(['main_id', 'coordinates', 'rot', 'z_value', 'velocity'])) - try: - sb.add_votable_fields('velocity') - except KeyError: - pass # this is the expected response + assert (set(sb.get_votable_fields()) == set(['main_id', 'coordinates', 'rot', 'z_value', 'velocity'])) sb.remove_votable_fields('rot', 'main_id', 'coordinates') assert set(sb.get_votable_fields()) == set(['z_value', 'velocity']) # Warning is expected as we removed the 'coordinates' field above: with pytest.warns(UserWarning, match="coordinates: this field is not set"): - sb.remove_votable_fields('rot', 'main_id', 'coordinates') + sb.remove_votable_fields('coordinates') assert set(sb.get_votable_fields()) == set(['z_value', 'velocity']) with pytest.warns(UserWarning, match="All fields have been removed. Resetting"): sb.remove_votable_fields('z_value', 'velocity') From 6dceccc6a3789a376139eafcfad285557d977aa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Mon, 7 Aug 2023 12:39:35 -0700 Subject: [PATCH 2/3] FIX: some ID columns are mixed cases, fix their int64 casting --- CHANGES.rst | 3 +++ astroquery/sdss/core.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 1c85281ea0..7e723c74c0 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -208,6 +208,9 @@ sdss - Switching to https to avoid issues originating in relying on server side redirects. [#2654] +- Fix bug to have object IDs as integers on windows. [#2800] + + simbad ^^^^^^ diff --git a/astroquery/sdss/core.py b/astroquery/sdss/core.py index 7fcd4885af..7b3c2b392e 100644 --- a/astroquery/sdss/core.py +++ b/astroquery/sdss/core.py @@ -1040,7 +1040,7 @@ def _parse_result(self, response, verbose=False): warnings.filterwarnings("ignore", category=AstropyWarning, message=r'OverflowError converting to IntType in column.*') arr = Table.read(response.text, format='ascii.csv', comment="#") - for id_column in ('objid', 'specobjid'): + for id_column in ('objid', 'specobjid', 'objID', 'specobjID'): if id_column in arr.columns: arr[id_column] = arr[id_column].astype(np.int64) From 4b109a79ea0031c986566d8375bb048ed39d6bdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Mon, 7 Aug 2023 13:58:44 -0700 Subject: [PATCH 3/3] TST: fixing failing doctests --- astroquery/lamda/core.py | 2 +- docs/casda/casda.rst | 4 ++-- docs/esa/jwst/jwst.rst | 17 ++++++++--------- docs/ipac/irsa/irsa.rst | 2 +- docs/ipac/irsa/most.rst | 16 ++++++++-------- docs/ipac/nexsci/nasa_exoplanet_archive.rst | 3 ++- docs/jplsbdb/jplsbdb.rst | 4 ++-- docs/lamda/lamda.rst | 6 +++--- docs/mpc/mpc.rst | 2 +- docs/svo_fps/svo_fps.rst | 3 ++- 10 files changed, 30 insertions(+), 29 deletions(-) diff --git a/astroquery/lamda/core.py b/astroquery/lamda/core.py index 85b912d4db..c061891c67 100644 --- a/astroquery/lamda/core.py +++ b/astroquery/lamda/core.py @@ -122,7 +122,7 @@ def get_molecules(self, *, cache=True): response = self._request('GET', main_url, cache=cache) response.raise_for_status() - soup = BeautifulSoup(response.content) + soup = BeautifulSoup(response.content, features="html5lib") links = soup.find_all('a', href=True) datfile_urls = [url diff --git a/docs/casda/casda.rst b/docs/casda/casda.rst index 294f419cfa..46665e0db4 100644 --- a/docs/casda/casda.rst +++ b/docs/casda/casda.rst @@ -25,7 +25,7 @@ For example: >>> from astropy import units as u >>> centre = SkyCoord.from_name('NGC 7232') >>> result_table = Casda.query_region(centre, radius=30*u.arcmin) - >>> print(result_table['obs_publisher_did','s_ra', 's_dec', 'obs_release_date'][:5]) + >>> print(result_table['obs_publisher_did','s_ra', 's_dec', 'obs_release_date'][:5]) # doctest: +IGNORE_OUTPUT obs_publisher_did s_ra s_dec obs_release_date deg deg ----------------- --------------- ---------------- ------------------------ @@ -45,7 +45,7 @@ For example to filter out the 30 non-public results from the above data set: .. doctest-remote-data:: >>> public_results = Casda.filter_out_unreleased(result_table) - >>> print(public_results['obs_publisher_did','s_ra', 's_dec', 'obs_release_date'][:5]) + >>> print(public_results['obs_publisher_did','s_ra', 's_dec', 'obs_release_date'][:5]) # doctest: +IGNORE_OUTPUT obs_publisher_did s_ra s_dec obs_release_date deg deg ----------------- --------------- ---------------- ------------------------ diff --git a/docs/esa/jwst/jwst.rst b/docs/esa/jwst/jwst.rst index b0c1b3c46f..866ca9cb11 100644 --- a/docs/esa/jwst/jwst.rst +++ b/docs/esa/jwst/jwst.rst @@ -1,4 +1,3 @@ - .. _astroquery.esa.jwst: **************************************** @@ -379,14 +378,14 @@ Once a table is loaded, columns can be inspected >>> from astroquery.esa.jwst import Jwst >>> table = Jwst.load_table('jwst.main') >>> print(*(column.name for column in table.columns), sep="\n") - "public" - algorithm_name - calibrationlevel - collection - creatorid - dataproducttype - energy_bandpassname - ... + public + algorithm_name + calibrationlevel + collection + creatorid + dataproducttype + energy_bandpassname + ... 1.6 Synchronous query diff --git a/docs/ipac/irsa/irsa.rst b/docs/ipac/irsa/irsa.rst index 3f758864eb..8c7abb0637 100644 --- a/docs/ipac/irsa/irsa.rst +++ b/docs/ipac/irsa/irsa.rst @@ -68,7 +68,7 @@ entered as a string that is parsable by `~astropy.coordinates.Angle`. >>> import astropy.units as u >>> table = Irsa.query_region("m31", catalog="fp_psc", spatial="Cone", ... radius=2 * u.arcmin) - >>> print(table) + >>> print(table) # doctest: +IGNORE_OUTPUT ra dec clon clat ... angle j_h h_k j_k deg deg ... deg ---------- ---------- ------------ ------------ ... ---------- ----- ----- ----- diff --git a/docs/ipac/irsa/most.rst b/docs/ipac/irsa/most.rst index 26d9f75170..52d3ffa414 100644 --- a/docs/ipac/irsa/most.rst +++ b/docs/ipac/irsa/most.rst @@ -363,16 +363,16 @@ asteroid `Victoria `_ as: ra_obj dec_obj sun_dist geo_dist ... moon_sep saa_sep qual_frame image_set float64 float64 float64 float64 ... float64 float64 int64 int64 ---------- --------- -------- -------- ... -------- ------- ---------- --------- - 333.539704 -0.779309 1.8179 1.4638 ... 102.339 15.039 10 6 - 333.539704 -0.779309 1.8179 1.4638 ... 102.339 15.039 10 6 + 333.539704 -0.779308 1.8179 1.4638 ... 102.339 15.039 10 6 + 333.539704 -0.779308 1.8179 1.4638 ... 102.339 15.039 10 6 333.589056 -0.747249 1.8179 1.4626 ... 103.825 46.517 10 6 333.589056 -0.747249 1.8179 1.4626 ... 103.825 46.517 10 6 333.638286 -0.71525 1.8179 1.4614 ... 105.327 89.053 10 6 333.638286 -0.71525 1.8179 1.4614 ... 105.327 89.053 10 6 333.687495 -0.683205 1.8178 1.4603 ... 106.803 115.076 10 6 333.687495 -0.683205 1.8178 1.4603 ... 106.803 115.076 10 6 - 333.736581 -0.651221 1.8178 1.4591 ... 108.294 73.321 10 6 - 333.736581 -0.651221 1.8178 1.4591 ... 108.294 73.321 10 6 + 333.736581 -0.65122 1.8178 1.4591 ... 108.294 73.321 10 6 + 333.736581 -0.65122 1.8178 1.4591 ... 108.294 73.321 10 6 To return more than just a table of image identifiers, use one of the more verbose output modes - ``Regular`` or ``Full``. @@ -393,16 +393,16 @@ verbose output modes - ``Regular`` or ``Full``. ra_obj dec_obj sun_dist geo_dist ... moon_sep saa_sep qual_frame image_set float64 float64 float64 float64 ... float64 float64 int64 int64 ---------- --------- -------- -------- ... -------- ------- ---------- --------- - 333.539704 -0.779309 1.8179 1.4638 ... 102.339 15.039 10 6 - 333.539704 -0.779309 1.8179 1.4638 ... 102.339 15.039 10 6 + 333.539704 -0.779308 1.8179 1.4638 ... 102.339 15.039 10 6 + 333.539704 -0.779308 1.8179 1.4638 ... 102.339 15.039 10 6 333.589056 -0.747249 1.8179 1.4626 ... 103.825 46.517 10 6 333.589056 -0.747249 1.8179 1.4626 ... 103.825 46.517 10 6 333.638286 -0.71525 1.8179 1.4614 ... 105.327 89.053 10 6 333.638286 -0.71525 1.8179 1.4614 ... 105.327 89.053 10 6 333.687495 -0.683205 1.8178 1.4603 ... 106.803 115.076 10 6 333.687495 -0.683205 1.8178 1.4603 ... 106.803 115.076 10 6 - 333.736581 -0.651221 1.8178 1.4591 ... 108.294 73.321 10 6 - 333.736581 -0.651221 1.8178 1.4591 ... 108.294 73.321 10 6 + 333.736581 -0.65122 1.8178 1.4591 ... 108.294 73.321 10 6 + 333.736581 -0.65122 1.8178 1.4591 ... 108.294 73.321 10 6 As demonstrated, the returned values are stored in a dictionary and which ``metadata`` key table matches the ``Brief`` output mode table. diff --git a/docs/ipac/nexsci/nasa_exoplanet_archive.rst b/docs/ipac/nexsci/nasa_exoplanet_archive.rst index 9a12257fe9..aff0f55fa8 100644 --- a/docs/ipac/nexsci/nasa_exoplanet_archive.rst +++ b/docs/ipac/nexsci/nasa_exoplanet_archive.rst @@ -93,7 +93,8 @@ A list of accessible tables can be found in the ``TAP_TABLES`` attribute: >>> from astroquery.ipac.nexsci.nasa_exoplanet_archive import NasaExoplanetArchive >>> NasaExoplanetArchive.TAP_TABLES - ['superwasptimeseries', + ['spectra', + 'superwasptimeseries', 'kelttimeseries', 'DI_STARS_EXEP', 'transitspec', diff --git a/docs/jplsbdb/jplsbdb.rst b/docs/jplsbdb/jplsbdb.rst index 5a0cd0df94..8d53e9301e 100644 --- a/docs/jplsbdb/jplsbdb.rst +++ b/docs/jplsbdb/jplsbdb.rst @@ -156,7 +156,7 @@ item: .. code-block:: python >>> sbdb['orbit']['moid_jup'] # doctest: +REMOTE_DATA - + Note that many of the items in the output dictionary are associated with `~astropy.units` which can be readily used for @@ -167,7 +167,7 @@ orbit intersection distance of the target with respect to Jupiter .. code-block:: python >>> print(sbdb['orbit']['moid_jup'].to('km')) # doctest: +REMOTE_DATA - 64476682.271699995 km + 64327084.40099999 km The vast majority of parameter names are identical to those used in the `SBDB API documentation diff --git a/docs/lamda/lamda.rst b/docs/lamda/lamda.rst index 402e091d2c..5087a2563f 100644 --- a/docs/lamda/lamda.rst +++ b/docs/lamda/lamda.rst @@ -27,12 +27,12 @@ is called, then cached for future use. If there has been an update and you want to reload the cache, you can find the cache file ``'molecules.json'`` and remove it: -.. doctest-remote-data:: +.. doctest-skip:: >>> import os - >>> Lamda.cache_location # doctest: +IGNORE_OUTPUT + >>> Lamda.cache_location '/Users/your_username/.astropy/cache/astroquery/Lamda' - >>> Lamda.moldict_path # doctest: +IGNORE_OUTPUT + >>> Lamda.moldict_path '/Users/your_username/.astropy/cache/astroquery/Lamda/molecules.json' >>> os.remove(Lamda.moldict_path) diff --git a/docs/mpc/mpc.rst b/docs/mpc/mpc.rst index 0a5cb16b09..33d8576c6b 100644 --- a/docs/mpc/mpc.rst +++ b/docs/mpc/mpc.rst @@ -359,7 +359,7 @@ degrees per hour: >>> 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.7756944444444445 deg / h + 0.17234444444444447 deg / h Sky coordinates are returned as quantities carrying units of degrees. If a sexagesimal representation is desired, they may be replaced with diff --git a/docs/svo_fps/svo_fps.rst b/docs/svo_fps/svo_fps.rst index 30a65d12f8..dd75389f45 100644 --- a/docs/svo_fps/svo_fps.rst +++ b/docs/svo_fps/svo_fps.rst @@ -25,7 +25,7 @@ range) can be listed with >>> from astroquery.svo_fps import SvoFps >>> index = SvoFps.get_filter_index(12_000*u.angstrom, 12_100*u.angstrom) >>> index.info - +
name dtype unit -------------------- ------- --------------- FilterProfileService object @@ -62,6 +62,7 @@ range) can be listed with AsinhSoft float64 TrasmissionCurve object + If the wavelength range contains too many entries then a ``TimeoutError`` will occur. A smaller wavelength range might succeed, but if a large range really is required then you can use the ``timeout`` argument to allow for a longer