Skip to content

Fix bug in custom peak_kwargs input into find_peaks - #92

Merged
RemDelaporteMathurin merged 5 commits into
LIBRA-project:mainfrom
cdunn314:update_channel_reading
Apr 28, 2026
Merged

Fix bug in custom peak_kwargs input into find_peaks#92
RemDelaporteMathurin merged 5 commits into
LIBRA-project:mainfrom
cdunn314:update_channel_reading

Conversation

@cdunn314

Copy link
Copy Markdown
Contributor

When energy calibrating the gamma detectors used for foil activation analysis, they are first energy calibrated. This is done through the get_calibration_data() function, which employs the SciPy.signal find_peaks() function with certain peak parameters to find the appropriate peaks in the spectrum that correspond to the check source gamma peaks. However, when the default peak parameters don't work, the user may input custom peak parameters through the peak_kwargs dictionary that is a keyword argument to get_calibration_data(). Currently, this dictionary uses Nuclide classes as keys, but this creates an error. This PR updates the dictionary to use the names of the nuclides as dictionary keys for the peak parameters as obtained from Nuclide.name.

@codecov

codecov Bot commented Apr 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 87.96%. Comparing base (e3f81c4) to head (e5c5318).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
...lbox/neutron_detection/activation_foils/compass.py 93.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #92      +/-   ##
==========================================
+ Coverage   87.25%   87.96%   +0.70%     
==========================================
  Files          19       19              
  Lines        1562     1570       +8     
==========================================
+ Hits         1363     1381      +18     
+ Misses        199      189      -10     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@RemDelaporteMathurin RemDelaporteMathurin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this is ok @cdunn314 could you add a short test to catch this bug?

@cdunn314

Copy link
Copy Markdown
Contributor Author

I kind of overdid the tests, but now it's well tested I think!

@cdunn314

Copy link
Copy Markdown
Contributor Author

@RemDelaporteMathurin If you're good with the tests and refactoring, can you approve this PR?

@RemDelaporteMathurin
RemDelaporteMathurin merged commit cb41e93 into LIBRA-project:main Apr 28, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants