Skip to content

Commit

Permalink
properly seed rng in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jsdillon committed Oct 16, 2024
1 parent 2fd0e2b commit 6f3ee58
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions hera_cal/tests/test_redcal.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,8 @@ def test_init(self):
antpos = linear_array(NANTS)
reds = om.get_reds(antpos, pols=['ee'], pol_mode='1pol')
info = om.RedundantCalibrator(reds)
gains, true_vis, d = sim_red_data(reds, gain_scatter=.05)
rng = np.random.default_rng(21)
gains, true_vis, d = sim_red_data(reds, gain_scatter=.05, rng=rng)
w = dict([(k, 1.) for k in d.keys()])
meta, sol = info.logcal(d)

Expand Down Expand Up @@ -729,7 +730,8 @@ def test_omnical(self):
antpos = linear_array(NANTS)
reds = om.get_reds(antpos, pols=['xx'], pol_mode='1pol')
info = om.RedundantCalibrator(reds)
gains, true_vis, d = sim_red_data(reds, gain_scatter=.0099999)
rng = np.random.default_rng(21)
gains, true_vis, d = sim_red_data(reds, gain_scatter=.0099999, rng=rng)
w = dict([(k, 1.) for k in d.keys()])
sol0 = dict([(k, np.ones_like(v)) for k, v in gains.items()])
sol0.update(info.compute_ubls(d, sol0))
Expand Down Expand Up @@ -761,7 +763,8 @@ def test_omnical64(self):
antpos = linear_array(NANTS)
reds = om.get_reds(antpos, pols=['xx'], pol_mode='1pol')
info = om.RedundantCalibrator(reds)
gains, true_vis, d = sim_red_data(reds, shape=(2, 1), gain_scatter=.0099999)
rng = np.random.default_rng(21)
gains, true_vis, d = sim_red_data(reds, shape=(2, 1), gain_scatter=.0099999, rng=rng)
w = dict([(k, 1.) for k in d.keys()])
sol0 = dict([(k, np.ones_like(v)) for k, v in gains.items()])
sol0.update(info.compute_ubls(d, sol0))
Expand Down Expand Up @@ -792,7 +795,8 @@ def test_omnical128(self):
antpos = linear_array(NANTS)
reds = om.get_reds(antpos, pols=['xx'], pol_mode='1pol')
info = om.RedundantCalibrator(reds)
gains, true_vis, d = sim_red_data(reds, shape=(2, 1), gain_scatter=.0099999)
rng = np.random.default_rng(21)
gains, true_vis, d = sim_red_data(reds, shape=(2, 1), gain_scatter=.0099999, rng=rng)
w = dict([(k, 1.) for k in d.keys()])
sol0 = dict([(k, np.ones_like(v)) for k, v in gains.items()])
sol0.update(info.compute_ubls(d, sol0))
Expand Down

0 comments on commit 6f3ee58

Please sign in to comment.