예제 #1
0
 def test_render(self):
     s = Sphere(10.0, 'Surface')
     src = Source('src', shape=s)
     ae(
         self, s.render(),
         '/gate/source/src/gps/type Surface\n/gate/source/src/gps/shape Sphere\n/gate/source/src/gps/radius 10.0 mm\n'
     )
예제 #2
0
 def test_without_policy(self):
     rdout = Readout()
     singles = Singles([rdout])
     ae(
         self, rdout.render(),
         '/gate/digitizer/Singles/insert readout\n/gate/digitizer/Singles/readout/setDepth  1\n'
     )
예제 #3
0
 def test_render_cylindrical_pet_wiki(self):
     p = ParticleGamma(halflife=1223, )
     a = AngularISO()
     src = Source('posiC11', p, 10000, a)
     ae(
         self, src.render(),
         '/gate/source/addSource posiC11\n/gate/source/posiC11/gps/particle gamma \n/gate/source/posiC11/setType backtoback\n/gate/source/posiC11/gps/monoenergy 511 keV\n/gate/source/posiC11/setForcedUnstableFlag true\n/gate/source/posiC11/setForcedHalfLife 1223 s\n/gate/source/posiC11/setActivity 10000 becquerel\n/gate/source/posiC11/gps/angtype iso\n/gate/source/posiC11/gps/mintheta 0 deg \n/gate/source/posiC11/gps/maxtheta 180 deg\n/gate/source/posiC11/gps/minphi   0 deg\n/gate/source/posiC11/gps/maxphi   360 deg\n\n'
     )
예제 #4
0
 def test_render(self):
     def standard_physics_list():
         return (PhotoElectric(), Compton(), RayleighScattering(),
                 ElectronIonisation(), Bremsstrahlung(), PositronAnnihilation(),
                 MultipleScattering('e-'), MultipleScattering('e+'))
     std_pl = standard_physics_list()
     ae(self, '\n'.join([p.render() for p in std_pl]),
        '/gate/physics/addProcess PhotoElectric\n/gate/physics/processes/PhotoElectric/setModel StandardModel\n/gate/physics/addProcess Compton\n/gate/physics/processes/Compton/setModel StandardModel\n/gate/physics/addProcess RayleighScattering\n/gate/physics/processes/RayleighScattering/setModel PenelopeModel\n/gate/physics/addProcess ElectronIonisation\n/gate/physics/processes/ElectronIonisation/setModel StandardModel e-\n/gate/physics/processes/ElectronIonisation/setModel StandardModel e+\n/gate/physics/addProcess Bremsstrahlung\n/gate/physics/processes/Bremsstrahlung/setModel StandardModel e-\n/gate/physics/processes/Bremsstrahlung/setModel StandardModel e+\n/gate/physics/addProcess PositronAnnihilation\n/gate/physics/addProcess MultipleScattering e-\n/gate/physics/addProcess MultipleScattering e+')
예제 #5
0
    def test_render(self):
        class DummyInput:
            name = 'finalcoin'

        sino = Sinogram('sinogram', DummyInput(), None, None, True, 1.8, 1.8,
                        True, True)
        ae(
            self, sino.render(),
            '/gate/output/sinogram/enable\n/gate/output/sinogram/setFileName  sinogram\n/gate/output/sinogram/setTangCrystalBlurring 1.8 mm\n/gate/output/sinogram/setAxialCrystalBlurring 1.8 mm\n/gate/output/sinogram/RawOutputEnable true\n/gate/output/sinogram/StoreDelayeds\n/gate/output/sinogram/StoreScatters\n/gate/output/sinogram/setInputDataName finalcoin\n'
        )
예제 #6
0
 def test_render(self):
     w = Box('world', Vec3(400.0, 400.0, 400.0, 'cm'))
     r = RepeaterLinear(5, Vec3(0.0, 3.2, 0.0, 'mm'))
     c = Box('crystal',
             Vec3(10.0, 10.0, 10.0, 'mm'),
             'Air',
             w,
             repeaters=[r])
     ae(
         self, r.render(),
         '/gate/crystal/repeaters/insert          linear\n/gate/crystal/linear/setRepeatNumber        5  \n/gate/crystal/linear/setRepeatVector         0.0 3.2 0.0 mm \n'
     )
예제 #7
0
    def test_render_perfect_apd(self):
        class DummyVolume:
            def __init__(self, name):
                self.name = name

        crystal = DummyVolume('crystal')
        elec = DummyVolume('Electronics')
        s = SurfacePerfectAPD('Detection1', crystal, elec)
        ae(
            self, s.render(),
            '/gate/crystal/surfaces/name                           Detection1\n/gate/crystal/surfaces/insert                         Electronics\n/gate/crystal/surfaces/Detection1/setSurface          perfect_apd '
        )
예제 #8
0
 def test_render(self):
     w = Box('world', Vec3(400.0, 400.0, 400.0, 'cm'))
     r = RepeaterCubic(Vec3(1, 5, 5, None), Vec3(0.0, 3.2, 4.0, 'mm'))
     c = Box('crystal',
             Vec3(10.0, 10.0, 10.0, 'mm'),
             'Air',
             w,
             repeaters=[r])
     ae(
         self, r.render(),
         '/gate/crystal/repeaters/insert          cubicArray\n/gate/crystal/cubicArray/setRepeatNumberX        1  \n/gate/crystal/cubicArray/setRepeatNumberY        5  \n/gate/crystal/cubicArray/setRepeatNumberZ        5  \n/gate/crystal/cubicArray/setRepeatVector         0.0 3.2 4.0 mm \n'
     )
예제 #9
0
 def test_render(self):
     w = Box('world', Vec3(400.0, 400.0, 400.0, 'cm'))
     r = RepeaterRing(4)
     c = Box('crystal',
             Vec3(10.0, 10.0, 10.0, 'mm'),
             'Air',
             w,
             repeaters=[r])
     ae(
         self, r.render(),
         '/gate/crystal/repeaters/insert          ring\n/gate/crystal/ring/setRepeatNumber        4  \n'
     )
예제 #10
0
 def test_render_cartesianrepeater_from_shape(self):
     from dxl.shape.data import Box as Box_from_shape
     w = Box('world', Vec3(400.0, 400.0, 400.0, 'cm'))
     r = RepeaterCubic(cartesian_repeater=CartesianRepeater(
         prototype=Box_from_shape([10.0, 10.0, 10.0]),
         grids=[1, 5, 5],
         steps=[0.0, 3.5, 4.0]),
                       unit='mm')
     c = Box('crystal',
             Vec3(10.0, 10.0, 10.0, 'mm'),
             'Air',
             w,
             repeaters=[r])
     ae(
         self, r.render(),
         '/gate/crystal/repeaters/insert          cubicArray\n/gate/crystal/cubicArray/setRepeatNumberX        1  \n/gate/crystal/cubicArray/setRepeatNumberY        5  \n/gate/crystal/cubicArray/setRepeatNumberZ        5  \n/gate/crystal/cubicArray/setRepeatVector         0.0 3.5 4.0 mm \n'
     )
예제 #11
0
 def test_render_cartesianrepeater_from_shape(self):
     from dxl.shape.data import Box as Box_from_shape
     w = Box('world', Vec3(400.0, 400.0, 400.0, 'cm'))
     r = RepeaterLinear(linear_repeater=CartesianRepeater(
         prototype=Box_from_shape([10.0, 10.0, 10.0]),
         grids=[1, 5, 1],
         steps=[0.0, 3.5, 0.0]),
                        unit='mm')
     c = Box('crystal',
             Vec3(10.0, 10.0, 10.0, 'mm'),
             'Air',
             w,
             repeaters=[r])
     ae(
         self, r.render(),
         '/gate/crystal/repeaters/insert          linear\n/gate/crystal/linear/setRepeatNumber        5  \n/gate/crystal/linear/setRepeatVector         0.0 3.5 0.0 mm \n'
     )
