def test_isowidths(self): """check ConstantPeakWidth properties bisowidth, uisowidth. """ from numpy import pi cnpw = self.pwconst dwpw = DebyeWallerPeakWidth() bnds = self._genbonds(1, 2) w0 = dwpw.calculate(bnds) cnpw.uisowidth = self.tio2stru[[0, -1]].Uisoequiv.mean() self.assertAlmostEqual(w0, cnpw.calculate(bnds), 12) self.assertAlmostEqual(cnpw.bisowidth, 8 * pi**2 * cnpw.uisowidth, 12) return
class TestDebyeWallerPeakWidth(unittest.TestCase): def setUp(self): self.pwm = DebyeWallerPeakWidth() return def test_type(self): """check DebyeWallerPeakWidth.type """ self.assertEqual('debye-waller', self.pwm.type()) self.assertEqual(0, len(self.pwm._namesOfDoubleAttributes())) return def test_pickling(self): """check pickling of DebyeWallerPeakWidth class. """ self.assertEqual('debye-waller', self.pwm.type()) pwm = self.pwm pwm2 = cPickle.loads(cPickle.dumps(pwm)) self.assertEqual(DebyeWallerPeakWidth, type(pwm2)) return
def setUp(self): self.pwm = DebyeWallerPeakWidth() return