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

Implementation of A/E fit background function with two EMGs #77

Merged
merged 7 commits into from
Oct 28, 2024

Conversation

verenaaur
Copy link
Collaborator

@verenaaur verenaaur commented Oct 9, 2024

changed so far:

  • changed markersize in plot recipe
  • implemented option to choose between aoe fit background function with one EMG (default) or two EMGs (-> two fit_func 'aoe_one_bck' and 'aoe_two_bck')
  • updated plot recipe: additional keyword "x_label" which is set to "Energy (keV)" by default; show A/E labels by using "x_label = "A/E"" like this:
    p = plot(report, x_label="A/E")
  • updated A/E pseudo priors (still some LogUniform distributions, though)
  • updated A/E fit function (two EMGs) in peakshapes.jl file to include sigma = 0.0 case

current code to obtain Compton band histogram (when 'filtered_aoe' is the array with all the filtered aoe values of the CBs):

binsize = 0.05
h = fit(Histogram, filtered_aoe, -20:binsize:3)
ps = LegendSpecFits.estimate_single_peak_stats_psd(h)
result, report = LegendSpecFits.fit_single_aoe_compton(h, ps, fit_func=:aoe_two_bck, uncertainty=true) # use background function with two EMGs
p = plot(report, x_label="A/E") # use A/E labels instead of energy labels

(binsize 0.05 and interval [-20,3] is variable)

@verenaaur verenaaur marked this pull request as draft October 9, 2024 14:41
@verenaaur verenaaur self-assigned this Oct 9, 2024
@verenaaur verenaaur added bug Something isn't working enhancement New feature or request labels Oct 9, 2024
@theHenks theHenks linked an issue Oct 9, 2024 that may be closed by this pull request
Copy link

codecov bot commented Oct 9, 2024

Codecov Report

Attention: Patch coverage is 0% with 54 lines in your changes missing coverage. Please review.

Project coverage is 21.85%. Comparing base (02da7b0) to head (5e32899).
Report is 38 commits behind head on dev.

Files with missing lines Patch % Lines
ext/LegendSpecFitsRecipesBaseExt.jl 0.00% 27 Missing ⚠️
src/aoefit_functions.jl 0.00% 13 Missing ⚠️
src/aoe_pseudo_prior.jl 0.00% 5 Missing ⚠️
src/peakshapes.jl 0.00% 4 Missing ⚠️
src/aoefit.jl 0.00% 3 Missing ⚠️
src/aoefit_combined.jl 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev      #77      +/-   ##
==========================================
+ Coverage   15.11%   21.85%   +6.73%     
==========================================
  Files          32       33       +1     
  Lines        2680     2970     +290     
==========================================
+ Hits          405      649     +244     
- Misses       2275     2321      +46     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@theHenks theHenks marked this pull request as ready for review October 13, 2024 20:04
Copy link
Collaborator

@theHenks theHenks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor changes, then we can merge.

src/aoefit.jl Show resolved Hide resolved
μ::Real, σ::Real, n::Real, background::Real, δ::Real,
μ2::Real, σ2::Real, background2::Real, δ2::Real
)
return n * gauss_pdf(x, μ, σ) + background * ex_gauss_pdf(-x, -μ, σ, δ) + background2 * ex_gauss_pdf(-x, -μ2, σ2, δ2)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's catch also here the case for sigma = 0.0 similar to the energy peakshape. Otherwise we might run again into numerical instabilites.

@theHenks theHenks merged commit 2575f47 into legend-exp:dev Oct 28, 2024
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Revise A/E routines
2 participants