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

Add more energy calibration methods #49

Merged
merged 8 commits into from
Sep 20, 2024

Conversation

RLumSK
Copy link
Collaborator

@RLumSK RLumSK commented Sep 20, 2024

This is a more complicated PR. It boils down to the idea that each dose-rate calibration is based on spectra that have (or don't have) one or more energy/channel calibrations. Users try all kinds of weird things, and I realised that we cannot take for granted that all spectra are energy-calibrated. On the other hand, since the energy calibration likely did not change, it would be nice if dose_predict() were to take over the calibration from the original dataset.

Description

  • ad code that forwards the energy calibration model during the call of dose_fit() and store it in the info slot
  • ad consideration of this energy calibration to dose_predict()
  • up show method for the calibration curve
  • ad a lot more tests
  • ad NEWS

Side effect of this change is that, because it was necessary to touch the class methods, that energy_calibrate() can now copy over an existing calibration from another spectrum.

Related Issue

Not applicable.

Example

data("clermont")
spc_dir <- system.file("extdata/BDX_LaBr_1/calibration", package = "gamma")
spc <- read(spc_dir)
bkg_dir <- system.file("extdata/BDX_LaBr_1/background", package = "gamma")
bkg <- read(bkg_dir)
doses <- clermont[, c("gamma_dose", "gamma_error")]

dose_fit(spc, bkg, doses,  range_Ni = c(300, 2800), range_NiEi = c(165, 2800))
Calibration curve:
* authors: 
* date: 2024-09-20 11:05:06.380417
* energy_calibration: NA
Warning message:
All spectra without energy calibration. You can proceed but it is not recommended! 
dose_predict(calib, spc_no_calib)
No energy calibration found for 'spectrum', apply calibration from dose-rate calibration model!

RLumSK and others added 3 commits September 19, 2024 16:29
+ ad method for GammaSpectrum - lm
+ ad method for GammaSpectra - lm
+ ad method for GammaSpectrum - GammaSpectrum
+ ad method for GammaSpectra - GammaSpectra
+ ad tests
+ ad more documentation
+ ad NEWS
+ up manual
+ ad code th at forwards the energy calibration model during the call of dose_fit() and store
+ ad consideration of this energy calibration to dose_predict()
+ up show method for the calibration curve
+ ad a lot more tests
+ ad NEWS
@RLumSK RLumSK self-assigned this Sep 20, 2024
@RLumSK RLumSK added the enhancement New feature or request label Sep 20, 2024
@RLumSK RLumSK merged commit e921b0b into crp2a:master Sep 20, 2024
6 of 7 checks passed
@RLumSK RLumSK deleted the add_more_energy_calibration_methods branch September 20, 2024 10:44
@RLumSK
Copy link
Collaborator Author

RLumSK commented Sep 20, 2024

@nfrerebeau I had updated the snapshots but GA tell otherwise. I just merge and will check again after.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant