@@ -13,14 +13,15 @@ def analyse_radiation_damage(data, config=None):
13
13
bins = (100 , 100 )
14
14
15
15
# Dict that holds results and error maps; bin centers
16
- results = {r : None for r in ('proton ' , 'neq' , 'tid' )}
16
+ results = {r : None for r in ('primary ' , 'neq' , 'tid' )}
17
17
errors = {e : None for e in results }
18
18
bin_centers = {'x' : None , 'y' : None }
19
19
20
20
# We have a multipart irradiation with mulitple datafiles
21
21
if config is None :
22
22
23
23
server = None # Only allow files with exactly one server for multipart to avoid adding unrelated fluence maps
24
+ ion_name = None
24
25
25
26
# Loop over generator and get partial data files
26
27
for nfile , data_part , config_part , session_basename in data :
@@ -35,28 +36,29 @@ def analyse_radiation_damage(data, config=None):
35
36
# Only allow one fixed server for multipart
36
37
if server is None :
37
38
server = server_config ['name' ]
39
+ ion_name = server_config ['daq' ]['ion' ]
38
40
39
41
if server not in data_part :
40
42
raise KeyError (f"Server '{ server } ' not present in file { session_basename } !" )
41
43
42
44
# Initialize damage and error maps
43
45
if nfile == 0 :
44
46
45
- results ['proton ' ], errors ['proton ' ], bin_centers ['x' ], bin_centers ['y' ] = fluence .generate_fluence_map (beam_data = data_part [server ]['Beam' ],
47
+ results ['primary ' ], errors ['primary ' ], bin_centers ['x' ], bin_centers ['y' ] = fluence .generate_fluence_map (beam_data = data_part [server ]['Beam' ],
46
48
scan_data = data_part [server ]['Scan' ],
47
49
beam_sigma = beam_sigma ,
48
50
bins = bins )
49
51
# Generate eqivalent fluence map as well as TID map
50
52
if server_config ['daq' ]['kappa' ] is None :
51
53
del results ['neq' ]
52
54
else :
53
- results ['neq' ] = results ['proton ' ] * server_config ['daq' ]['kappa' ]['nominal' ]
55
+ results ['neq' ] = results ['primary ' ] * server_config ['daq' ]['kappa' ]['nominal' ]
54
56
55
57
print (server_config ['daq' ]['stopping_power' ], type (server_config ['daq' ]['stopping_power' ]))
56
58
if server_config ['daq' ]['stopping_power' ] is None :
57
59
del results ['tid' ]
58
60
else :
59
- results ['tid' ] = formulas .tid_scan ( proton_fluence = results ['proton ' ], stopping_power = server_config ['daq' ]['stopping_power' ])
61
+ results ['tid' ] = formulas .tid_per_scan ( primary_fluence = results ['primary ' ], stopping_power = server_config ['daq' ]['stopping_power' ])
60
62
61
63
continue
62
64
@@ -65,38 +67,39 @@ def analyse_radiation_damage(data, config=None):
65
67
beam_sigma = beam_sigma ,
66
68
bins = bins )
67
69
# Add to overall map
68
- results ['proton ' ] += fluence_map_part
69
- errors ['proton ' ] = (errors ['proton ' ]** 2 + fluence_map_part_error ** 2 )** .5
70
+ results ['primary ' ] += fluence_map_part
71
+ errors ['primary ' ] = (errors ['primary ' ]** 2 + fluence_map_part_error ** 2 )** .5
70
72
71
73
# Add to eqivalent fluence map
72
74
if 'neq' in results :
73
- results ['neq' ] += results ['proton ' ] * server_config ['daq' ]['kappa' ]['nominal' ]
74
- errors ['neq' ] = ((server_config ['daq' ]['kappa' ]['nominal' ] * errors ['proton ' ])** 2 + (results ['proton ' ] * server_config ['daq' ]['kappa' ]['sigma' ])** 2 )** 0.5
75
+ results ['neq' ] += results ['primary ' ] * server_config ['daq' ]['kappa' ]['nominal' ]
76
+ errors ['neq' ] = ((server_config ['daq' ]['kappa' ]['nominal' ] * errors ['primary ' ])** 2 + (results ['primary ' ] * server_config ['daq' ]['kappa' ]['sigma' ])** 2 )** 0.5
75
77
76
78
if 'tid' in results :
77
- results ['tid' ] += formulas .tid_scan ( proton_fluence = results ['proton ' ], stopping_power = server_config ['daq' ]['stopping_power' ])
78
- errors ['tid' ] = formulas .tid_scan ( proton_fluence = errors ['proton ' ], stopping_power = server_config ['daq' ]['stopping_power' ])
79
+ results ['tid' ] += formulas .tid_per_scan ( primary_fluence = results ['primary ' ], stopping_power = server_config ['daq' ]['stopping_power' ])
80
+ errors ['tid' ] = formulas .tid_per_scan ( primary_fluence = errors ['primary ' ], stopping_power = server_config ['daq' ]['stopping_power' ])
79
81
80
82
else :
81
83
82
84
server = config ['name' ]
85
+ ion_name = config ['daq' ]['ion' ]
83
86
84
- results ['proton ' ], errors ['proton ' ], bin_centers ['x' ], bin_centers ['y' ] = fluence .generate_fluence_map (beam_data = data [server ]['Beam' ],
87
+ results ['primary ' ], errors ['primary ' ], bin_centers ['x' ], bin_centers ['y' ] = fluence .generate_fluence_map (beam_data = data [server ]['Beam' ],
85
88
scan_data = data [server ]['Scan' ],
86
89
beam_sigma = beam_sigma ,
87
90
bins = bins )
88
91
# Generate eqivalent fluence map as well as TID map
89
92
if config ['daq' ]['kappa' ] is None :
90
93
del results ['neq' ]
91
94
else :
92
- results ['neq' ] = results ['proton ' ] * config ['daq' ]['kappa' ]['nominal' ]
93
- errors ['neq' ] = ((config ['daq' ]['kappa' ]['nominal' ] * errors ['proton ' ])** 2 + (results ['proton ' ] * config ['daq' ]['kappa' ]['sigma' ])** 2 )** .5
95
+ results ['neq' ] = results ['primary ' ] * config ['daq' ]['kappa' ]['nominal' ]
96
+ errors ['neq' ] = ((config ['daq' ]['kappa' ]['nominal' ] * errors ['primary ' ])** 2 + (results ['primary ' ] * config ['daq' ]['kappa' ]['sigma' ])** 2 )** .5
94
97
95
98
if config ['daq' ]['stopping_power' ] is None :
96
99
del results ['tid' ]
97
100
else :
98
- results ['tid' ] = formulas .tid_scan ( proton_fluence = results ['proton ' ], stopping_power = config ['daq' ]['stopping_power' ])
99
- errors ['tid' ] = formulas .tid_scan ( proton_fluence = errors ['proton ' ], stopping_power = config ['daq' ]['stopping_power' ])
101
+ results ['tid' ] = formulas .tid_per_scan ( primary_fluence = results ['primary ' ], stopping_power = config ['daq' ]['stopping_power' ])
102
+ errors ['tid' ] = formulas .tid_per_scan ( primary_fluence = errors ['primary ' ], stopping_power = config ['daq' ]['stopping_power' ])
100
103
101
104
if any (a is None for a in (list (bin_centers .values ()) + list (results .values ()))):
102
105
raise ValueError ('Uninitialized values! Something went wrong - maybe files not found?' )
@@ -123,16 +126,16 @@ def analyse_radiation_damage(data, config=None):
123
126
124
127
is_dut = damage_map .shape == dut_map .shape
125
128
126
- fig , _ = plotting .plot_damage_map_3d (damage_map = damage_map , map_centers_x = centers_x , map_centers_y = centers_y , contour = not is_dut , damage = damage , server = server , dut = is_dut )
129
+ fig , _ = plotting .plot_damage_map_3d (damage_map = damage_map , map_centers_x = centers_x , map_centers_y = centers_y , contour = not is_dut , damage = damage , ion_name = ion_name , server = server , dut = is_dut )
127
130
figs .append (fig )
128
131
129
- fig , _ = plotting .plot_damage_error_3d (damage_map = damage_map , error_map = errors [damage ] if not is_dut else dut_error_map , map_centers_x = centers_x , map_centers_y = centers_y , contour = not is_dut , damage = damage , server = server , dut = is_dut )
132
+ fig , _ = plotting .plot_damage_error_3d (damage_map = damage_map , error_map = errors [damage ] if not is_dut else dut_error_map , map_centers_x = centers_x , map_centers_y = centers_y , contour = not is_dut , damage = damage , ion_name = ion_name , server = server , dut = is_dut )
130
133
figs .append (fig )
131
134
132
- fig , _ = plotting .plot_damage_map_2d (damage_map = damage_map , map_centers_x = centers_x , map_centers_y = centers_y , damage = damage , server = server , dut = is_dut )
135
+ fig , _ = plotting .plot_damage_map_2d (damage_map = damage_map , map_centers_x = centers_x , map_centers_y = centers_y , damage = damage , ion_name = ion_name , server = server , dut = is_dut )
133
136
figs .append (fig )
134
137
135
- fig , _ = plotting .plot_damage_map_contourf (damage_map = damage_map , map_centers_x = centers_x , map_centers_y = centers_y , damage = damage , server = server , dut = is_dut )
138
+ fig , _ = plotting .plot_damage_map_contourf (damage_map = damage_map , map_centers_x = centers_x , map_centers_y = centers_y , damage = damage , ion_name = ion_name , server = server , dut = is_dut )
136
139
figs .append (fig )
137
140
138
141
logging .info ("Finished plotting." )
0 commit comments