Пример #1
0
    def setUp(self):
        unittest.TestCase.setUp(self)

        iterator_class = Heinrich1972Iterator
        convergor_class = CompositionConvergor
        calculator_class = SimpleCalculator
        worker_class = Worker

        options = Options('PAP')
        options.beam.energy_eV = 20000
        options.limits.add(ShowersLimit(100))

        detector = PhotonIntensityDetector((radians(50), radians(55)),
                                           (0.0, radians(360.0)))

        self.m = Measurement(options, options.geometry.body, detector)
        self.m.add_kratio(Ka(29), 0.2470)
        self.m.add_rule(ElementByDifferenceRule(79))

        self.outputdir = tempfile.mkdtemp()

        self.runner = Runner(worker_class,
                             iterator_class,
                             convergor_class,
                             calculator_class,
                             self.outputdir,
                             limit=0.1)
Пример #2
0
class TestElementByDifferenceRule(TestCase):
    def setUp(self):
        TestCase.setUp(self)

        self.rule = ElementByDifferenceRule(79)

    def tearDown(self):
        TestCase.tearDown(self)

    def testskeleton(self):
        self.assertTrue(True)

    def testupdate(self):
        composition = {29: 0.4}
        self.rule.update(composition)

        self.assertAlmostEqual(0.4, composition[29], 4)
        self.assertAlmostEqual(0.6, composition[79], 4)
Пример #3
0
class TestElementByDifferenceRule(TestCase):

    def setUp(self):
        TestCase.setUp(self)

        self.rule = ElementByDifferenceRule(79)

    def tearDown(self):
        TestCase.tearDown(self)

    def testskeleton(self):
        self.assertTrue(True)

    def testupdate(self):
        composition = {29:0.4}
        self.rule.update(composition)

        self.assertAlmostEqual(0.4, composition[29], 4)
        self.assertAlmostEqual(0.6, composition[79], 4)
Пример #4
0
    def testadd_rule(self):
        self.m.add_rule(FixedElementRule(14, 0.5))

        self.assertTrue(self.m.has_rule(14))
        self.assertEqual(2, len(self.m.get_rules()))

        self.assertRaises(ValueError, self.m.add_rule,
                          ElementByDifferenceRule(92))
        self.assertRaises(ValueError, self.m.add_rule,
                          FixedElementRule(14, 0.1))
        self.assertRaises(ValueError, self.m.add_rule,
                          FixedElementRule(29, 0.1))
Пример #5
0
    def setUp(self):
        TestCase.setUp(self)

        options = Options('PAP')
        options.beam.energy_eV = 20000

        detector = PhotonIntensityDetector((radians(50.0), radians(55)),
                                           (0.0, radians(360.0)))

        self.m = Measurement(options, options.geometry.body, detector)

        self.m.add_kratio(Ka(29), 0.2470, 0.004)
        self.m.add_rule(ElementByDifferenceRule(79))
Пример #6
0
    def setUp(self):
        TestCase.setUp(self)

        self.rule = ElementByDifferenceRule(79)
Пример #7
0
    def setUp(self):
        TestCase.setUp(self)

        self.rule = ElementByDifferenceRule(79)