Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A/E and calibration changes #514

Merged
merged 22 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
5328db6
added more possible length combinations for getting parameters
ggmarshall Sep 29, 2023
fc8b129
updated for changes to calibrations
ggmarshall Sep 29, 2023
56136ff
rewrote fitting to fit in stages dropping tail if unnecessary with pr…
ggmarshall Sep 29, 2023
25ce6a1
changes for new cal fitting, added high stats fitting for super calib…
ggmarshall Sep 29, 2023
011838a
rewrite of aoe routines, better handling of guesses, improved clarity…
ggmarshall Sep 29, 2023
dfca8a0
split loading routine into own file as well as function to handle fai…
ggmarshall Sep 29, 2023
4c55f01
bugfix on selection when nan values from fit
ggmarshall Sep 30, 2023
4dc8272
added ability to change tail weighting and changed binning on high st…
ggmarshall Sep 30, 2023
0c6ddbe
bugfix for partitiona ecal
ggmarshall Oct 3, 2023
64a45a1
fixed pars to params to eres fit
ggmarshall Oct 3, 2023
a71479d
partition ecal naming fix
ggmarshall Oct 3, 2023
9cd6853
updated units in fwhm to convention
ggmarshall Oct 9, 2023
5a623db
corrected units to _in_keV
ggmarshall Oct 12, 2023
193fac5
moved aoe_calibration function to dataflow
ggmarshall Oct 31, 2023
a7ceeab
moved top level funcs to dataflow added pulser field to plot arguments
ggmarshall Oct 31, 2023
1183817
added option to pass pulser mask to event selection if not calculate …
ggmarshall Oct 31, 2023
91e7b60
added pulser mask to load data, modified to have the data loading ext…
ggmarshall Oct 31, 2023
d3753ae
switched fit escale and ecal to iminuit and add errors as outputs
ggmarshall Oct 31, 2023
f6fea9e
removed tag_pulser and cut import as had circular dependencies, renam…
ggmarshall Oct 31, 2023
54af535
added default arguments, changed timestamp to run_timestamp to differ…
ggmarshall Oct 31, 2023
9783990
cleaned up imports, removing * imports and removing unnecessary argum…
ggmarshall Oct 31, 2023
894e60b
bugfix for tcm pulser where channel was incorrectly hardcoded
ggmarshall Nov 2, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/pygama/math/peak_fitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,8 @@ def get_mu_func(func, pars, cov = None, errors=None):
n_sig, mu, sigma, n_bkg, hstep = pars
elif len(pars) ==7:
n_sig, mu, sigma, n_bkg, hstep, low_range, high_range = pars
elif len(pars) ==8:
n_sig, mu, sigma, n_bkg, hstep, low_range, high_range, components = pars
if errors is not None:
return mu, errors[1]
elif cov is not None:
Expand All @@ -930,6 +932,8 @@ def get_mu_func(func, pars, cov = None, errors=None):
n_sig, mu, sigma, htail, tau, n_bkg, hstep = pars
elif len(pars) ==9:
n_sig, mu, sigma, htail, tau, n_bkg, hstep, low_range, high_range = pars
elif len(pars) ==10:
n_sig, mu, sigma, htail, tau, n_bkg, hstep, low_range, high_range, components = pars
if errors is not None:
return mu, errors[1]
elif cov is not None:
Expand All @@ -948,6 +952,8 @@ def get_fwhm_func(func, pars, cov = None):
n_sig, mu, sigma, n_bkg, hstep = pars
elif len(pars) ==7:
n_sig, mu, sigma, n_bkg, hstep, low_range, high_range = pars
elif len(pars) ==8:
n_sig, mu, sigma, n_bkg, hstep, low_range, high_range, components = pars
if cov is None:
return sigma*2*np.sqrt(2*np.log(2))
else:
Expand All @@ -958,6 +964,12 @@ def get_fwhm_func(func, pars, cov = None):
n_sig, mu, sigma, htail, tau, n_bkg, hstep = pars
elif len(pars) ==9:
n_sig, mu, sigma, htail, tau, n_bkg, hstep, low_range, high_range = pars
if cov is not None:
cov = cov[:7,:][:,:7]
elif len(pars) ==10:
n_sig, mu, sigma, htail, tau, n_bkg, hstep, low_range, high_range, components = pars
if cov is not None:
cov = cov[:7,:][:,:7]

return radford_fwhm(sigma, htail, tau, cov)
else:
Expand All @@ -971,6 +983,8 @@ def get_total_events_func(func, pars, cov = None, errors=None):
n_sig, mu, sigma, n_bkg, hstep = pars
elif len(pars) ==7:
n_sig, mu, sigma, n_bkg, hstep, low_range, high_range = pars
elif len(pars) ==8:
n_sig, mu, sigma, n_bkg, hstep, low_range, high_range, components = pars
if errors is not None:
return n_sig+n_bkg, np.sqrt(errors[0]**2 + errors[3]**2)
elif cov is not None:
Expand All @@ -983,6 +997,8 @@ def get_total_events_func(func, pars, cov = None, errors=None):
n_sig, mu, sigma, htail, tau, n_bkg, hstep = pars
elif len(pars) ==9:
n_sig, mu, sigma, htail, tau, n_bkg, hstep, low_range, high_range = pars
elif len(pars) ==10:
n_sig, mu, sigma, htail, tau, n_bkg, hstep, low_range, high_range, components = pars
if errors is not None:
return n_sig+n_bkg, np.sqrt(errors[0]**2 + errors[5]**2)
elif cov is not None:
Expand Down
Loading
Loading