-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Treatment plan source file was missing from the branch. Added. small modifications. Still trying to figure out the error in spot positions Fixed bug with TPS rotation and created tests Removed old version of the helpers. Now the function that reads the treatment plan txt file returns also the gantry angle Created tests for: optics in air, absolute dose in water and gantry rotation. Working version of TPSource Removed full MA polinomia from the beamline model added test for weights and comparison pbs-tps exposed G4UserLimits and StepLimiter Corrected bugs in TPSource and created working tests for optics, absolute dose, ranges and weights Improved test metrics and TPS readability test optics in vbl Refactored TPS init and renamed beamline properties changed TPS initialization minor changes, mainly estetics' turn off visualization reduced the size of the detectors Further reduced the detector's side Included energy spread in the TPS model and examples Corrected inconsistency in test for absolute dose. Added function to test dose grid shape and spacing to helpers_test accounted for correction in dose grid (PR#137) accounted for PR#137 corrected scale_dose function for case image size 1,1,x multiprocessing: do we need a timeout in p.join()? spot weighted on the beamset number of particles, not on the beam ones. created separate neme dictionary for particles to use in user_limit Changed queue initialization for multiprocessing added check to avoid error when beam spot has almost zero weight removed step limiter from branch modified threshold
- Loading branch information
Showing
12 changed files
with
2,386 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# N.B: distances in mm, degrees in rad | ||
|
||
|
||
class Rashi: | ||
pass | ||
|
||
|
||
class RangeMod: | ||
pass | ||
|
||
|
||
class BeamlineModel: | ||
def __init__(self): | ||
self.name = None | ||
self.radiation_types = [] | ||
self.rm = None # range modulator | ||
self.rashi = None | ||
# Nozzle entrance to Isocenter distance | ||
self.distance_nozzle_iso = 0 # mm | ||
# SMX (X bending magnet) to Isocenter distance | ||
self.distance_stearmag_to_isocenter_x = float( | ||
"inf" | ||
) # default infinity for parallel beams | ||
# SMY (Y bending magnet) to Isocenter distance | ||
self.distance_stearmag_to_isocenter_y = float("inf") | ||
# polinomial coefficients | ||
self.energy_mean_coeffs = [0] | ||
self.energy_spread_coeffs = [0] | ||
self.sigma_x_coeffs = [0] | ||
self.theta_x_coeffs = [0] | ||
self.epsilon_x_coeffs = [0] | ||
self.sigma_y_coeffs = [0] | ||
self.theta_y_coeffs = [0] | ||
self.epsilon_y_coeffs = [0] | ||
# convergence | ||
self.conv_x = 0 | ||
self.conv_y = 0 | ||
|
||
def _polynomial_map(self, base, coeff): | ||
# coeff are given with decreasing degree (coeff[0]->max degree) | ||
polyDegree = len(coeff) | ||
exp = list(range(polyDegree)) | ||
exp.reverse() | ||
|
||
return sum([c * (base ** (i)) for c, i in zip(coeff, exp)]) | ||
|
||
def get_energy(self, nominal_energy): | ||
return self._polynomial_map(nominal_energy, self.energy_mean_coeffs) | ||
|
||
def get_sigma_energy(self, nominal_energy): | ||
return self._polynomial_map(nominal_energy, self.energy_spread_coeffs) | ||
|
||
def get_sigma_x(self, energy): | ||
return self._polynomial_map(energy, self.sigma_x_coeffs) | ||
|
||
def get_theta_x(self, energy): | ||
return self._polynomial_map(energy, self.theta_x_coeffs) | ||
|
||
def get_epsilon_x(self, energy): | ||
return self._polynomial_map(energy, self.epsilon_x_coeffs) | ||
|
||
def get_sigma_y(self, energy): | ||
return self._polynomial_map(energy, self.sigma_y_coeffs) | ||
|
||
def get_theta_y(self, energy): | ||
return self._polynomial_map(energy, self.theta_y_coeffs) | ||
|
||
def get_epsilon_y(self, energy): | ||
return self._polynomial_map(energy, self.epsilon_y_coeffs) |
Oops, something went wrong.