Skip to content

Commit

Permalink
Backport fixes from astropy#14382
Browse files Browse the repository at this point in the history
  • Loading branch information
pllim committed May 6, 2023
1 parent 09cad66 commit 5f9e92b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
16 changes: 10 additions & 6 deletions astropy/coordinates/tests/test_intermediate_transformations.py
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,9 @@ def test_aa_hd_high_precision():
Updated 2020-11-29, after the comparison between codes became even better,
down to 100 nas.
Updated 2023-02-14, after IERS changes the IERS B format and analysis,
causing small deviations.
NOTE: the agreement reflects consistency in approach between two codes,
not necessarily absolute precision. If this test starts failing, the
tolerance can and should be weakened *if* it is clear that the change is
Expand All @@ -1105,8 +1108,9 @@ def test_aa_hd_high_precision():
# Numbers from
# https://github.com/astropy/astropy/pull/11073#issuecomment-735486271
# updated in https://github.com/astropy/astropy/issues/11683
TARGET_AZ, TARGET_EL = 15.032673509956 * u.deg, 50.303110133923 * u.deg
TARGET_DISTANCE = 376252883.247239 * u.m
# and again after the IERS_B change.
TARGET_AZ, TARGET_EL = 15.032673662647138 * u.deg, 50.303110087520054 * u.deg
TARGET_DISTANCE = 376252.88325051306 * u.km
assert_allclose(moon_aa.az, TARGET_AZ, atol=0.1 * u.uas, rtol=0)
assert_allclose(moon_aa.alt, TARGET_EL, atol=0.1 * u.uas, rtol=0)
assert_allclose(moon_aa.distance, TARGET_DISTANCE, atol=0.1 * u.mm, rtol=0)
Expand All @@ -1129,8 +1133,8 @@ def test_aa_high_precision_nodata():
with a version of the code that passes the tests above, but for the internal solar system
ephemerides to avoid the use of remote data.
"""
# Last updated when switching to erfa 2.0.0 and its moon98 function.
TARGET_AZ, TARGET_EL = 15.03231495 * u.deg, 50.3027193 * u.deg
# Last updated when the new IERS B format and analysis was introduced.
TARGET_AZ, TARGET_EL = 15.0323151 * u.deg, 50.30271925 * u.deg
lat = -22.959748 * u.deg
lon = -67.787260 * u.deg
elev = 5186 * u.m
Expand All @@ -1139,8 +1143,8 @@ def test_aa_high_precision_nodata():

moon = get_body("moon", t, loc)
moon_aa = moon.transform_to(AltAz(obstime=t, location=loc))
assert_allclose(moon_aa.az - TARGET_AZ, 0 * u.mas, atol=0.55 * u.mas)
assert_allclose(moon_aa.alt - TARGET_EL, 0 * u.mas, atol=0.55 * u.mas)
assert_allclose(moon_aa.az - TARGET_AZ, 0 * u.mas, atol=0.5 * u.mas)
assert_allclose(moon_aa.alt - TARGET_EL, 0 * u.mas, atol=0.5 * u.mas)


class TestGetLocationGCRS:
Expand Down
8 changes: 4 additions & 4 deletions astropy/utils/iers/tests/test_iers.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,11 @@ def test_simple(self):
predictive_mjd = dat.meta["predictive_mjd"]
dat._time_now = Time(predictive_mjd, format="mjd") + 7 * u.d

# Look at times before and after the test file begins. 0.1292905 is
# Look at times before and after the test file begins. 0.1292934 is
# the IERS-B value from MJD=57359. The value in
# finals2000A-2016-02-30-test has been replaced at this point.
assert np.allclose(
dat.ut1_utc(Time(50000, format="mjd").jd).value, 0.1293286
dat.ut1_utc(Time(50000, format="mjd").jd).value, 0.1292934
)
assert np.allclose(
dat.ut1_utc(Time(60000, format="mjd").jd).value, -0.2246227
Expand All @@ -306,7 +306,7 @@ def test_simple(self):
# and an exception when extrapolating into the future with insufficient data.
dat._time_now = Time(predictive_mjd, format="mjd") + 60 * u.d
assert np.allclose(
dat.ut1_utc(Time(50000, format="mjd").jd).value, 0.1293286
dat.ut1_utc(Time(50000, format="mjd").jd).value, 0.1292934
)
with pytest.warns(
iers.IERSStaleWarning, match="IERS_Auto predictive values are older"
Expand Down Expand Up @@ -336,7 +336,7 @@ def test_simple(self):
with iers.conf.set_temp("iers_auto_url", self.iers_a_url_2):
# Look at times before and after the test file begins. This forces a new download.
assert np.allclose(
dat.ut1_utc(Time(50000, format="mjd").jd).value, 0.1293286
dat.ut1_utc(Time(50000, format="mjd").jd).value, 0.1292934
)
assert np.allclose(dat.ut1_utc(Time(60000, format="mjd").jd).value, -0.3)

Expand Down
8 changes: 4 additions & 4 deletions docs/coordinates/frames.rst
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,10 @@ set of coordinates, you will need to make sure that the shapes allow this::
'2012-03-21T00:00:00.000']
['2012-06-21T00:00:00.000' '2012-06-21T00:00:00.000'
'2012-06-21T00:00:00.000']], location=(3980608.90246817, -102.47522911, 4966861.27310068) m, pressure=0.0 hPa, temperature=0.0 deg_C, relative_humidity=0.0, obswl=1.0 micron): (az, alt) in deg
[[( 93.09845183, 89.21613128), (126.85789664, 25.4660055 ),
( 51.37993234, 37.18532527)],
[(307.71713698, 37.99437658), (231.3740787 , 26.36768329),
( 85.42187236, 89.69297998)]]>
[[( 93.09845155, 89.21613119), (126.85789646, 25.46600543),
( 51.37993224, 37.1853252 )],
[(307.71713691, 37.99437664), (231.37407858, 26.36768334),
( 85.42187562, 89.6929799 )]]>

.. Note::
Frames without data have a ``shape`` that is determined by their frame
Expand Down
2 changes: 1 addition & 1 deletion docs/coordinates/spectralcoord.rst
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ T Tau. We can convert these frequencies to velocities assuming the Doppler shift
redshift=0.0
doppler_rest=115.2712018 GHz
doppler_convention=radio)
[-11.90160353, -27.50828545, -30.1093991 ] km / s>
[-11.90160348, -27.50828539, -30.10939905] km / s>

Note that these resulting velocities are different from the ``radial_velocity``
property (which is still zero here) - the latter is the difference in velocity
Expand Down

0 comments on commit 5f9e92b

Please sign in to comment.