|
13 | 13 |
|
14 | 14 | from pyRadPlan.ct import CT |
15 | 15 | from pyRadPlan.stf import SteeringInformation |
16 | | -from pyRadPlan.machines import IonAccelerator, IonPencilBeamKernel, LateralCutOff |
| 16 | +from pyRadPlan.machines.particles import ( |
| 17 | + ParticleAccelerator, |
| 18 | + ParticlePencilBeamKernel, |
| 19 | + LateralCutOff, |
| 20 | +) |
17 | 21 | from pyRadPlan.cst import StructureSet |
18 | 22 | from ._base_pencilbeam import PencilBeamEngineAbstract |
19 | 23 |
|
@@ -183,7 +187,7 @@ def _init_bixel(self, curr_ray, k): |
183 | 187 | bixel["energy_ix"] = energy_ix |
184 | 188 |
|
185 | 189 | # Get the kernel for the current energy |
186 | | - tmp_machine = cast(IonAccelerator, self._machine) |
| 190 | + tmp_machine = cast(ParticleAccelerator, self._machine) |
187 | 191 | bixel["kernel"] = tmp_machine.get_kernel_by_index(energy_ix) |
188 | 192 |
|
189 | 193 | bixel["range_shifter"] = curr_ray["beamlets"][k]["range_shifter"] |
@@ -218,7 +222,7 @@ def _init_bixel(self, curr_ray, k): |
218 | 222 | return bixel |
219 | 223 |
|
220 | 224 | def _interpolate_kernels_in_depth(self, bixel): |
221 | | - kernel = cast(IonPencilBeamKernel, bixel["kernel"]) |
| 225 | + kernel = cast(ParticlePencilBeamKernel, bixel["kernel"]) |
222 | 226 | depths = kernel.depths |
223 | 227 |
|
224 | 228 | # Add potential offset |
@@ -299,7 +303,7 @@ def _get_ray_geometry_from_beam(self, ray: dict[str], beam_info: dict[str]): |
299 | 303 | ] |
300 | 304 |
|
301 | 305 | def _get_bixel_indices_on_ray(self, curr_bixel, curr_ray): |
302 | | - kernel = cast(IonPencilBeamKernel, curr_bixel["kernel"]) |
| 306 | + kernel = cast(ParticlePencilBeamKernel, curr_bixel["kernel"]) |
303 | 307 |
|
304 | 308 | # Create offset vector to account for additional offsets modeled in the base data |
305 | 309 | # and a potential range shifter |
@@ -437,7 +441,7 @@ def _init_beam( |
437 | 441 | beam_info = super()._init_beam(dij, ct, cst, stf, i) |
438 | 442 |
|
439 | 443 | # Sanity Check |
440 | | - assert isinstance(self._machine, IonAccelerator) |
| 444 | + assert isinstance(self._machine, ParticleAccelerator) |
441 | 445 |
|
442 | 446 | # Assuming currBeam is part of beam_info |
443 | 447 | curr_beam = beam_info["beam"] |
@@ -557,7 +561,7 @@ def _allocate_let_container(self, dij): |
557 | 561 |
|
558 | 562 | def _calc_lateral_particle_cut_off(self, cut_off_level, stf_element): |
559 | 563 | # Sanity Checks |
560 | | - assert isinstance(self._machine, IonAccelerator) |
| 564 | + assert isinstance(self._machine, ParticleAccelerator) |
561 | 565 |
|
562 | 566 | if len(stf_element) > 1 and not isinstance(stf_element, dict): |
563 | 567 | raise ValueError( |
@@ -798,7 +802,7 @@ def _calc_lateral_particle_cut_off(self, cut_off_level, stf_element): |
798 | 802 | def _init_ray(self, beam_info: dict[str], j: int) -> dict[str]: |
799 | 803 | ray = super()._init_ray(beam_info, j) |
800 | 804 |
|
801 | | - self._machine = cast(IonAccelerator, self._machine) |
| 805 | + self._machine = cast(ParticleAccelerator, self._machine) |
802 | 806 |
|
803 | 807 | # Calculate initial sigma for all bixels on the current ray |
804 | 808 | # TODO: here [ray] since calc_sigma_ini takes multiple rays (why?) |
@@ -853,7 +857,7 @@ def _fill_dij( |
853 | 857 |
|
854 | 858 | def _get_lateral_distance_from_dose_cutoff_on_ray(self, ray: dict): |
855 | 859 | # Find index of maximum used energy (round to keV for numerical reasons) |
856 | | - self._machine = cast(IonAccelerator, self._machine) |
| 860 | + self._machine = cast(ParticleAccelerator, self._machine) |
857 | 861 |
|
858 | 862 | max_energy = max([beamlet["energy"] for beamlet in ray["beamlets"]]) |
859 | 863 | kernel = self._machine.get_kernel_by_energy(max_energy) |
|
0 commit comments