def setUp(self): TestCase.setUp(self) self.geo = PenelopeGeometry('Test Geometry') surface1 = zplane(1e-10) surface2 = zplane(-1e-3) surface3 = cylinder(1e-2) surface4 = xplane(0.0) mat1 = PenelopeMaterial.pure(29) self.module1 = Module(self.geo, mat1) self.module1.add_surface(surface1, SIDEPOINTER_NEGATIVE) self.module1.add_surface(surface2, SIDEPOINTER_POSITIVE) self.module1.add_surface(surface3, SIDEPOINTER_NEGATIVE) self.module1.add_surface(surface4, SIDEPOINTER_POSITIVE) self.geo.modules.add(self.module1) mat2 = PenelopeMaterial.pure(30) self.module2 = Module(self.geo, mat2) self.module2.add_surface(surface1, SIDEPOINTER_NEGATIVE) self.module2.add_surface(surface2, SIDEPOINTER_POSITIVE) self.module2.add_surface(surface3, SIDEPOINTER_NEGATIVE) self.module2.add_module(self.module1) self.geo.modules.add(self.module2) self.geo.tilt_rad = radians(45)
def setUp(self): TestCase.setUp(self) self.geo = PenelopeGeometry('Test Geometry') surface1 = zplane(1e-10) surface2 = zplane(-1e-3) surface3 = cylinder(1e-2) surface4 = xplane(0.0) mat1 = PenelopeMaterial.pure(29) self.module1 = Module(self.geo, mat1) self.module1.add_surface(surface1, SIDEPOINTER_NEGATIVE) self.module1.add_surface(surface2, SIDEPOINTER_POSITIVE) self.module1.add_surface(surface3, SIDEPOINTER_NEGATIVE) self.module1.add_surface(surface4, SIDEPOINTER_POSITIVE) self.geo.modules.add(self.module1) mat2 = PenelopeMaterial.pure(30) self.module2 = Module(self.geo, mat2) self.module2.add_surface(surface1, SIDEPOINTER_NEGATIVE) self.module2.add_surface(surface2, SIDEPOINTER_POSITIVE) self.module2.add_surface(surface3, SIDEPOINTER_NEGATIVE) self.module2.add_module(self.module1) self.geo.modules.add(self.module2) self.geo.tilt_rad = radians(45)
def setUp(self): TestCase.setUp(self) intforce = InteractionForcing(ELECTRON, HARD_BREMSSTRAHLUNG_EMISSION, -4) mat1 = PenelopeMaterial.pure(29, interaction_forcings=[intforce], maximum_step_length_m=1e4) mat1._index = 1 mat2 = VACUUM mat2._index = 0 surface1 = SurfaceImplicit() surface1._index = 0 surface2 = SurfaceImplicit() surface2._index = 1 self.module2 = Module(None, mat2) self.module2._index = 1 self.module1 = Module(None, mat1, 'Test') self.module1.add_surface(surface1, -1) self.module1.add_surface(surface2, 1) self.module1.add_module(self.module2) self.module1.rotation.phi_rad = radians(180) self.module1.shift.z_m = -1e3 self.module1._index = 0 self.materials_lookup = {0: mat2, 1: mat1} self.surfaces_lookup = {0: surface1, 1: surface2} self.modules_lookup = {0: self.module1, 1: self.module2}
def setUp(self): TestCase.setUp(self) intforce = InteractionForcing(ELECTRON, HARD_BREMSSTRAHLUNG_EMISSION, -4) mat1 = PenelopeMaterial.pure(29, interaction_forcings=[intforce], maximum_step_length_m=1e4) mat1._index = 1 mat2 = VACUUM mat2._index = 0 surface1 = SurfaceImplicit() surface1._index = 0 surface2 = SurfaceImplicit() surface2._index = 1 self.module2 = Module(None, mat2) self.module2._index = 1 self.module1 = Module(None, mat1, 'Test') self.module1.add_surface(surface1, -1) self.module1.add_surface(surface2, 1) self.module1.add_module(self.module2) self.module1.rotation.phi_rad = radians(180) self.module1.shift.z_m = -1e3 self.module1._index = 0 self.materials_lookup = {0: mat2, 1: mat1} self.surfaces_lookup = {0: surface1, 1: surface2} self.modules_lookup = {0: self.module1, 1: self.module2}
def testinteraction_forcing(self): ops = Options() ops.beam.energy_eV = 30e3 intfor = InteractionForcing(ELECTRON, HARD_ELASTIC, -40) ops.geometry.material = PenelopeMaterial.pure(29, interaction_forcings=[intfor]) ops.detectors['det1'] = TimeDetector() ops.limits.add(TimeLimit(100)) opss = self.c.convert(ops) self.e.export(opss[0], self.tmpdir)
def testinteraction_forcing(self): ops = Options() ops.beam.energy_eV = 30e3 intfor = InteractionForcing(ELECTRON, HARD_ELASTIC, -40) ops.geometry.material = PenelopeMaterial.pure( 29, interaction_forcings=[intfor]) ops.detectors['det1'] = TimeDetector() ops.limits.add(TimeLimit(100)) opss = self.c.convert(ops) self.e.export(opss[0], self.tmpdir)
def test_photon_depth_detector(self): # Create ops = Options(name='test1') ops.beam.energy_eV = 30e3 ops.geometry.body.material = PenelopeMaterial.pure(29) ops.detectors['prz'] = \ PhotonDepthDetector((radians(0), radians(90)), (0, radians(360.0)), 500, [Transition(29, siegbahn='Ka1')]) ops.limits.add(TimeLimit(100)) # Export opss = self.c.convert(ops) self.e.export(opss[0], self.tmpdir)
def test_photon_depth_detector(self): # Create ops = Options(name='test1') ops.beam.energy_eV = 30e3 ops.geometry.body.material = PenelopeMaterial.pure(29) ops.detectors['prz'] = \ PhotonDepthDetector((radians(0), radians(90)), (0, radians(360.0)), 500, [Transition(29, siegbahn='Ka1')]) ops.limits.add(TimeLimit(100)) # Export opss = self.c.convert(ops) self.e.export(opss[0], self.tmpdir)
def testexport(self): # Create ops = Options(name='test1') ops.beam.energy_eV = 30e3 ops.geometry.body.material = PenelopeMaterial.pure(29) ops.detectors['x-ray'] = \ PhotonIntensityDetector((radians(35), radians(45)), (0, radians(360.0))) ops.detectors['spectrum'] = \ PhotonSpectrumDetector((radians(35), radians(45)), (0, radians(360.0)), 500, (0, 1000)) ops.detectors['prz'] = \ PhotonDepthDetector((radians(0), radians(90)), (0, radians(360.0)), 500) ops.limits.add(TimeLimit(100)) ops.limits.add(UncertaintyLimit(Transition(29, siegbahn='Ka1'), 'x-ray', 0.05)) # Export opss = self.c.convert(ops) self.e.export(opss[0], self.tmpdir)
def testexport(self): # Create ops = Options(name='test1') ops.beam.energy_eV = 30e3 ops.geometry.body.material = PenelopeMaterial.pure(29) ops.detectors['x-ray'] = \ PhotonIntensityDetector((radians(35), radians(45)), (0, radians(360.0))) ops.detectors['spectrum'] = \ PhotonSpectrumDetector((radians(35), radians(45)), (0, radians(360.0)), 500, (0, 1000)) ops.detectors['prz'] = \ PhotonDepthDetector((radians(0), radians(90)), (0, radians(360.0)), 500) ops.limits.add(TimeLimit(100)) ops.limits.add( UncertaintyLimit(Transition(29, siegbahn='Ka1'), 'x-ray', 0.05)) # Export opss = self.c.convert(ops) self.e.export(opss[0], self.tmpdir)
def testpure(self): m = PenelopeMaterial.pure(29) self.assertEqual('Copper', str(m)) self.assertTrue(29 in m.composition) self.assertAlmostEqual(1.0, m.composition[29], 4) self.assertAlmostEqual(8.96, m.density_kg_m3 / 1000.0, 4) self.assertAlmostEqual(50, m.absorption_energy_eV[ELECTRON], 4) self.assertAlmostEqual(50, m.absorption_energy_eV[PHOTON], 4) self.assertAlmostEqual(50, m.absorption_energy_eV[POSITRON], 4) self.assertAlmostEqual(0.0, m.elastic_scattering[0], 4) self.assertAlmostEqual(0.0, m.elastic_scattering[1], 4) self.assertAlmostEqual(50.0, m.cutoff_energy_inelastic_eV, 4) self.assertAlmostEqual(50.0, m.cutoff_energy_bremsstrahlung_eV, 4) self.assertEqual(0, len(m.interaction_forcings)) self.assertAlmostEqual(1e20, m.maximum_step_length_m, 4)