1010
1111epsilon_mm = 1e-5
1212
13- PROTON_RANGE = 260 # mm
14-
1513
1614def pv (verbose , * args , ** kwargs ):
1715 if verbose :
@@ -338,6 +336,7 @@ def pctweplfit(
338336 path_type ,
339337 phantom_length_samples ,
340338 phantom_width ,
339+ max_phantom_length ,
341340 detector_distance ,
342341 number_of_detectors ,
343342 initial_energy ,
@@ -350,7 +349,7 @@ def pctweplfit(
350349 verbose ,
351350):
352351 phantom_lengths = np .linspace (
353- 0.0 , min (PROTON_RANGE , detector_distance ), phantom_length_samples
352+ 0.0 , min (max_phantom_length , detector_distance ), phantom_length_samples
354353 )
355354
356355 seed_seq = np .random .SeedSequence (seed )
@@ -426,6 +425,13 @@ def build_parser():
426425 default = 40.0 ,
427426 type = float ,
428427 )
428+ parser .add_argument (
429+ "-l" ,
430+ "--max-phantom-length" ,
431+ help = "Maximum phantom length to consider (defaults to proton range in water)" ,
432+ type = float ,
433+ default = 260.0 ,
434+ )
429435 parser .add_argument (
430436 "-d" ,
431437 "--detector-distance" ,
@@ -491,6 +497,7 @@ def process(args_info: argparse.Namespace):
491497 path_type = args_info .path_type ,
492498 phantom_length_samples = args_info .phantom_length_samples ,
493499 phantom_width = args_info .phantom_width ,
500+ max_phantom_length = args_info .max_phantom_length ,
494501 detector_distance = args_info .detector_distance ,
495502 number_of_detectors = args_info .number_of_detectors ,
496503 initial_energy = args_info .initial_energy ,
0 commit comments