Пример #1
0
 def test_trivial(self):
     """ Test that the lorentz factor for 0 kV is unity """
     self.assertEqual(lorentz(0), 1)
Пример #2
0
 def test_range(self):
     """ Test that lorentz factor is always in the range [1, infty) """
     kv = np.linspace(0, 1e6, num=256)
     factors = lorentz(kv)
     self.assertTrue(np.all(np.greater_equal(factors, 1)))
Пример #3
0
def test_lorentz_trivial():
    """ Test that the lorentz factor for 0 kV is unity """
    assert lorentz(0) == 1
Пример #4
0
 def test_vectorized(self):
     """ Test lorentz() on an array of energies """
     kV = np.zeros((128, ), dtype=np.float)
     self.assertTrue(np.allclose(lorentz(kV), np.ones_like(kV)))
Пример #5
0
def test_lorentz_vectorized():
    """ Test lorentz() on an array of energies """
    kV = np.zeros((128, ), dtype=float)
    assert np.allclose(lorentz(kV), np.ones_like(kV))