Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkaplantest committed Dec 17, 2023
1 parent fc61ed6 commit a6499fc
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/pint/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
23 changes: 20 additions & 3 deletions tests/test_fake_toas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down

0 comments on commit a6499fc

Please sign in to comment.