libamtrack / library

Core library code
GNU General Public License v3.0
7 stars 8 forks source link

Working example to get dose histograms with CPP-SC in python #201

Closed jbrage closed 1 year ago

jbrage commented 2 years ago

just an example ....

import pyamtrack.libAT as libam

E_MeV_u = [10]
a0_m = 1e-7
particle_no  = [libam.AT_particle_no_from_particle_name_single(p_particle_name="4He")]

fluence_cm2_or_dose_Gy = [-0.25]
material_no = libam.AT_material_number_from_name("Aluminum Oxide")
stopping_power_source_no = 2 # PSTAR

rdd_model = libam.RDDModels.RDD_CucinottaExtTarget.value
er_model = libam.AT_ERModels.ER_Tabata.value
r_min_m = 1e-11
d_min_Gy = 1e-20
rdd_parameters = [r_min_m, a0_m, d_min_Gy, 0.0]

gamma_model = libam.AT_GammaResponseModels.GR_GeneralTarget.value
gamma_parameters = [1.0, 30, 1, 1, 0] # (k, D1, c, m, 0), tuple?

N2 = 10
fluence_factor = 1.0
write_output = True
shrink_tails = False
shrink_tails_under = 0.0
adjust_N2 = True
lethal_events_mode = False

relative_efficiency = [0]
d_check = [0]
S_HCP = [0]
S_gamma = [0]
mean_number_of_tracks_contrib = [0]
start_number_of_tracks_contrib = [0]
n_convolutions = [0]
lower_Jensen_bound = [0]
upper_Jensen_bound = [0]

libam.AT_run_CPPSC_method(
    p_E_MeV_u =E_MeV_u , 
    p_particle_no=particle_no, 
    p_fluence_cm2_or_dose_Gy=fluence_cm2_or_dose_Gy, 
    p_material_no=material_no, 
    p_stopping_power_source_no=stopping_power_source_no, 
    p_rdd_model=rdd_model, 
    p_rdd_parameters=rdd_parameters, 
    p_er_model=er_model, 
    p_gamma_model=gamma_model,
    p_gamma_parameters=gamma_parameters,
    p_N2=N2,
    p_fluence_factor=fluence_factor,
    p_write_output=write_output,
    p_shrink_tails=shrink_tails,
    p_shrink_tails_under=shrink_tails_under,
    p_adjust_N2=adjust_N2,
    p_lethal_events_mode=lethal_events_mode,
    p_relative_efficiency=relative_efficiency,
    p_d_check=d_check,
    p_S_HCP=S_HCP,
    p_S_gamma=S_gamma,
    p_mean_number_of_tracks_contrib=mean_number_of_tracks_contrib,
    p_start_number_of_tracks_contrib=start_number_of_tracks_contrib,
    p_n_convolutions=n_convolutions,
    p_lower_Jensen_bound=lower_Jensen_bound,
    p_upper_Jensen_bound=upper_Jensen_bound
)

print("relative efficiency = {:0.3f}".format(relative_efficiency[0]))
jbrage commented 1 year ago

solved; example to be uploaded