Skip to content

Commit

Permalink
updated tests given new beam files
Browse files Browse the repository at this point in the history
  • Loading branch information
nkern committed Jun 29, 2018
1 parent 08c114a commit 13bd781
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions hera_pspec/tests/test_noise.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Test_Sensitivity(unittest.TestCase):

def setUp(self):
self.cosmo = conversions.Cosmo_Conversions()
self.beam = pspecbeam.PSpecBeamUV(os.path.join(DATA_PATH, 'HERA_NF_dipole_power.beamfits'))
self.beam = pspecbeam.PSpecBeamUV(os.path.join(DATA_PATH, 'HERA_NF_pstokes_power.beamfits'))
self.sense = noise.Sensitivity(beam=self.beam, cosmo=self.cosmo)

def tearDown(self):
Expand Down Expand Up @@ -57,7 +57,7 @@ def test_calc_P_N(self):
t_int = 10.7
P_N = self.sense.calc_P_N(Tsys, t_int, Ncoherent=1, Nincoherent=1, form='Pk')
nt.assert_true(isinstance(P_N, (float, np.float)))
nt.assert_true(np.isclose(P_N, 906609626029.72791))
nt.assert_true(np.isclose(P_N, 908472312787.53491))
# calculate DelSq
Dsq = self.sense.calc_P_N(Tsys, t_int, k=k, Ncoherent=1, Nincoherent=1, form='DelSq')
nt.assert_equal(Dsq.shape, (10,))
Expand Down
12 changes: 6 additions & 6 deletions hera_pspec/tests/test_pspecdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,14 +619,14 @@ def test_Jy_to_mK(self):

# test vis_units no Jansky
uvd2 = copy.deepcopy(uvd)
uvd2.polarization_array[0] = 1
uvd2.polarization_array[0] = -6
uvd2.vis_units = 'UNCALIB'
ds = pspecdata.PSpecData(dsets=[copy.deepcopy(uvd), copy.deepcopy(uvd2)],
wgts=[None, None], beam=self.bm)
ds.Jy_to_mK()
nt.assert_equal(ds.dsets[0].vis_units, "mK")
nt.assert_equal(ds.dsets[1].vis_units, "UNCALIB")
nt.assert_not_equal(ds.dsets[0].get_data(24, 25, 'xx')[30, 30], ds.dsets[1].get_data(24, 25, 'pI')[30, 30])
nt.assert_not_equal(ds.dsets[0].get_data(24, 25, 'xx')[30, 30], ds.dsets[1].get_data(24, 25, 'yy')[30, 30])

def test_trim_dset_lsts(self):
fname = os.path.join(DATA_PATH, "zen.2458042.17772.xx.HH.uvXA")
Expand Down Expand Up @@ -804,12 +804,12 @@ def test_normalization(self):
cosmo = conversions.Cosmo_Conversions()

# Set to mK scale
d1.data_array *= beam.Jy_to_mK(freqs)[None, None, :, None]
d2.data_array *= beam.Jy_to_mK(freqs)[None, None, :, None]
d1.data_array *= beam.Jy_to_mK(freqs, pol='XX')[None, None, :, None]
d2.data_array *= beam.Jy_to_mK(freqs, pol='XX')[None, None, :, None]

# Compare using no taper
OmegaP = beam.power_beam_int()
OmegaPP = beam.power_beam_sq_int()
OmegaP = beam.power_beam_int(pol='XX')
OmegaPP = beam.power_beam_sq_int(pol='XX')
OmegaP = interp1d(beam.beam_freqs/1e6, OmegaP)(freqs/1e6)
OmegaPP = interp1d(beam.beam_freqs/1e6, OmegaPP)(freqs/1e6)
NEB = 1.0
Expand Down
2 changes: 1 addition & 1 deletion hera_pspec/tests/test_uvpspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def test_compute_scalar(self):
uvp = copy.deepcopy(self.uvp)
# test basic execution
s = uvp.compute_scalar(0, 'xx', num_steps=1000, noise_scalar=False)
nt.assert_almost_equal(s/552336586.23970914, 1.0, places=5)
nt.assert_almost_equal(s/553995277.90425551, 1.0, places=5)
# test execptions
del uvp.OmegaP
nt.assert_raises(AssertionError, uvp.compute_scalar, 0, -5)
Expand Down

0 comments on commit 13bd781

Please sign in to comment.