def test_nosegfault(self): i = _O.RedundantInfo() for k in [ 'bl1dmatrix', 'bl2d', 'bltoubl', 'nAntenna', 'ublcount', 'ublindex' ]: i.__getattribute__(k)
def test_getset_float2d(self): i = _O.RedundantInfo() floats = np.array([[1, 2], [4, 5]], dtype=np.float32) for k in ['degenM', 'AtAi', 'BtBi']: #,'AtAiAt','BtBiBt','PA','PB','ImPA','ImPB']: i.__setattr__(k, floats) self.assertTrue(np.all(i.__getattribute__(k) == floats))
def test_readredundantinfo(self): i = _O.RedundantInfo() i.readredundantinfo( os.path.dirname(os.path.realpath(__file__)) + '/../doc/redundantinfo_PSA32.txt') self.assertEqual(i.nAntenna, 32) self.assertEqual(i.subsetant.shape, (32, ))
def test_getset(self): i = _O.RedundantInfo() i.nAntenna = 3 self.assertEqual(i.nAntenna, 3) i.nUBL = 3 self.assertEqual(i.nUBL, 3) i.nCross = 3 self.assertEqual(i.nCross, 3)
def test_getset_int1d(self): i = _O.RedundantInfo() ints = np.array([1, 2, 3], dtype=np.int32) for k in [ 'subsetant', 'subsetbl', 'bltoubl', 'reversed', 'reversedauto', 'autoindex', 'crossindex', 'ublcount' ]: i.__setattr__(k, ints) self.assertTrue(np.all(i.__getattribute__(k) == ints))
def test_getset(self): i = _O.RedundantInfo() i.nAntenna = 3 self.assertEqual(i.nAntenna, 3) ublcount = np.array([2, 2, 3], dtype=np.int32) i.ublcount = ublcount self.assertTrue(np.all(i.ublcount == ublcount)) ublindex = np.array([15, 16, 4, 3, 2, 1, 0], dtype=np.int32) i.ublindex = ublindex self.assertTrue(np.all(i.ublindex == ublindex))
def test_getset_ublindex(self): ublcount = np.array([2,1], dtype=np.int32) ublindex = np.array([0, 2, 1], dtype=np.int32) i = _O.RedundantInfo() self.assertEqual(i.ublindex.size, 0) def f(val): i.ublindex = val self.assertRaises(ValueError, f, ublindex) # gotta set ublcount first i.ublcount = ublcount i.ublindex = ublindex self.assertTrue(np.all(i.ublindex == ublindex)) self.assertRaises(ValueError, f, ublindex.reshape((1,3))) self.assertRaises(ValueError, f, ublindex.astype(np.float)) self.assertRaises(ValueError, f, ublindex[:-1]) self.assertRaises(ValueError, f, ublindex.reshape((3,1)))
def test_getset_int2d(self): i = _O.RedundantInfo() ints = np.array([[1, 2, 3], [4, 5, 6]], dtype=np.int32) for k in ['bl2d', 'bl1dmatrix']: #,'A','B','Atsparse']: i.__setattr__(k, ints) self.assertTrue(np.all(i.__getattribute__(k) == ints))
def test_getset_int1d(self): i = _O.RedundantInfo() ints = np.array([1, 2, 3], dtype=np.int32) for k in ['bltoubl', 'ublcount']: i.__setattr__(k, ints) self.assertTrue(np.all(i.__getattribute__(k) == ints))
def setUp(self): self.i = _O.RedundantInfo() self.i.readredundantinfo( os.path.dirname(os.path.realpath(__file__)) + '/../doc/redundantinfo_PSA32.txt')