From eef9ab500dc425393a4b2a060cc949048ada354a Mon Sep 17 00:00:00 2001 From: Abhimanyu Susobhanan Date: Thu, 20 Jun 2024 17:41:57 +0200 Subject: [PATCH 1/3] fix 1785 --- src/pint/simulation.py | 15 ++------------- tests/test_fake_toas.py | 2 ++ 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/pint/simulation.py b/src/pint/simulation.py index ea8e73bd0..65cfe4d14 100644 --- a/src/pint/simulation.py +++ b/src/pint/simulation.py @@ -514,25 +514,14 @@ def make_fake_toas_fromtim( -------- :func:`make_fake_toas` """ - ephem = ( - model.EPHEM.value - if hasattr(model, "EPHEM") and model.EPHEM.value is not None - else None - ) - planets = ( - model.PLANET_SHAPIRO.value - if hasattr(model, "PLANET_SHAPIRO") and model.PLANET_SHAPIRO.value is not None - else False - ) - - input_ts = pint.toa.get_TOAs(timfile, ephem=ephem, planets=planets) + input_ts = pint.toa.get_TOAs(timfile, model=model) if input_ts.is_wideband(): dm_errors = input_ts.get_dm_errors() ts = update_fake_dms(model, input_ts, dm_errors, add_noise) return make_fake_toas( - input_ts, + ts, model=model, add_noise=add_noise, add_correlated_noise=add_correlated_noise, diff --git a/tests/test_fake_toas.py b/tests/test_fake_toas.py index 16c95e46a..199389d2e 100644 --- a/tests/test_fake_toas.py +++ b/tests/test_fake_toas.py @@ -358,6 +358,8 @@ def test_fake_from_timfile(planets): ) r_sim = pint.residuals.Residuals(t_sim, m) + assert t.clock_corr_info["bipm_version"] == t_sim.clock_corr_info["bipm_version"] + assert np.isclose( r.calc_time_resids().std(), r_sim.calc_time_resids().std(), rtol=2 ) From fbd932b93580efcce3199d6b4d3a3d34fb07c9fc Mon Sep 17 00:00:00 2001 From: Abhimanyu Susobhanan Date: Thu, 20 Jun 2024 17:43:45 +0200 Subject: [PATCH 2/3] changelog --- CHANGELOG-unreleased.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG-unreleased.md b/CHANGELOG-unreleased.md index 30a04c434..fc1bc3859 100644 --- a/CHANGELOG-unreleased.md +++ b/CHANGELOG-unreleased.md @@ -43,4 +43,5 @@ the released changes. - Moved the test in `test_pmtransform_units.py` into a function. - Fixed bug in residual calculation when adding or removing phase wraps - Fix #1766 by correcting logic and more clearly naming argument (clkcorr->undo_clkcorr) +- `make_fake_toas_fromtim` now handles BIPM corrections and wideband DMs correctly. ### Removed From 3675dad5baa8f86fa4318120e1e0e08ce153c351 Mon Sep 17 00:00:00 2001 From: Abhimanyu Susobhanan Date: Thu, 20 Jun 2024 22:26:49 +0200 Subject: [PATCH 3/3] ts --- src/pint/simulation.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pint/simulation.py b/src/pint/simulation.py index 65cfe4d14..5c8ca9d5b 100644 --- a/src/pint/simulation.py +++ b/src/pint/simulation.py @@ -514,11 +514,11 @@ def make_fake_toas_fromtim( -------- :func:`make_fake_toas` """ - input_ts = pint.toa.get_TOAs(timfile, model=model) + ts = pint.toa.get_TOAs(timfile, model=model) - if input_ts.is_wideband(): - dm_errors = input_ts.get_dm_errors() - ts = update_fake_dms(model, input_ts, dm_errors, add_noise) + if ts.is_wideband(): + dm_errors = ts.get_dm_errors() + ts = update_fake_dms(model, ts, dm_errors, add_noise) return make_fake_toas( ts,