3.1.2.10. opengate.managers
¶
3.1.2.10.1. Module Contents¶
3.1.2.10.1.1. Classes¶
Manage all the Filters in the simulation |
|
Manage all the sources in the simulation. |
|
Manage all the actors in the simulation |
|
Everything related to the physics (lists, cuts, etc.) should be here. |
|
Store and manage a hierarchical list of geometrical volumes and associated materials. |
|
Main class that store a simulation. |
3.1.2.10.1.2. Functions¶
Dynamically create a class with the given PhysicList |
|
Create a class (not on object!) which: |
|
|
Init method of the dynamically created physics list class. |
|
3.1.2.10.1.3. Attributes¶
- opengate.managers.retrieve_g4_physics_constructor_class(g4_physics_constructor_class_name)[source]¶
Dynamically create a class with the given PhysicList Only possible if the class exist in g4
- opengate.managers.create_modular_physics_list_class(g4_physics_constructor_class_name)[source]¶
Create a class (not on object!) which: - inherit from g4.G4VModularPhysicsList - register a single G4 PhysicsConstructor (inherited from G4VPhysicsConstructor) - has the same name as this PhysicsConstructor
- opengate.managers.init_method(self, verbosity)[source]¶
Init method of the dynamically created physics list class. - call the init method of the super class (G4VModularPhysicsList) - Create and register the physics constructor (G4VPhysicsConstructor)
- class opengate.managers.SourceManager(simulation)[source]¶
Manage all the sources in the simulation. The function prepare_generate_primaries will be called during the main run loop to set the current time and source.
- class opengate.managers.PhysicsListManager(physics_manager, *args, **kwargs)[source]¶
Bases:
opengate.base.GateObject
- class opengate.managers.PhysicsManager(simulation, *args, **kwargs)[source]¶
Bases:
opengate.base.GateObject
Everything related to the physics (lists, cuts, etc.) should be here.
- property enable_decay[source]¶
Properties to quickly enable decay.
Note that setting enable_decay to False means that the physics list default is used, i.e. it does not forcefully remove G4DecayPhysics from the physics list.
- _simulation_engine_closing()[source]¶
This function should be called from the simulation engine when it is closing to make sure that G4 references are set to None.
- dump_optical_surfaces()[source]¶
Prints each volume’s name and its associated surfaces’ details (surface name and connected volumes) from the volume_surfaces dictionary in a readable format.
- class opengate.managers.VolumeManager(simulation, *args, **kwargs)[source]¶
Bases:
opengate.base.GateObject
Store and manage a hierarchical list of geometrical volumes and associated materials. This tree will be converted into Geant4 Solid/PhysicalVolume/LogicalVolumes
- class opengate.managers.Simulation(name='simulation')[source]¶
Bases:
opengate.base.GateObject
Main class that store a simulation. It contains: - a set of global user parameters (SimulationUserInfo) - user parameters for Volume, Source, Actors and Filters, Physics - a list of g4 commands that will be set to G4 engine after the initialization
There is NO Geant4 engine here, it is only a set of parameters and options.
- add_g4_command_before_init(command)[source]¶
For the moment, only use it after runManager.Initialize
- _run_simulation_engine(start_new_process)[source]¶
Method that creates a simulation engine in a context (with …) and runs a simulation.
- Args:
- q (:obj: queue, optional)A queue object to which simulation output can be added if run in a subprocess.
The dispatching function needs to extract the output from the queue.
- start_new_process (bool, optional)A flag passed to the engine
so it knows if it is running in a subprocess.
- Returns:
:obj:SimulationOutput : The output of the simulation run.
- voxelize_geometry(extent='auto', spacing=(3, 3, 3), margin=0, filename=None, return_path=False)[source]¶
Create a voxelized three-dimensional representation of the simulation geometry.
The user can specify the sub-portion (a rectangular box) of the simulation which is to be extracted.
- Args:
- extentBy default (‘auto’), GATE automatically determines the sub-portion
to contain all volumes of the simulation. Alternatively, extent can be either a tuple of 3-vectors indicating the two diagonally opposite corners of the box-shaped sub-portion of the geometry to be extracted, or a volume or list volumes. In the latter case, the box is automatically determined to contain the volume(s).
spacing (tuple) : The voxel spacing in x-, y-, z-direction. margin : Width (in voxels) of the additional margin around the extracted box-shaped sub-portion
indicated by extent.
- filename (str, optional)The filename/path to which the voxelized image and labels are written.
Suffix added automatically. Path can be relative to the global output directory of the simulation.
return_path (bool) : Return the absolute path where the voxelixed image was written?
- Returns:
- dict, itk image, (path)A dictionary containing the label to volume LUT; the voxelized geoemtry;
optionally: the absolute path where the image was written, if applicable.
- initialize_source_before_g4_engine()[source]¶
Some sources need to perform computation once everything is defined in user_info but before the initialization of the G4 engine starts. This can be done via this function.
- _get_voxelized_geometry(extent, spacing, margin)[source]¶
Private method which returns a voxelized image of the simulation geometry given the extent, spacing and margin.
The voxelization does not check which volume is voxelized. Every voxel will be assigned an ID corresponding to the material at this position in the world.