import json from lib import thinknode_worker as thinknode from lib import dosimetry_worker as dosimetry from lib import decimal_logging as dl # Get IAM ids iam = thinknode.authenticate(thinknode.read_config('thinknode.cfg')) def make_dose_points(pointCount): ... def make_layers(sad, range, mod): return \ thinknode.function(iam["account_name"], "dosimetry", "compute_double_scattering_layers", [ thinknode.reference("55f70f5000c0a247563a909b6087ada0"), # SOBP Machine from ISS thinknode.value(sad), thinknode.value(range), thinknode.value(mod) ]) def make_target(): return \ thinknode.function("dosimetry", "make_cube", [ thinknode.value([-32, -20, -30]), thinknode.value([16, -10, 30]) ]) def compute_aperture(): return dosimetry.compute_aperture(iam, make_target(), beam_geometry, 20.0, 0.0, 250.5) beam_geometry = \ ... # Get degrader geometry as calculation result degrade_geom = \ thinknode.function(iam["account_name"], "dosimetry", "make_shifter", [ thinknode.value(18), # thickness thinknode.value("mm"), # units thinknode.value(200) # downstream edge ]) res_geom = thinknode.do_calculation(iam, degrade_geom, True) degrader = \ thinknode.function(iam["account_name"], "dosimetry", "make_degrader", [ thinknode.value(res_geom), thinknode.reference("56030a9500c036a0c6393f984b25e303") # Material spec from ISS ]) proton_degr = thinknode.do_calculation(iam, degrader) # Call compute_sobp_pb_dose2 dose_calc = \ thinknode.function("dosimetry", "compute_sobp_pb_dose2", [ dosimetry.make_image_3d(iam, [-100, -100, -100], [200, 200, 200], [2, 2, 2], 1), #stopping_power_image thinknode.value(make_dose_points(181)), # dose_points beam_geometry, #beam_geometry dosimetry.make_grid(iam, [-75, -75], [150, 150], [2, 2]), # bixel_grid make_layers(2270.0, 152.0, 38.0), compute_aperture(), # aperture based on targets thinknode.value([proton_degr]) # degraders ]) # Perform calculation res = thinknode.do_calculation(iam, dose_calc) dl.data("Calculation Result: ", res)