Example #1
0
 def testDistanceKappa(self):
     R = numpy.linspace(5, 6, 1100)
     kappa = [ 2. / 3 ] * 1100
     weights = [ 1. ] * 1100
     tm = DistanceKappaTransferMatrix(20, 11, 5, self.constant5000Burstgen, 5.475, R, kappa, weights)
     tm.generateMatrix()
     self.assertEqual(tm.getMatrix().shape, (20, 11))
     self.assertEqual(tm.RRange[0], 5)
     self.assertEqual(tm.RRange[1], 6)
     self.assertEqual(tm.getMatrix()[9][5], 1.)
Example #2
0
 def testGlobalVsGlobal(self):
     R = numpy.linspace(5.05, 5.95, 20)
     kappa = [ 2. / 3 ] * 20
     weights = [ 1. ] * 20
     bursts = 500
     tm = DistanceKappaTransferMatrix(20, 11, bursts, self.constant5000Burstgen, 5.475, R, kappa, weights, RRange = (5, 6))
     tm.generateMatrix()
     self.assertEqual(tm.RRange[0], 5)
     self.assertEqual(tm.RRange[1], 6)
     self.assertAlmostEqual(tm.getMatrix()[9][5], 1., delta = 0.01)
     tmref = GlobalAVGKappaTransferMatrix(20, 11, bursts, self.constant5000Burstgen, 5.475, [5, 6])
     tmref2 = GlobalAVGKappaTransferMatrix(20, 11, bursts, self.constant5000Burstgen, 5.475, [5, 6])
     self.assertMatrixAlmostEqual(tmref2.getMatrix(), tmref.getMatrix(), delta = 0.05)