@@ -66,7 +66,7 @@ def band_selector_and_check(dst : pd.DataFrame,
66
66
boot_map : ASectorMap ,
67
67
norm_strat : NormStrategy = NormStrategy .max ,
68
68
input_mask : np .array = None ,
69
- range_Z : Tuple [np .array , np .array ] = (10 , 1300 ) ,
69
+ range_DT : Tuple [np .array , np .array ] = (10 , 1300 ) ,
70
70
range_E : Tuple [np .array , np .array ] = (10.0e+3 ,14e+3 ) ,
71
71
nsigma_sel : float = 3.5 ,
72
72
eff_interval : Tuple [float , float ] = [0 ,1 ] ,
@@ -87,7 +87,7 @@ def band_selector_and_check(dst : pd.DataFrame,
87
87
Provides the desired normalization to be used.
88
88
mask_input: np.array
89
89
Mask of the previous selection cut.
90
- range_Z : Tuple[np.array, np.array]
90
+ range_DT : Tuple[np.array, np.array]
91
91
Range in Z-axis
92
92
range_E: Tuple[np.array, np.array]
93
93
Range in Energy-axis
@@ -109,9 +109,9 @@ def band_selector_and_check(dst : pd.DataFrame,
109
109
dst [input_mask ].Y .values )
110
110
111
111
sel_krband = np .zeros_like (input_mask )
112
- sel_krband [input_mask ] = selection_in_band (dst [input_mask ].Z ,
112
+ sel_krband [input_mask ] = selection_in_band (dst [input_mask ].DT ,
113
113
E0 ,
114
- range_z = range_Z ,
114
+ range_dt = range_DT ,
115
115
range_e = range_E ,
116
116
nsigma = nsigma_sel )
117
117
@@ -120,29 +120,29 @@ def band_selector_and_check(dst : pd.DataFrame,
120
120
check_if_values_in_interval (data = np .array (effsel ) ,
121
121
minval = eff_interval [0 ] ,
122
122
maxval = eff_interval [1 ] ,
123
- display_name = "Z -band selection" ,
123
+ display_name = "DT -band selection" ,
124
124
strictness = strictness ,
125
125
right_closed = True )
126
126
127
127
return sel_krband
128
128
129
129
130
- def selection_in_band (z : np .array ,
130
+ def selection_in_band (dt : np .array ,
131
131
e : np .array ,
132
- range_z : Tuple [float , float ],
132
+ range_dt : Tuple [float , float ],
133
133
range_e : Tuple [float , float ],
134
134
nsigma : float = 3.5 ) -> np .array :
135
135
"""
136
136
This function returns a mask for the selection of the events that are inside the Kr E vz Z
137
137
138
138
Parameters
139
139
----------
140
- z : np.array
141
- axial (z) values
140
+ dt : np.array
141
+ axial (dt/ z) values
142
142
e: np.array
143
143
energy values
144
- range_z : Tuple[np.array, np.array]
145
- Range in Z -axis
144
+ range_dt : Tuple[np.array, np.array]
145
+ Range in DT -axis
146
146
range_e: Tuple[np.array, np.array]
147
147
Range in Energy-axis
148
148
nsigma: float
@@ -153,22 +153,22 @@ def selection_in_band(z : np.array,
153
153
"""
154
154
# Reshapes and flattens are needed for RANSAC function
155
155
156
- z_sel = z [in_range (z , * range_z )]
156
+ dt_sel = dt [in_range (dt , * range_dt )]
157
157
e_sel = e [in_range (e , * range_e )]
158
158
159
- res_fit = RANSACRegressor ().fit (z_sel , np .log (e_sel ).reshape (- 1 , 1 ))
159
+ res_fit = RANSACRegressor ().fit (dt_sel , np .log (e_sel ).reshape (- 1 , 1 ))
160
160
161
161
in_mask = res_fit .inlier_mask_
162
- residuals_ln = e_sel [in_mask ] - np .exp (res_fit .predict (z_sel [in_mask ].reshape (- 1 , 1 ))).flatten ()
162
+ residuals_ln = e_sel [in_mask ] - np .exp (res_fit .predict (dt_sel [in_mask ].reshape (- 1 , 1 ))).flatten ()
163
163
resy , resx = np .histogram (residuals_ln , 100 )
164
164
resx = resx [:- 1 ] + np .diff (resx )
165
165
fitres = fit (gauss , resx , resy , seed = [4e3 ,0 ,10 ])
166
166
fitsigma = fitres .val [2 ]
167
167
168
- prefict_fun = lambda z : res_fit .predict (z .reshape (- 1 , 1 )).flatten ()
169
- upper_band = lambda z : prefict_fun (z ) + nsigma * fitsigma
170
- lower_band = lambda z : prefict_fun (z ) - nsigma * fitsigma
168
+ prefict_fun = lambda dt : res_fit .predict (dt .reshape (- 1 , 1 )).flatten ()
169
+ upper_band = lambda dt : prefict_fun (dt ) + nsigma * fitsigma
170
+ lower_band = lambda dt : prefict_fun (dt ) - nsigma * fitsigma
171
171
172
- sel_inband = in_range (np .log (e_sel ), lower_band (z_sel ), upper_band (z_sel ))
172
+ sel_inband = in_range (np .log (e_sel ), lower_band (dt_sel ), upper_band (dt_sel ))
173
173
174
174
return sel_inband
0 commit comments