Exemplo n.º 1
0
 def test_trivial(self):
     """ Test that the lorentz factor for 0 kV is unity """
     self.assertEqual(lorentz(0), 1)
Exemplo n.º 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)))
Exemplo n.º 3
0
def test_lorentz_trivial():
    """ Test that the lorentz factor for 0 kV is unity """
    assert lorentz(0) == 1
Exemplo n.º 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)))
Exemplo n.º 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))