Skip to content

Commit

Permalink
fixed some tests`
Browse files Browse the repository at this point in the history
	modified:   tests/test_pspecdata.py
	modified:   tests/test_utils.py
  • Loading branch information
nkern committed Apr 5, 2018
1 parent 900d408 commit 3b9bd8c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions hera_pspec/tests/test_pspecdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,21 +441,21 @@ def test_rephase_to_dst(self):
ds = pspecdata.PSpecData(dsets=[uvd1, uvd2], wgts=[None, None])
# get normal pspec
bls = [(37, 39)]
pspecs1, pairs1 = ds.pspec(bls)
pspecs1, pairs1 = ds.pspec(bls, bls, 0, 1)
# rephase and get pspec
ds.rephase_to_dset(0)
pspecs2, pairs2 = ds.pspec(bls)
pspecs2, pairs2 = ds.pspec(bls, bls, 0, 1)
# check overall coherence has increased
nt.assert_true(np.mean(np.abs(pspecs2[0] / pspecs1[0])) > 1.01)

# null test: check nothing changes when dsets contain same UVData object
ds = pspecdata.PSpecData(dsets=[uvd1, uvd1], wgts=[None, None])
# get normal pspec
bls = [(37, 39)]
pspecs1, pairs1 = ds.pspec(bls)
pspecs1, pairs1 = ds.pspec(bls, bls, 0, 1)
# rephase and get pspec
ds.rephase_to_dset(0)
pspecs2, pairs2 = ds.pspec(bls)
pspecs2, pairs2 = ds.pspec(bls, bls, 0, 1)
nt.assert_true(np.isclose(np.abs(pspecs2/pspecs1), 1.0).min())

def test_units(self):
Expand Down Expand Up @@ -514,7 +514,7 @@ def test_pspec(self):
little_h=True, exclude_conjugated_blpairs=False, exclude_auto_bls=False,
verbose=False)
nt.assert_true(((0, 24, 37, 'XX'), (1, 24, 37, 'XX')) in pairs)
nt.assert_equal(len(pairs), 62)
nt.assert_equal(len(pairs), 63)
pspec, pairs = ds.pspec(red_bls, red_bls, 0, 1, input_data_weight='identity', norm='I', taper='none',
little_h=True, exclude_conjugated_blpairs=True, exclude_auto_bls=True,
verbose=False)
Expand Down
6 changes: 3 additions & 3 deletions hera_pspec/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ def test_cov():
nt.assert_equal(cov.shape, (60, 60))
nt.assert_equal(cov.dtype, np.complex)
# test exception
nt.assert_raises(TypeError, cov, d1, w1.astype(np.complex))
nt.assert_raises(TypeError, cov, d1, w1, d2=d2, w2=w2.astype(np.real))
nt.assert_raises(TypeError, utils.cov, d1, w1*1j)
nt.assert_raises(TypeError, utils.cov, d1, w1, d2=d2, w2=w2*1j)
w1 *= -1.0
nt.assert_raises(TypeError, cov, d1, w1)
nt.assert_raises(ValueError, utils.cov, d1, w1)


0 comments on commit 3b9bd8c

Please sign in to comment.