예제 #12
0
 def test_sd(self):
     world = Box('world', Vec3(400.0, 400.0, 400.0, 'cm'))
     cylinder = Cylinder('cylindricalPET',
                         520.0,
                         399.0,
                         402.0,
                         material='Air',
                         mother=world,
                         position=Vec3(0.0, 0.0, 0.0, 'cm'),
                         unit='cm')
     rh = RepeaterRing(4)
     head = Box('head',
                Vec3(8, 32, 40, 'cm'),
                'Air',
                cylinder,
                Vec3(44.0, 0.0, 0.0, 'cm'),
                repeaters=[rh])
     rb = RepeaterCubic(Vec3(1, 20, 20), Vec3(0.0, 1.6, 2.0, 'cm'))
     block = Box('block',
                 Vec3(30, 16, 20, 'mm'),
                 'Air',
                 head,
                 position=Vec3(0.0, 0.0, 0.0, 'cm'),
                 repeaters=[rb])
     rc = RepeaterCubic(Vec3(1, 5, 5), Vec3(0.0, 3.2, 4.0, 'mm'))
     crystal = Box('crystal',
                   Vec3(30, 3.0, 3.8, 'mm'),
                   'Air',
                   block,
                   position=Vec3(0.0, 0.0, 0.0, 'cm'),
                   repeaters=[rc])
     lso = Box('LSO', Vec3(15, 3.0, 3.8), 'LSO', crystal,
               Vec3(-0.75, 0.0, 0.0, 'cm'))
     bgo = Box('BGO', Vec3(15, 3.0, 3.8), 'BGO', crystal,
               Vec3(0.75, 0.0, 0.0, 'cm'))
     system = CylindricalPET(head,
                             block,
                             crystal=crystal,
                             layer0=lso,
                             layer1=bgo)
     camera = Camera(system, [lso, bgo])
     ae(
         self, camera.render(),
         '/gate/systems/cylindricalPET/rsector/attach head\n/gate/systems/cylindricalPET/module/attach block\n/gate/systems/cylindricalPET/crystal/attach crystal\n/gate/systems/cylindricalPET/layer0/attach LSO\n/gate/systems/cylindricalPET/layer1/attach BGO\n/gate/LSO/attachCrystalSD\n/gate/BGO/attachCrystalSD'
     )
예제 #13
0
 def test_render_ringrepeater_from_shape(self):
     from dxl.shape.data import Box as Box_from_shape
     from dxl.shape.data import AXIS3_Z
     #from doufo.tensor import Vector
     w = Box('world', Vec3(400.0, 400.0, 400.0,
                           'cm'))  #Axis(Vector([0,0,1]))
     r = RepeaterRing(ring_repeater=RingRepeater(prototype=Box_from_shape(
         [10.0, 10.0, 10.0]),
                                                 steps=math.pi / 2,
                                                 num=4,
                                                 axis=AXIS3_Z))
     c = Box('crystal',
             Vec3(10.0, 10.0, 10.0, 'mm'),
             'Air',
             w,
             repeaters=[r])
     ae(
         self, r.render(),
         '/gate/crystal/repeaters/insert          ring\n/gate/crystal/ring/setRepeatNumber        4  \n'
     )
