예제 #1
0
 def test_type(self):
     """check PeakWidthModel.type
     """
     # this is a virtual method in the base class
     self.assertRaises(RuntimeError, PeakWidthModel().type)
     self.assertEqual('constant', self.pwconst.type())
     return
예제 #2
0
 def setUp(self):
     self.pwconst = PeakWidthModel.createByType('constant')
     self.pwconst.width = 2
     if self.tio2stru is None:
         self.tio2stru = loadDiffPyStructure('rutile.cif')
         self.tio2adpt = createStructureAdapter(self.tio2stru)
     return
예제 #3
0
 def setUp(self):
     self.pwconst = PeakWidthModel.createByType('constant')
     self.pwconst.width = 2
     if self.tio2stru is None:
         self.tio2stru = loadDiffPyStructure('rutile.cif')
         self.tio2adpt = createStructureAdapter(self.tio2stru)
     return
예제 #4
0
 def test_maxWidth(self):
     """check PeakWidthModel.maxWidth()
     """
     self.assertRaises(RuntimeError,
                       PeakWidthModel().maxWidth, self.tio2adpt, 0, 10)
     self.assertEqual(2.0, self.pwconst.maxWidth(self.tio2adpt, 0, 10))
     self.assertEqual(2.0, self.pwconst.maxWidth(self.tio2stru, 0, 10))
     return
예제 #5
0
 def test_getRegisteredTypes(self):
     """check PeakWidthModel.getRegisteredTypes
     """
     regtypes = PeakWidthModel.getRegisteredTypes()
     self.assertTrue(3 <= len(regtypes))
     self.assertTrue(regtypes.issuperset(
         ['constant', 'debye-waller', 'jeong']))
     return
예제 #6
0
 def test_getRegisteredTypes(self):
     """check PeakWidthModel.getRegisteredTypes
     """
     regtypes = PeakWidthModel.getRegisteredTypes()
     self.assertTrue(3 <= len(regtypes))
     self.assertTrue(
         regtypes.issuperset(['constant', 'debye-waller', 'jeong']))
     return
예제 #7
0
 def test_calculate(self):
     """check PeakWidthModel.calculate()
     """
     pwm = PeakWidthModel()
     bnds = self._genbonds(1, 2)
     self.assertRaises(RuntimeError, pwm.calculate, bnds)
     self.assertEqual(2.0, self.pwconst.calculate(bnds))
     return
예제 #8
0
 def test_calculate(self):
     """check PeakWidthModel.calculate()
     """
     pwm = PeakWidthModel()
     bnds = self.tio2adpt.createBondGenerator()
     self.assertRaises(RuntimeError, pwm.calculate, bnds)
     self.assertEqual(2.0, self.pwconst.calculate(bnds))
     return
예제 #9
0
 def test_create(self):
     """check PeakWidthModel.create
     """
     # this is a virtual method in the base class
     self.assertRaises(RuntimeError, PeakWidthModel().create)
     self.assertEqual('constant', self.pwconst.create().type())
     self.pwconst.width = 17
     self.assertEqual(0.0, self.pwconst.create().width)
     return
예제 #10
0
 def test_clone(self):
     """check PeakWidthModel.clone
     """
     # this is a virtual method in the base class
     self.assertRaises(RuntimeError, PeakWidthModel().clone)
     self.pwconst.width = 17
     pwc2 = self.pwconst.clone()
     self.assertEqual('constant', pwc2.type())
     self.assertEqual(17.0, pwc2.width)
     self.assertEqual(17.0, pwc2._getDoubleAttr('width'))
     return
예제 #11
0
 def test_ticker_override(self):
     """check PeakWidthModel.ticker override in a Python-derived class.
     """
     pwm = MyPWM()
     self.assertEqual(0, pwm.tcnt)
     et0 = pwm.ticker()
     self.assertEqual(1, pwm.tcnt)
     et1 = PeakWidthModel.ticker(pwm)
     self.assertEqual(1, pwm.tcnt)
     self.assertEqual(et0, et1)
     et0.click()
     self.assertEqual(et0, et1)
     # check that implicit ticker call from PDFCalculator is
     # handled by the Python ticker override.
     pc = PDFCalculator()
     pc.peakwidthmodel = pwm
     pc.ticker()
     self.assertEqual(2, pwm.tcnt)
     return
예제 #12
0
 def test_ticker_override(self):
     """check PeakWidthModel.ticker override in a Python-derived class.
     """
     pwm = MyPWM()
     self.assertEqual(0, pwm.tcnt)
     et0 = pwm.ticker()
     self.assertEqual(1, pwm.tcnt)
     et1 = PeakWidthModel.ticker(pwm)
     self.assertEqual(1, pwm.tcnt)
     self.assertEqual(et0, et1)
     et0.click()
     self.assertEqual(et0, et1)
     # check that implicit ticker call from PDFCalculator is
     # handled by the Python ticker override.
     pc = PDFCalculator()
     pc.peakwidthmodel = pwm
     pc.ticker()
     self.assertEqual(2, pwm.tcnt)
     return
예제 #13
0
 def ticker(self):
     self.tcnt += 1
     return PeakWidthModel.ticker(self)
예제 #14
0
 def __init__(self):
     PeakWidthModel.__init__(self)
     self._registerDoubleAttribute('pwmscale')
     return
예제 #15
0
 def __init__(self):
     PeakWidthModel.__init__(self)
     self._registerDoubleAttribute('pwmscale')
     return
예제 #16
0
 def ticker(self):
     self.tcnt += 1
     return PeakWidthModel.ticker(self)
예제 #17
0
 def tearDownClass(cls):
     assert "mypwm" not in PeakWidthModel.getRegisteredTypes()
     return