-
Notifications
You must be signed in to change notification settings - Fork 12
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
Generic simple_calibration #108
Draft
LisaSchlueter
wants to merge
17
commits into
main
Choose a base branch
from
co60
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
a0b628f
add more generic verison of simple calibration, e.g. for co60 data
LisaSchlueter fa21052
take most prominent peak not not largest energy
LisaSchlueter 1639f38
add minimal peakshape without tail
LisaSchlueter 888996b
update docstring and add fall-back solution for fwhm calculation
LisaSchlueter 421e2c3
add e_unit as kwarg
LisaSchlueter 692c1de
merge commong function for th228 and generic gamma
LisaSchlueter b8dda3f
clean up th228 remainders and docstrings
LisaSchlueter 8e924d9
merge simple calibration plto recipes
LisaSchlueter 13a85f9
add simple calibration test
LisaSchlueter 4851690
bug fix tests
LisaSchlueter da82248
account for case when dof = 0. uncertainties can still be propagated
LisaSchlueter a84f399
add fhagemann suggestions
LisaSchlueter 8ff7002
Merge branch 'main' into co60
LisaSchlueter db57f33
bug fix
LisaSchlueter 35f9b55
Merge branch 'co60' of github.com:legend-exp/LegendSpecFits.jl into co60
LisaSchlueter cace095
remove broadcasting for now; causes problems
LisaSchlueter 5a8519f
skip missing values; bug fix in simple calibration
LisaSchlueter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -486,24 +486,25 @@ | |
end | ||
end | ||
|
||
@recipe function f(report::NamedTuple{(:h_calsimple, :h_uncal, :c, :fep_guess, :peakhists, :peakstats)}; cal=true) | ||
@recipe function f(report::NamedTuple{(:h_calsimple, :h_uncal, :c, :peak_guess, :peakhists, :peakstats)}; cal=true) | ||
ylabel := "Counts" | ||
legend := :topright | ||
yscale := :log10 | ||
fill := false | ||
if cal | ||
h = LinearAlgebra.normalize(report.h_calsimple, mode = :density) | ||
xlabel := "Energy (keV)" | ||
xlims := (0, 3000) | ||
xticks := (0:200:3000, ["$i" for i in 0:200:3000]) | ||
xticks := (0:500:3000, ["$i" for i in 0:500:3000]) | ||
ylims := (0.2, maximum(h.weights)*1.1) | ||
fep_guess = 2614.5 | ||
peak_guess = ustrip(report.c * report.peak_guess) | ||
else | ||
h = LinearAlgebra.normalize(report.h_uncal, mode = :density) | ||
xlabel := "Energy (ADC)" | ||
xlims := (0, 1.2*report.fep_guess) | ||
xticks := (0:3000:1.2*report.fep_guess, ["$i" for i in 0:3000:1.2*report.fep_guess]) | ||
xlims := (0, 1.2*report.peak_guess) | ||
# xticks := (0:3000:1.2*report.peak_guess, ["$i" for i in 0:3000:1.2*report.peak_guess]) | ||
ylims := (0.2, maximum(h.weights)*1.1) | ||
fep_guess = report.fep_guess | ||
peak_guess = report.peak_guess | ||
end | ||
@series begin | ||
seriestype := :stepbins | ||
|
@@ -513,10 +514,10 @@ | |
y_vline = 0.2:1:maximum(h.weights)*1.1 | ||
@series begin | ||
seriestype := :line | ||
label := "FEP Guess" | ||
color := :red | ||
label := "Peak estimate"#: $(round(peak_guess, digits = 1))" | ||
color := :red2 | ||
linewidth := 1.5 | ||
fill(fep_guess, length(y_vline)), y_vline | ||
fill(peak_guess, length(y_vline)), y_vline | ||
end | ||
end | ||
|
||
|
@@ -850,7 +851,8 @@ | |
if plot_ribbon | ||
ribbon := uncertainty.(report.f_fit.(0:1:1.2*value(maximum(report.x)))) | ||
end | ||
0:1:1.2*value(maximum(report.x)), value.(report.f_fit.(0:1:1.2*value(maximum(report.x)))) | ||
xstep = value(maximum(report.x))/100 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this also work for the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tested it today on |
||
0:xstep:1.2*value(maximum(report.x)), value.(report.f_fit.(0:xstep:1.2*value(maximum(report.x)))) | ||
end | ||
@series begin | ||
seriestype := :scatter | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why this is a new recipe. Was this not here already before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is almost a duplicate of the existing recipe. However, the old one has some stuff hardcoded, e.g. "FEP" in the plot label. I didn't want to mess with the existing one, since we're int he middle of the processing.