Skip to content

Commit 4578a4b

Browse files
committed
Change Z to DT in naming
1 parent e164268 commit 4578a4b

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

invisible_cities/reco/icaro_components.py

+18-18
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def band_selector_and_check(dst : pd.DataFrame,
6666
boot_map : ASectorMap,
6767
norm_strat : NormStrategy = NormStrategy.max,
6868
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) ,
7070
range_E : Tuple[np.array, np.array] = (10.0e+3,14e+3) ,
7171
nsigma_sel : float = 3.5 ,
7272
eff_interval: Tuple[float, float] = [0,1] ,
@@ -87,7 +87,7 @@ def band_selector_and_check(dst : pd.DataFrame,
8787
Provides the desired normalization to be used.
8888
mask_input: np.array
8989
Mask of the previous selection cut.
90-
range_Z: Tuple[np.array, np.array]
90+
range_DT: Tuple[np.array, np.array]
9191
Range in Z-axis
9292
range_E: Tuple[np.array, np.array]
9393
Range in Energy-axis
@@ -109,9 +109,9 @@ def band_selector_and_check(dst : pd.DataFrame,
109109
dst[input_mask].Y.values)
110110

111111
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,
113113
E0,
114-
range_z = range_Z,
114+
range_dt = range_DT,
115115
range_e = range_E,
116116
nsigma = nsigma_sel)
117117

@@ -120,29 +120,29 @@ def band_selector_and_check(dst : pd.DataFrame,
120120
check_if_values_in_interval(data = np.array(effsel) ,
121121
minval = eff_interval[0] ,
122122
maxval = eff_interval[1] ,
123-
display_name = "Z-band selection",
123+
display_name = "DT-band selection",
124124
strictness = strictness ,
125125
right_closed = True)
126126

127127
return sel_krband
128128

129129

130-
def selection_in_band(z : np.array,
130+
def selection_in_band(dt : np.array,
131131
e : np.array,
132-
range_z : Tuple[float, float],
132+
range_dt : Tuple[float, float],
133133
range_e : Tuple[float, float],
134134
nsigma : float = 3.5) ->np.array:
135135
"""
136136
This function returns a mask for the selection of the events that are inside the Kr E vz Z
137137
138138
Parameters
139139
----------
140-
z: np.array
141-
axial (z) values
140+
dt: np.array
141+
axial (dt/z) values
142142
e: np.array
143143
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
146146
range_e: Tuple[np.array, np.array]
147147
Range in Energy-axis
148148
nsigma: float
@@ -153,22 +153,22 @@ def selection_in_band(z : np.array,
153153
"""
154154
# Reshapes and flattens are needed for RANSAC function
155155

156-
z_sel = z[in_range(z, *range_z)]
156+
dt_sel = dt[in_range(dt, *range_dt)]
157157
e_sel = e[in_range(e, *range_e)]
158158

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))
160160

161161
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()
163163
resy, resx = np.histogram(residuals_ln, 100)
164164
resx = resx[:-1] + np.diff(resx)
165165
fitres = fit(gauss, resx, resy, seed=[4e3,0,10])
166166
fitsigma = fitres.val[2]
167167

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
171171

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))
173173

174174
return sel_inband

0 commit comments

Comments
 (0)