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

renamed variables in lq_cut, changed expression handling #107

Merged
merged 16 commits into from
Feb 21, 2025

Conversation

DaGeibl
Copy link
Contributor

@DaGeibl DaGeibl commented Dec 13, 2024

Some changes for the lq_cut

  • renamed some variables in lq_cut, and renamed the drift time correction to function lq_ctc_correction
  • lq_cut now requires lq_e_corr_expression and dt_eff_expression to construct prop func
  • added the option to use higher order corrections for the ctc fit
  • usecut_single_peak insted of own pre-cutting method
  • adjusted recipe to changes

@theHenks theHenks added bug Something isn't working enhancement New feature or request labels Dec 13, 2024
@theHenks theHenks linked an issue Dec 13, 2024 that may be closed by this pull request
@theHenks
Copy link
Collaborator

All tests are failing. I think you need to rename things in there too

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.

I have mainly some comments about the uncertainty handling, the returns and some of the naming.

Copy link

codecov bot commented Dec 16, 2024

Codecov Report

Attention: Patch coverage is 19.13580% with 131 lines in your changes missing coverage. Please review.

Project coverage is 20.40%. Comparing base (74f700a) to head (295b064).
Report is 35 commits behind head on main.

Files with missing lines Patch % Lines
ext/LegendSpecFitsRecipesBaseExt.jl 0.00% 102 Missing ⚠️
src/aoe_cut.jl 0.00% 19 Missing ⚠️
src/lqcut.jl 75.60% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #107      +/-   ##
==========================================
- Coverage   20.91%   20.40%   -0.52%     
==========================================
  Files          37       37              
  Lines        3380     3455      +75     
==========================================
- Hits          707      705       -2     
- Misses       2673     2750      +77     

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

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.

The results still need a fix.

@DaGeibl
Copy link
Contributor Author

DaGeibl commented Jan 27, 2025

I changed the function to use method dispatch. Is this like you suggested?
In general could i also instead have done something like:

function get_peak_survival_fraction(aoe::Vector{<:Unitful.RealOrRealQuantity}, e::Vector{<:T}, peak::T, window::Vector{T}, aoe_cut::Unitful.RealOrRealQuantity, cut_vector::BitVector=trues(length(aoe)); uncertainty::Bool=true, inverted_mode::Bool=false, bin_width_window::T=2.0u"keV", sigma_high_sided::Unitful.RealOrRealQuantity=Inf*unit(first(aoe)), fit_func::Symbol=:gamma_def) where T<:Unitful.Energy{<:Real}

Like this one also could the function with all arguments or without `cut_vector` and `cut_vector` would not have been a kwarg. Or is that method with preassinging values discuraged?

@DaGeibl
Copy link
Contributor Author

DaGeibl commented Jan 28, 2025

I now also changed in function aoe to psd_parameter and aoe_cut to psd_cut to make clear it is also used for lq(and maybe future cuts) and not only aoe. if you want a shorter name than psd_parameter like psd_par or psd_param let me know then i change it

@DaGeibl
Copy link
Contributor Author

DaGeibl commented Jan 31, 2025

Compared to the last pull request i removed the Union{Bitvector, nothing} type restriction and changed it to just Bitvector. In this version the get_peaks_survival_fractions needs two different versions, one with and one without Bitvector. I am not sure if this can be solved more elegeant as i did.

@DaGeibl
Copy link
Contributor Author

DaGeibl commented Feb 14, 2025

@theHenks @fhagemann This pull request is finished from my side, i would be happy if you could review it

Copy link
Contributor

@fhagemann fhagemann left a comment

Choose a reason for hiding this comment

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

This PR features a lot of code duplication.
I commented where some functions can be combined to a single method by providing default values to the arguments.

Please also provide a plot using the new plot recipe, which makes it easier to review.

@DaGeibl
Copy link
Contributor Author

DaGeibl commented Feb 14, 2025

Here is an preview of the two plot recipes addedin this pull request.
Both plots are made using the report of LQ_cut. The first one is accesed by passing :sideband together with the report, lq_class and e_cal. It shows the sideband and the peak histogramms used for the sideband substraction. Here is an example:

grafik

The second plot is accesed by specifying :fit.

grafik

@fhagemann
Copy link
Contributor

fhagemann commented Feb 17, 2025

The second plot is accesed by specifying :fit.

grafik

You could remove the xlabel from the upper plot and the title from the lower plot, and ideally make them touch.
Also, the fit and the cut value have the same color, which is not optimal for the legend.

@DaGeibl
Copy link
Contributor Author

DaGeibl commented Feb 19, 2025

@fhagemann i implemented the discussed changes to include a default cut vector of trues, to reduce the code duplication

@fhagemann
Copy link
Contributor

@DaGeibl Can you run both the A/E and LQ processor with this update and check that BOTH perform as expected?

Copy link
Contributor

@fhagemann fhagemann left a comment

Choose a reason for hiding this comment

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

@DaGeibl verified that the A/E output is not at all affected by the modifications in this PR, so this should be good to go from my side

@fhagemann fhagemann merged commit 9e1f713 into legend-exp:main Feb 21, 2025
11 of 12 checks passed
@DaGeibl DaGeibl deleted the dev branch February 24, 2025 09:07
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.

Bug Fix LQ cut
3 participants