def test_Hz(self): """ Test the creation of a frequency quantity with units of Hz. """ q = quantity.Frequency(1.0, "Hz") self.assertAlmostEqual(q.value, 1. / (constants.c * 100.), delta=1e-17) self.assertAlmostEqual(q.value_si, 1. / (constants.c * 100.), delta=1e-17) self.assertEqual(q.units, "cm^-1")
def test_eV(self): """ Test the creation of a frequency quantity with units of eV. """ q = quantity.Frequency(1.0, "eV") self.assertAlmostEqual( q.value, constants.e / (constants.h * constants.c * 100.), 2) self.assertAlmostEqual(q.value_si, constants.e / (constants.h * constants.c * 100.), delta=1e-2) self.assertEqual(q.units, "cm^-1")
def test_K(self): """ Test the creation of a frequency quantity with units of K. """ q = quantity.Frequency(1.0, "K") self.assertAlmostEqual( q.value, constants.kB / (constants.h * constants.c * 100.), 6) self.assertAlmostEqual(q.value_si, constants.kB / (constants.h * constants.c * 100.), delta=1e-6) self.assertEqual(q.units, "cm^-1")
def frequency(self, value): self._frequency = quantity.Frequency(value)