From 73efb90529673dda74035ddf8f18505c8eeedb2c Mon Sep 17 00:00:00 2001 From: David Kaplan Date: Wed, 21 Feb 2024 10:30:43 -0600 Subject: [PATCH] added spacecraft as alias for geocenter --- CHANGELOG-unreleased.md | 1 + src/pint/observatory/special_locations.py | 3 ++- tests/test_toa_create.py | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/CHANGELOG-unreleased.md b/CHANGELOG-unreleased.md index 5ac8acfd0..7a96e7931 100644 --- a/CHANGELOG-unreleased.md +++ b/CHANGELOG-unreleased.md @@ -43,4 +43,5 @@ the released changes. - Better exceptions for unsupported/unimplemented binary models (BTX, MSS, etc.) - Emit warnings when `WaveX`/`DMWaveX` is used together with other representations of red/DM noise - `get_observatory()` no longer overwrites `include_gps` and `include_bipm` of `Observatory` objects unless explicitly stated (BIPM and GPS clock corrections no longer incorrectly applied to BAT TOAs). +- Added back `spacecraft` as an alias for `stl_geo` ### Removed diff --git a/src/pint/observatory/special_locations.py b/src/pint/observatory/special_locations.py index b5b56047c..d5741e9f6 100644 --- a/src/pint/observatory/special_locations.py +++ b/src/pint/observatory/special_locations.py @@ -10,6 +10,7 @@ -------- :mod:`pint.observatory.topo_obs` """ + import astropy.units as u import numpy as np from astropy.coordinates import EarthLocation @@ -258,7 +259,7 @@ def load_special_locations(): # Need to initialize one of each so that it gets added to the list BarycenterObs("barycenter", aliases=["@", "ssb", "bary", "bat"], overwrite=True) GeocenterObs("geocenter", aliases=["0", "o", "coe", "geo"], overwrite=True) - T2SpacecraftObs("stl_geo", aliases=["STL_GEO"], overwrite=True) + T2SpacecraftObs("stl_geo", aliases=["STL_GEO", "spacecraft"], overwrite=True) # TODO -- How to handle user changing bipm_version? diff --git a/tests/test_toa_create.py b/tests/test_toa_create.py index 3c9c63c5d..0cc024910 100644 --- a/tests/test_toa_create.py +++ b/tests/test_toa_create.py @@ -266,6 +266,24 @@ def test_toas_fermi_notoalist(): assert np.all(toas.table == toas2.table) +def test_geocenter(): + toas = toa.get_TOAs( + io.StringIO( + """pint 0.000000 57932.5446286608075925 4.321 stl_geo -format Tempo2 -creator nicer -mjdtt 57932.5454294 -tely -2783.63069101 -telx 6119.42973459 -telz -890.7794845 -nsrc 18.34 -obsid 70020101 -t NICER -vy 4.04867262 -vx 2.69970132 -dphi 0.20496 -nbkg 430.66 -vz 5.92980989 -exposure 1543.0 +pint 0.000000 57933.6326461481560532 2.422 stl_geo -format Tempo2 -creator nicer -mjdtt 57933.6334469 -tely -4545.24145649 -telx 3799.22279181 -telz -3304.56529985 -nsrc 101.96 -obsid 70020102 -t NICER -vy 1.48403228 -vx 5.86477721 -dphi 0.20355 -nbkg 2394.04 -vz 4.70930058 -exposure 8100.71 +""" + ) + ) + toas2 = toa.get_TOAs( + io.StringIO( + """pint 0.000000 57932.5446286608075925 4.321 spacecraft -format Tempo2 -creator nicer -mjdtt 57932.5454294 -tely -2783.63069101 -telx 6119.42973459 -telz -890.7794845 -nsrc 18.34 -obsid 70020101 -t NICER -vy 4.04867262 -vx 2.69970132 -dphi 0.20496 -nbkg 430.66 -vz 5.92980989 -exposure 1543.0 +pint 0.000000 57933.6326461481560532 2.422 spacecraft -format Tempo2 -creator nicer -mjdtt 57933.6334469 -tely -4545.24145649 -telx 3799.22279181 -telz -3304.56529985 -nsrc 101.96 -obsid 70020102 -t NICER -vy 1.48403228 -vx 5.86477721 -dphi 0.20355 -nbkg 2394.04 -vz 4.70930058 -exposure 8100.71 +""" + ) + ) + assert np.all(toas == toas2) + + def test_toa_wb(): t = pulsar_mjd.Time(np.array([55000, 56000]), scale="utc", format="pulsar_mjd") obs = "gbt"