예제 #14
0
 def test_render_multiple(self):
     w = Box('world', Vec3(400.0, 400.0, 400.0, 'cm'))
     ecat = Cylinder('ecat', 442.0, 412.0, 155.2, material='Air', mother=w)
     r1 = RepeaterLinear(4, Vec3(0.0, 0.0, 38.8, 'mm'))
     r2 = RepeaterRing(72)
     block = Box('block',
                 Vec3(30.0, 35.8594, 38.7),
                 'Air',
                 position=Vec3(427.0, 0.0, 0.0, 'mm'),
                 mother=ecat,
                 repeaters=[r1, r2])
     rc = RepeaterCubic(Vec3(1, 8, 8), Vec3(0.0, 4.4942, 4.85, 'mm'))
     crystal = Box('crystal',
                   Vec3(30.0, 4.4, 4.75),
                   'BGO',
                   mother=block,
                   repeaters=[rc])
     ae(
         self, w.render(),
         '/gate/world/geometry/setXLength 400.0 cm\n/gate/world/geometry/setYLength 400.0 cm\n/gate/world/geometry/setZLength 400.0 cm\n/gate/world/daughters/name ecat\n/gate/world/daughters/insert cylinder\n/gate/ecat/geometry/setRmin 412.0 mm\n/gate/ecat/geometry/setRmax 442.0 mm\n/gate/ecat/geometry/setHeight 155.2 mm\n/gate/ecat/setMaterial Air\n/gate/ecat/daughters/name block\n/gate/ecat/daughters/insert box\n/gate/block/placement/setTranslation 427.0 0.0 0.0 mm\n/gate/block/geometry/setXLength 30.0 mm\n/gate/block/geometry/setYLength 35.8594 mm\n/gate/block/geometry/setZLength 38.7 mm\n/gate/block/setMaterial Air\n/gate/block/daughters/name crystal\n/gate/block/daughters/insert box\n/gate/crystal/geometry/setXLength 30.0 mm\n/gate/crystal/geometry/setYLength 4.4 mm\n/gate/crystal/geometry/setZLength 4.75 mm\n/gate/crystal/setMaterial BGO\n/gate/crystal/repeaters/insert cubicArray\n/gate/crystal/cubicArray/setRepeatNumberX 1\n/gate/crystal/cubicArray/setRepeatNumberY 8\n/gate/crystal/cubicArray/setRepeatNumberZ 8\n/gate/crystal/cubicArray/setRepeatVector 0.0 4.4942 4.85 mm\n/gate/block/repeaters/insert linear\n/gate/block/linear/setRepeatNumber 4\n/gate/block/linear/setRepeatVector 0.0 0.0 38.8 mm\n/gate/block/repeaters/insert ring\n/gate/block/ring/setRepeatNumber 72'
     )
예제 #15
0
    def test_render(self):
        world = Box('world', Vec3(400.0, 400.0, 400.0, 'cm'))
        cylinder = Cylinder('cylindricalPET', 52.0, 39.9, 40.2, material='Air',
                            mother=world, position=Vec3(0.0, 0.0, 0.0, 'cm'), unit='cm')
        head = Box('head', Vec3(8, 32, 40, 'cm'), 'Air',
                   cylinder, Vec3(44, 0, 0, 'cm'))
        block = Box('block', Vec3(30, 16, 20, 'mm'), 'Air', head)
        crystal = Box('crystal', Vec3(30, 3, 3.8, 'mm'), 'Air', block)
        lso = Box('LSO', Vec3(15, 3.0, 3.8), 'LSO',
                  crystal, Vec3(-0.75, 0.0, 0.0, 'cm'))
        bgo = Box('BGO', Vec3(15, 3.0, 3.8), 'BGO',
                  crystal, Vec3(0.75, 0.0, 0.0, 'cm'))
        phantom = Box('phantom', Vec3(10, 10, 10, 'cm'), 'Water', world)

        def standard_physics_list():
            return (PhotoElectric(), Compton(), RayleighScattering(),
                    ElectronIonisation(), Bremsstrahlung(), PositronAnnihilation(),
                    MultipleScattering('e-'), MultipleScattering('e+'))
        std_pl = standard_physics_list()
        cuts_list = [Cuts(lso, 10.0), Cuts(bgo, 10.0),
                     Cuts(phantom, 0.1, 0.01)]
        phys = Physics(std_pl, cuts_list)
        ae(self, phys.render(),
           '#=====================================================\n# PHYSICS\n#=====================================================\n\n/gate/physics/addProcess PhotoElectric\n/gate/physics/processes/PhotoElectric/setModel StandardModel\n\n/gate/physics/addProcess Compton\n/gate/physics/processes/Compton/setModel StandardModel\n\n/gate/physics/addProcess RayleighScattering\n/gate/physics/processes/RayleighScattering/setModel PenelopeModel\n\n/gate/physics/addProcess ElectronIonisation\n/gate/physics/processes/ElectronIonisation/setModel StandardModel e-\n/gate/physics/processes/ElectronIonisation/setModel StandardModel e+\n\n/gate/physics/addProcess Bremsstrahlung\n/gate/physics/processes/Bremsstrahlung/setModel StandardModel e-\n/gate/physics/processes/Bremsstrahlung/setModel StandardModel e+\n\n/gate/physics/addProcess PositronAnnihilation\n\n/gate/physics/addProcess MultipleScattering e-\n/gate/physics/addProcess MultipleScattering e+\n\n/gate/physics/processList Enabled\n/gate/physics/processList Initialized\n\n#=====================================================\n# CUTS\n#=====================================================\n\n/gate/physics/Gamma/SetCutInRegion      LSO 10.0 mm\n/gate/physics/Electron/SetCutInRegion   LSO 10.0 mm\n/gate/physics/Positron/SetCutInRegion   LSO 10.0 mm\n\n/gate/physics/Gamma/SetCutInRegion      BGO 10.0 mm\n/gate/physics/Electron/SetCutInRegion   BGO 10.0 mm\n/gate/physics/Positron/SetCutInRegion   BGO 10.0 mm\n\n\n/gate/physics/Gamma/SetCutInRegion      phantom 0.1 mm\n/gate/physics/Electron/SetCutInRegion   phantom 0.1 mm\n/gate/physics/Positron/SetCutInRegion   phantom 0.1 mm\n\n/gate/physics/SetMaxStepSizeInRegion    phantom 0.01 mm')
예제 #16
0
 def test_render(self):
     pe = PhotoElectric()
     ae(self, pe.render(),
        '/gate/physics/addProcess PhotoElectric\n/gate/physics/processes/PhotoElectric/setModel StandardModel\n')
예제 #17
0
 def test_render(self):
     ap = AcquisitionPeriod(0.0, 0.1, 0.1)
     ae(
         self, ap.render(),
         '/gate/application/setTimeStart  0.0 s\n/gate/application/setTimeStop  0.1 s\n/gate/application/setTimeSlice  0.1 s\n/gate/application/startDAQ\n'
     )
예제 #18
0
 def test_render(self):
     ms = MultipleScattering('e+')
     ae(self, ms.render(),
        '/gate/physics/addProcess MultipleScattering e+\n')
예제 #19
0
 def test_render(self):
     ei = ElectronIonisation()
     ae(self, ei.render(),
        '/gate/physics/addProcess ElectronIonisation\n/gate/physics/processes/ElectronIonisation/setModel StandardModel e-\n/gate/physics/processes/ElectronIonisation/setModel StandardModel e+\n')
예제 #20
0
 def test_render(self):
     v = Vec3(1, 2, 3)
     ae(self, v.render(), '1 2 3')
예제 #21
0
 def test_render_unit(self):
     v = Vec3(0.0, 0.0, 0.0, 'mm')
     ae(self, v.render(), '0.0 0.0 0.0 mm')
