113 """Compares the concrete estimate to the truth and generates plots of the resolution
117 bin_values : array_like(float
118 The parameter used for binning
119 truths : array_like(float)
120 Sample of the true values
121 estimates : array_like(float)
122 Corresponding estimations
125 if is_expert
is None:
128 if which_plots
is None:
139 if plot_name
is None:
142 plot_name = formatter.format(plot_name,
143 quantity_name=quantity_name,
144 plot_name_prefix=plot_name_prefix,
148 if plot_title
is None:
151 plot_title = formatter.format(plot_title,
152 quantity_name=quantity_name,
156 residuals = estimates - truths
160 if "resolution" in which_plots:
164 resolution_values = []
169 assert (lower_bin < upper_bin)
170 bin_center = lower_bin + (upper_bin - lower_bin) / 2.0
171 assert (len(bin_values) == len(residuals))
174 sel_residuals = collections.deque()
176 for i
in range(len(bin_values)):
177 if bin_values[i] >= lower_bin
and bin_values[i] < upper_bin:
178 sel_residuals.append(residuals[i])
180 residuals_hist_name = formatter.format(plot_name, subplot_name=
"residuals") + \
181 f
"{lower_bin}_to_{upper_bin}"
183 vplot.hist(sel_residuals,
184 outlier_z_score=outlier_z_score,
186 vplot.xlabel = compose_axis_label(
"#Delta " + quantity_name +
" (estimate - truth)", self.
unit)
187 vplot.title = formatter.format(plot_title, subplot_title=
'Residual distribution')
191 gaus_sigma_err =
None
195 fit_res = vplot.fit_gaus(z_score=1)
198 params = fit_res.GetParams()
199 errs = fit_res.Errors()
202 gaus_sigma = params[2]
203 gaus_sigma_err = errs[2]
205 res_histogram += [(lower_bin, upper_bin, bin_center, vplot)]
206 self.
plots[
'residuals' + residuals_hist_name] = vplot
209 resolution_values += [(lower_bin, upper_bin, bin_center, gaus_sigma, gaus_sigma_err)]
211 resolution_graph_name = formatter.format(plot_name, subplot_name=
"resolution")
220 for v
in resolution_values:
229 resolution_graph.grapherrors((np.array(xs), np.array(xs_err)), (np.array(ys), np.array(ys_err)),
233 resolution_graph.title = formatter.format(plot_title, subplot_title=
'Resolution')
235 self.
plots[resolution_graph_name] = resolution_graph