Skip to content
Snippets Groups Projects
Commit c7768bfd authored by Jack Christopher Hutchinson Rolph's avatar Jack Christopher Hutchinson Rolph
Browse files

Update PeakOTron.py

parent cfd13613
No related branches found
No related tags found
No related merge requests found
......@@ -353,6 +353,48 @@ class PeakOTron:
# def __CalcChi2(self, x, y, y_hat, y_err):
# chi2 = np.nansum(((y_hat - y)/y_err)**2)
# ndof = len(x) - 10
# return chi2, ndof
# def GetChi2(self, prefit=False):
# if(self._m_DRM is None):
# raise Exception ("Fit has not yet been performed. Please first perform a fit.")
# else:
# x_all = self._hist_data["bin_numbers"]
# y_all = self._hist_data["counts"]
# y_err_all = self._hist_data["counts_error"]
# if(self._fit_kwargs["truncate_nsigma0_do"] is not None):
# lim_nsigma0 = self._prefit_values_bin["Q_0"] - self._fit_kwargs["truncate_nsigma0_do"]*self._prefit_values_bin["sigma_0"]
# cond_sel_nsigma0 = (self._hist_data["bin_numbers"]>lim_nsigma0)
# else:
# cond_sel_nsigma0 = np.full(len(self._hist_data["bin_numbers"]), True).astype(bool)
# x = x_all[cond_sel_nsigma0]
# y = y_all[cond_sel_nsigma0]
# y_err = y_err_all[cond_sel_nsigma0]
# y_hat = self.GetModel(x, prefit=prefit, bin_units=True)
# y_hat_err = np.sqrt(y_hat)
# plt.figure()
# plt.plot(x, (y-y_hat)/y_err)
# plt.show()
# chi2, ndof = self.__CalcChi2(x, y, y_hat, y_err)
# return chi2, ndof
def GetChi2(self, pars=None, prefit=False, full=False, n_sigma_lims=[None, None]):
......@@ -369,8 +411,10 @@ class PeakOTron:
else:
y_hat_all = DRM(x_all, **pars)
conds = []
cond_count = (y_all>1)
conds.append(cond_count)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment