Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
PeakOTron
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
UHHDetLab
SiPM
PeakOTron
Commits
83677455
Commit
83677455
authored
3 years ago
by
Jack Christopher Hutchinson Rolph
Browse files
Options
Downloads
Patches
Plain Diff
Update PeakOTron.py
parent
c58dd603
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
PeakOTron.py
+54
-2
54 additions, 2 deletions
PeakOTron.py
with
54 additions
and
2 deletions
PeakOTron.py
+
54
−
2
View file @
83677455
...
...
@@ -1482,6 +1482,9 @@ class PeakOTron:
idxs_peaks
,
_
=
find_peaks
(
density_bgsub
,
distance
=
kwargs
[
"
peak_dist_nG
"
]
*
G_fft
)
if
(
len
(
idxs_peaks
)
<
2
):
raise
Exception
(
"
Less than 2 peaks found in spectrum. Spectrum cannot be fitted.
"
)
########################################################################################################
## Find peaks widths with scipy 'peak_widths'. 'peak_rel_height' is used to find the appropriate width criterion.
...
...
@@ -1533,6 +1536,9 @@ class PeakOTron:
idxs_peak_widths
=
idxs_peak_widths
[
_idxs_sort
]
if
(
len
(
idxs_peaks
)
<
2
):
raise
Exception
(
"
Less than 2 peaks found in spectrum. Spectrum cannot be fitted.
"
)
########################################################################################################
## Calculate and store bin statistic information.
########################################################################################################
...
...
@@ -1725,9 +1731,55 @@ class PeakOTron:
mu_DCR
=
DCR
*
(
kwargs
[
"
t_0
"
]
+
kwargs
[
"
t_gate
"
])
########################################################################################################
##
Store results in the class for fitting/reference
.
##
Check for nans and correct as necessary
.
########################################################################################################
if
(
np
.
isnan
(
Q_0
)):
if
(
self
.
_verbose
):
print
(
"
Q_0 returned nan in prefit. Setting Q_0 to 1 bin
"
):
Q_0
=
1
dQ_0
=
0.1
if
(
np
.
isnan
(
G
)):
if
(
self
.
_verbose
):
print
(
"
G returned nan in prefit. Setting G to 1 bin
"
):
G
=
1
dG
=
0.1
if
(
np
.
isnan
(
mu
)):
if
(
self
.
_verbose
):
print
(
"
mu returned nan in prefit. Setting mu to 1 p.e.
"
):
mu
=
1
dmu
=
0.1
if
(
np
.
isnan
(
lbda
)):
if
(
self
.
_verbose
):
print
(
"
lbda returned nan in prefit. Setting lbda to 1e-2.
"
):
lbda
=
1e-2
dlbda
=
0.1
if
(
np
.
isnan
(
sigma_0
)):
if
(
self
.
_verbose
):
print
(
"
sigma_0 returned nan in prefit. Setting sigma_0 to 1 bin.
"
):
sigma_0
=
1
dsigma_0
=
0.1
if
(
np
.
isnan
(
sigma_1
)):
if
(
self
.
_verbose
):
print
(
"
sigma_0 returned nan in prefit. Setting sigma_1 to 1 bin.
"
):
sigma_1
=
1
dsigma_1
=
0.1
if
(
np
.
isnan
(
DCR
)):
if
(
self
.
_verbose
):
print
(
"
DCR returned nan in prefit. Setting DCR to 1e-9 GHz.
"
):
DCR
=
1e-9
dDCR
=
1e-2
########################################################################################################
## Store results in the class for fitting/reference.
########################################################################################################
self
.
_hist_data
[
"
data
"
]
=
data
self
.
_hist_data
[
"
bw
"
]
=
bw
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment