Skip to content

Commit

Permalink
Debug test according to master
Browse files Browse the repository at this point in the history
  • Loading branch information
tbaudier committed Dec 14, 2023
1 parent 5f4a909 commit c994738
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 40 deletions.
1 change: 1 addition & 0 deletions opengate/tests/src/test069_rotation_DICOM_RT_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def add_alpha_source(sim, name, pos_Z, nb_part):
source.position.type = "box"
source.position.size = np.copy(plan_size)
source.direction.type = "momentum"
source.force_rotation = True
source.direction.momentum = [0, 0, -1]
source.activity = nb_part * Bq / ui.number_of_threads

Expand Down
66 changes: 26 additions & 40 deletions opengate/tests/src/test069_rotation_DICOM_RT_plan_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -809,49 +809,36 @@ def add_MLC(sim, name):
size = [1, int(0.25 * nb_leaf), 1]
tr_blocks = np.array([leaf_lenght, 2 * leaf_width + 2 * interleaf_gap, 0])

leaf_p_1.rotation = None
leaf_p_1.translation = None
MLC_p_1 = gate.geometry.utility.repeat_array(leaf_p_1.name, size, tr_blocks)
leaf_p_1.repeat = MLC_p_1

leaf_o_1.rotation = None
leaf_o_1.translation = None
MLC_o_1 = gate.geometry.utility.repeat_array(leaf_o_1.name, size, tr_blocks)
leaf_o_1.repeat = MLC_o_1

leaf_p_2.rotation = None
leaf_p_2.translation = None
MLC_p_2 = gate.geometry.utility.repeat_array(leaf_p_2.name, size, tr_blocks)
leaf_p_2.repeat = MLC_p_2

leaf_o_2.rotation = None
leaf_o_2.translation = None
MLC_o_2 = gate.geometry.utility.repeat_array(leaf_o_2.name, size, tr_blocks)
leaf_o_2.repeat = MLC_o_2
MLC_p_1, lut_p_1 = gate.geometry.utility.get_grid_repetition(
size, tr_blocks, start=None, return_lut=True
)
leaf_p_1.translation = MLC_p_1
print(lut_p_1)

MLC_o_1 = gate.geometry.utility.get_grid_repetition(size, tr_blocks)
leaf_o_1.translation = MLC_o_1

MLC_p_2 = gate.geometry.utility.get_grid_repetition(size, tr_blocks)
leaf_p_2.translation = MLC_p_2

MLC_o_2 = gate.geometry.utility.get_grid_repetition(size, tr_blocks)
leaf_o_2.translation = MLC_o_2

rot = Rotation.from_euler("Z", 180, degrees=True).as_matrix()
for i in range(len(MLC_p_1)):
MLC_p_1[i]["translation"] += np.array(
[-leaf_lenght / 2, leaf_width + interleaf_gap, 0]
)
MLC_o_1[i]["translation"] += np.array([-leaf_lenght / 2, 0, 0])
MLC_p_2[i]["translation"] += np.array(
[leaf_lenght / 2, leaf_width + interleaf_gap, 0]
)
MLC_o_2[i]["translation"] += np.array([leaf_lenght / 2, 0, 0])
# MLC_p_1[i]["rotation"] = rot
# MLC_o_1[i]["rotation"] = rot
# MLC_p_2[i]["rotation"] = rot
# MLC_o_2[i]["rotation"] = rot
#
MLC_p_1[i] += np.array([-leaf_lenght / 2, leaf_width + interleaf_gap, 0])
MLC_o_1[i] += np.array([-leaf_lenght / 2, 0, 0])
MLC_p_2[i] += np.array([leaf_lenght / 2, leaf_width + interleaf_gap, 0])
MLC_o_2[i] += np.array([leaf_lenght / 2, 0, 0])

MLC = []

for i in range(len(MLC_p_1)):
MLC.append(MLC_o_1[i])
MLC.append(MLC_p_1[i])
MLC.append({"translation": MLC_o_1[i], "name": leaf_o_1.name})
MLC.append({"translation": MLC_p_1[i], "name": leaf_p_1.name})
for i in range(len(MLC_p_2)):
MLC.append(MLC_o_2[i])
MLC.append(MLC_p_2[i])
MLC.append({"translation": MLC_o_2[i], "name": leaf_o_2.name})
MLC.append({"translation": MLC_p_2[i], "name": leaf_p_2.name})
return MLC


Expand Down Expand Up @@ -1473,7 +1460,7 @@ def init_simulation(
mat_database_path = "../../contrib/linacs/"
path_phsp = "/home/mjacquet/Documents"
path_data = "./"
sim.add_material_database(
sim.volume_manager.add_material_database(
mat_database_path + "modified_elekta_synergy_materials.db"
)
ui = sim.user_info
Expand Down Expand Up @@ -1508,9 +1495,8 @@ def init_simulation(
s = sim.add_actor("SimulationStatisticsActor", "Stats")
s.track_types_flag = True
# phys
p = sim.get_physics_user_info()
p.physics_list_name = "G4EmStandardPhysics_option3"
p.enable_decay = False
sim.physics_manager.physics_list_name = "G4EmStandardPhysics_option3"
sim.physics_manager.enable_decay = False

sim.physics_manager.global_production_cuts.gamma = 1 * mm
sim.physics_manager.global_production_cuts.electron = 1 * mm
Expand Down

0 comments on commit c994738

Please sign in to comment.