Skip to content

Commit

Permalink
fix random seed
Browse files Browse the repository at this point in the history
  • Loading branch information
tyler-a-cox committed Jul 2, 2024
1 parent 8c1aec4 commit 04fa8d3
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions hera_cal/lst_stack/tests/test_calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

class TestLSTBinCalibration:
def setup_class(self):
self.rng = np.random.default_rng(42)
self.uvd = mockuvd.create_uvd_identifiable(
integration_time=24 * 3600,
ntimes=20,
Expand Down Expand Up @@ -42,7 +43,7 @@ def setup_class(self):
def test_amp_cal(self):
stack_copy = self.stack.copy()
auto_stack_copy = self.auto_stack.copy()
gains = np.random.normal(1, 0.1, size=(20, stack_copy.data.shape[2], 2))
gains = self.rng.normal(1, 0.1, size=(20, stack_copy.data.shape[2], 2))

stack_copy.data *= gains[:, None, :, :] ** 2
auto_stack_copy.data *= gains[:, None, :, :] ** 2
Expand Down Expand Up @@ -98,7 +99,7 @@ def test_amp_cal(self):

def test_phase_cal(self):
stack_copy = self.stack.copy()
tip_tilt = np.random.normal(0, 0.1, size=(20, self.stack.data.shape[2], 2))
tip_tilt = self.rng.normal(0, 0.1, size=(20, self.stack.data.shape[2], 2))
gains = np.array(
[
np.exp(1j * tip_tilt * (self.antpos[ant2] - self.antpos[ant1])[0])
Expand Down Expand Up @@ -152,8 +153,8 @@ def test_phase_cal(self):

def test_full_night_flagged(self):
stack_copy = self.stack.copy()
gains = np.random.normal(1, 0.1, size=(20, stack_copy.data.shape[2], 2))
tip_tilt = np.random.normal(0, 0.1, size=(20, self.stack.data.shape[2], 2))
gains = self.rng.normal(1, 0.1, size=(20, stack_copy.data.shape[2], 2))
tip_tilt = self.rng.normal(0, 0.1, size=(20, self.stack.data.shape[2], 2))
phs_gains = np.array(
[
np.exp(1j * tip_tilt * (self.antpos[ant2] - self.antpos[ant1])[0])
Expand Down Expand Up @@ -195,8 +196,8 @@ def test_baseline_fully_flagged(self):
auto_stack_copy = self.auto_stack.copy()
auto_stack_copy.data = self.auto_stack.data.copy()
auto_stack_copy.flags = self.auto_stack.flags.copy()
gains = np.random.normal(1, 0.1, size=(20, stack_copy.data.shape[2], 2))
tip_tilt = np.random.normal(0, 0.1, size=(20, self.stack.data.shape[2], 2))
gains = self.rng.normal(1, 0.1, size=(20, stack_copy.data.shape[2], 2))
tip_tilt = self.rng.normal(0, 0.1, size=(20, self.stack.data.shape[2], 2))
phs_gains = np.array(
[
np.exp(1j * tip_tilt * (self.antpos[ant2] - self.antpos[ant1])[0])
Expand Down

0 comments on commit 04fa8d3

Please sign in to comment.