apply_CosmicRayRemoval {Luminescence} | R Documentation |
Function to remove cosmic rays from an RLum.Data.Spectrum S4 class object
Description
The function provides several methods for cosmic-ray removal and spectrum smoothing for RLum.Data.Spectrum objects, and those embedded in list or RLum.Analysis objects.
Usage
apply_CosmicRayRemoval(
object,
method = "smooth",
method.Pych.smoothing = 2,
method.Pych.threshold_factor = 3,
MARGIN = 2,
verbose = FALSE,
plot = FALSE,
...
)
Arguments
object |
RLum.Data.Spectrum or RLum.Analysis (required): input
object to be treated. This can be also provided as list. If an RLum.Analysis object
is provided, only the RLum.Data.Spectrum objects are treated. Please note: this mixing of
objects does not work for a list of |
method |
character (with default):
Defines method that is applied for cosmic ray removal. Allowed methods are
|
method.Pych.smoothing |
integer (with default):
Smoothing parameter for cosmic ray removal according to Pych (2003).
The value defines how many neighbouring values in each frame are used for smoothing
(e.g., |
method.Pych.threshold_factor |
numeric (with default): Threshold for zero-bins in the histogram. Small values mean that more peaks are removed, but signal might be also affected by this removal. |
MARGIN |
integer (with default): on which part the function cosmic ray removal should be applied on:
Note: This argument currently only affects the methods |
verbose |
logical (with default): enable/disable output to the terminal. |
plot |
logical (with default):
If |
... |
further arguments and graphical parameters that will be passed to the stats::smooth, stats::smooth.spline or smooth_RLum. See details for more information. |
Details
method = "Pych"
This method applies the cosmic-ray removal algorithm described by Pych (2003). There are some differences with respect to the publication:
For interpolation between neighbouring values the median is used instead of the mean.
The number of breaks in the histogram is set to half the number of the input values.
For further details see references below.
Other methods
Arguments supported through ...
METHOD | ARGUMENT | TYPE | REMARKS |
"smooth" | kind | character | see stats::smooth |
twiceit | logical | see stats::smooth | |
"smooth.spline" | spar | numeric | see stats::smooth.spline |
"smooth_RLum" | k | numeric | see smooth_RLum |
fill | numeric | see smooth_RLum | |
align | character | see smooth_RLum | |
method | character | see smooth_RLum | |
Best practice
There is no single silver-bullet strategy for cosmic-ray removal, as it depends on the characteristic of the detector and the chosen settings. For instance, high values for pixel binning will improve the light output, but also cause multiple pixels being affected by a single cosmic-ray. The same is valid for longer integration times. The best strategy is to combine methods and ensure that the spectrum is not distorted on a case-to-case basis.
How to combine methods?
Different methods can be combined by applying the method repeatedly to the dataset (see example).
Value
Returns same object as input.
Function version
0.4.0
How to cite
Kreutzer, S., 2025. apply_CosmicRayRemoval(): Function to remove cosmic rays from an RLum.Data.Spectrum S4 class object. Function version 0.4.0. In: Kreutzer, S., Burow, C., Dietze, M., Fuchs, M.C., Schmidt, C., Fischer, M., Friedrich, J., Mercier, N., Philippe, A., Riedesel, S., Autzen, M., Mittelstrass, D., Gray, H.J., Galharret, J., Colombo, M., Steinbuch, L., Boer, A.d., 2025. Luminescence: Comprehensive Luminescence Dating Data Analysis. R package version 1.1.0. https://r-lum.github.io/Luminescence/
Author(s)
Sebastian Kreutzer, Institute of Geography, Heidelberg University (Germany) , RLum Developer Team
References
Pych, W., 2004. A Fast Algorithm for Cosmic-Ray Removal from Single Images. The Astronomical Society of the Pacific 116 (816), 148-153. doi:10.1086/381786
See Also
RLum.Data.Spectrum, RLum.Analysis, stats::smooth, stats::smooth.spline, smooth_RLum
Examples
##(1) - use with your own data and combine (uncomment for usage)
## run two times the default method and smooth with another method
## your.spectrum <- apply_CosmicRayRemoval(your.spectrum, method = "Pych")
## your.spectrum <- apply_CosmicRayRemoval(your.spectrum, method = "Pych")
## your.spectrum <- apply_CosmicRayRemoval(your.spectrum, method = "smooth")