Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix GSM methods for python wrapper #198

Merged
merged 9 commits into from
Oct 3, 2022

Conversation

grzanka
Copy link
Contributor

@grzanka grzanka commented Sep 30, 2022

No description provided.

@grzanka grzanka linked an issue Oct 3, 2022 that may be closed by this pull request
@grzanka grzanka self-assigned this Oct 3, 2022
@grzanka grzanka changed the title problem demo fix GSM methods for python wrapper Oct 3, 2022
@grzanka
Copy link
Contributor Author

grzanka commented Oct 3, 2022

Seems to work now with the following code:

import numpy as np
import pyamtrack.libAT as libam

def GSM_test(E_MeV_u, fluence_cm2):

    # this part is probably okay
    particle_no = libam.AT_particle_no_from_Z_and_A_single(1, 1) # Z, A
    material_no = libam.AT_material_number_from_name("Water, Liquid")
    rdd_model_no = libam.RDDModels["RDD_Geiss"].value
    a0_m = 10e-9
    rdd_parameter = [a0_m, 0., 0.]
    er_model = libam.AT_ERModels["ER_Edmund"].value
    stopping_power_source_no = libam.stoppingPowerSource_no["PSTAR"].value

    # this part is probably wrong ...
    nX = 100 # what is nX?
    pixel_size_m = 1e-6 # too coarse, just a test ..
    number_of_bins = 100 # hmm?
    dose_bin_centers = 10 ** np.linspace(np.log10(0.001), np.log10(1), number_of_bins)
    random_number_generator_seed = [2705490069]
    zero_dose_fraction = [0]
    dose_frequency_Gy = [0] * number_of_bins


    libam.AT_GSM_local_dose_distrib(p_E_MeV_u=[E_MeV_u], 
                                    p_fluence_cm2=[fluence_cm2], 
                                    p_particle_no=[particle_no],
                                    p_material_no=material_no, 
                                    p_rdd_model=rdd_model_no,
                                    p_rdd_parameter=rdd_parameter,
                                    p_er_model=er_model,
                                    p_stopping_power_source_no=stopping_power_source_no,
                                    p_nX=nX,
                                    p_pixel_size_m=pixel_size_m,
                                    p_dose_bin_centers_Gy=dose_bin_centers.tolist(),
                                    p_random_number_generator_seed=random_number_generator_seed,
                                    p_zero_dose_fraction=zero_dose_fraction,
                                    p_dose_frequency_Gy=dose_frequency_Gy,
                                   )

    print("zero_dose_fraction = ", zero_dose_fraction)
    print("dose freq", dose_frequency_Gy)

if __name__ == '__main__':
    GSM_test(60., 1e6)

@grzanka grzanka enabled auto-merge (squash) October 3, 2022 19:35
@grzanka grzanka merged commit a509f83 into master Oct 3, 2022
@grzanka grzanka deleted the grzanka/provide-working-example-195 branch October 3, 2022 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide working example for GSM calculation via Python
1 participant