diff --git a/CHANGELOG-unreleased.md b/CHANGELOG-unreleased.md index e40601222..a24be6a94 100644 --- a/CHANGELOG-unreleased.md +++ b/CHANGELOG-unreleased.md @@ -16,4 +16,5 @@ the released changes. - `MCMC_walkthrough` notebook now runs - Fixed runtime data README - Fixed `derived_params` when OMDOT has 0 uncertainty +- Fixed `make_fake_toas_fromtim` ### Removed diff --git a/src/pint/simulation.py b/src/pint/simulation.py index 12346c29a..d66128dcb 100644 --- a/src/pint/simulation.py +++ b/src/pint/simulation.py @@ -485,7 +485,7 @@ def make_fake_toas_fromtim( if input_ts.is_wideband(): dm_errors = input_ts.get_dm_errors() - ts = update_fake_dms(model, ts, dm_errors, add_noise) + ts = update_fake_dms(model, input_ts, dm_errors, add_noise) return make_fake_toas( input_ts, diff --git a/tests/test_fake_toas.py b/tests/test_fake_toas.py index 94c0f7c0c..d1678085e 100644 --- a/tests/test_fake_toas.py +++ b/tests/test_fake_toas.py @@ -304,10 +304,27 @@ def test_fake_from_timfile(planets): ) r_sim = pint.residuals.Residuals(t_sim, m) - m, t = get_model_and_toas( - pint.config.examplefile("B1855+09_NANOGrav_9yv1.gls.par"), - pint.config.examplefile("B1855+09_NANOGrav_9yv1.tim"), + assert np.isclose( + r.calc_time_resids().std(), r_sim.calc_time_resids().std(), rtol=2 + ) + + +@pytest.mark.parametrize("planets", (True, False)) +def test_fake_from_timfile_wb(planets): + m = get_model(os.path.join(datadir, "B1855+09_NANOGrav_12yv3.wb.gls.par")) + t = get_TOAs( + os.path.join(datadir, "B1855+09_NANOGrav_12yv3.wb.tim"), planets=planets ) + + m.PLANET_SHAPIRO.value = planets + + r = pint.residuals.Residuals(t, m) + + t_sim = pint.simulation.make_fake_toas_fromtim( + os.path.join(datadir, "B1855+09_NANOGrav_12yv3.wb.tim"), m, add_noise=True + ) + r_sim = pint.residuals.Residuals(t_sim, m) + assert np.isclose( r.calc_time_resids().std(), r_sim.calc_time_resids().std(), rtol=2 )