예제 #22
0
 def test_optical_gamma(self):
     mac = optical_gamma(sphere(0.1, Vec3(150.0, 0.0, 0.0, 'mm'))).render()
     ae(
         self, mac,
         '\n/gate/geometry/setMaterialDatabase    ./GateMaterials.db\n\n\n#=====================================================\n# GEOMETRY\n#=====================================================\n/gate/world/geometry/setXLength         400.0 cm\n/gate/world/geometry/setYLength         400.0 cm\n/gate/world/geometry/setZLength         400.0 cm\n\n/gate/world/daughters/name            OpticalSystem\n/gate/world/daughters/insert          box\n/gate/OpticalSystem/geometry/setXLength         400.0 cm\n/gate/OpticalSystem/geometry/setYLength         400.0 cm\n/gate/OpticalSystem/geometry/setZLength         400.0 cm\n/gate/OpticalSystem/setMaterial                 Air\n\n/gate/OpticalSystem/daughters/name            crystal\n/gate/OpticalSystem/daughters/insert          box\n/gate/crystal/placement/setTranslation    0.0 0.0 0.0 mm\n/gate/crystal/geometry/setXLength         30.0 mm\n/gate/crystal/geometry/setYLength         30.0 mm\n/gate/crystal/geometry/setZLength         30.0 mm\n/gate/crystal/setMaterial                 LYSO\n\n/gate/systems/OpticalSystem/crystal/attach   crystal\n\n/gate/crystal/attachCrystalSD\n\n\n\n\n\n#=====================================================\n# PHYSICS\n#=====================================================\n/gate/physics/addProcess PhotoElectric\n/gate/physics/processes/PhotoElectric/setModel StandardModel\n\n\n/gate/physics/addProcess Compton\n/gate/physics/processes/Compton/setModel StandardModel\n\n\n/gate/physics/addProcess RayleighScattering\n/gate/physics/processes/RayleighScattering/setModel PenelopeModel\n\n\n/gate/physics/addProcess ElectronIonisation\n/gate/physics/processes/ElectronIonisation/setModel StandardModel e-\n\n/gate/physics/processes/ElectronIonisation/setModel StandardModel e+\n\n\n/gate/physics/addProcess Bremsstrahlung\n/gate/physics/processes/Bremsstrahlung/setModel StandardModel e-\n\n/gate/physics/processes/Bremsstrahlung/setModel StandardModel e+\n\n\n/gate/physics/addProcess eMultipleScattering e+\n\n/gate/physics/addProcess eMultipleScattering e-\n\n/gate/physics/processList Enabled\n/gate/physics/processList Initialized\n\n\n#=====================================================\n# INITIALISATION\n#=====================================================\n/gate/run/initialize\n\n#=====================================================\n# SURFACES\n#=====================================================\n\n\n#=====================================================\n# DIGITIZER\n#=====================================================\n/gate/digitizer/Singles/insert opticaladder\n\n/gate/digitizer/Singles/insert readout\n/gate/digitizer/Singles/readout/setDepth  1\n\n#=====================================================\n# SOURCE\n#=====================================================\n/gate/source/addSource sphere_source\n/gate/source/sphere_source/gps/type Volume\n/gate/source/sphere_source/gps/shape Sphere\n/gate/source/sphere_source/gps/radius 0.1 mm \n\n# Placement\n/gate/source/sphere_source/gps/centre 150.0 0.0 0.0 mm \n/gate/source/sphere_source/gps/particle gamma \n/gate/source/sphere_source/gps/monoenergy 511 keV\n\n/gate/source/sphere_source/setActivity 1000 becquerel\n/gate/source/sphere_source/gps/angtype iso\n/gate/source/sphere_source/gps/mintheta 90 deg \n/gate/source/sphere_source/gps/maxtheta 90 deg\n/gate/source/sphere_source/gps/minphi   0 deg\n/gate/source/sphere_source/gps/maxphi   0 deg\n\n\n/gate/source/list\n\n\n#=====================================================\n# PARAMETER\n#=====================================================\n/gate/random/setEngineName MersenneTwister\n/gate/random/setEngineSeed auto\n\n/gate/output/root/enable\n/gate/output/root/setFileName optical\n/gate/output/root/setRootHitFlag 1\n/gate/output/root/setRootSinglesFlag 1\n\n\n\n/gate/application/setTotalNumberOfPrimaries 10000\n/gate/application/start\n\n\n\n'
     )
예제 #23
0
 def test_render(self):
     re = RandomEngine()
     ae(
         self, re.render(),
         '/gate/random/setEngineName JamesRandom\n/gate/random/setEngineSeed default\n'
     )
예제 #24
0
 def test_render(self):
     root = Root('result', 0, 1, 1)
     ae(
         self, root.render(),
         '/gate/output/root/enable\n/gate/output/root/setFileName  result\n/gate/output/root/setRootHitFlag    0\n/gate/output/root/setRootSinglesFlag    1\n/gate/output/root/setRootCoincidencesFlag    1\n'
     )
예제 #25
0
 def test_render(self):
     db = MaterialDatabaseLocal()
     ae(self, db.render(),
        "/gate/geometry/setMaterialDatabase    ./GateMaterials.db")