Luminescence (version 0.8.6)

apply_CosmicRayRemoval: 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 an RLum.Data.Spectrum S4 class object

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 (required): S4 object of class RLum.Data.Spectrum

method

character (with default): Defines method that is applied for cosmic ray removal. Allowed methods are smooth, the default, (smooth), smooth.spline (smooth.spline) and Pych. See details for further information.

method.Pych.smoothing

integer (with default): Smoothing parameter for cosmic ray removal according to Pych (2003). The value defines how many neighboring values in each frame are used for smoothing (e.g., 2 means that the two previous and two following values are used).

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:

  • 1 = along the time axis (line by line),

  • 2 = along the wavelength axis (column by column).

Note: This argument currently only affects the methods smooth and smooth.spline

verbose

logical (with default): Option to suppress terminal output.,

plot

logical (with default): If TRUE the histograms used for the cosmic-ray removal are returned as plot including the used threshold. Note: A separat plot is returned for each frame! Currently only for method = "Pych" a graphical output is provided.

...

further arguments and graphical parameters that will be passed to the smooth function.

Value

Returns same object as input ('>RLum.Data.Spectrum)

Function version

0.2.1 (2018-01-21 17:22:38)

How to cite

Kreutzer, S. (2018). apply_CosmicRayRemoval(): Function to remove cosmic rays from an RLum.Data.Spectrum S4 class object. Function version 0.2.1. In: Kreutzer, S., Burow, C., Dietze, M., Fuchs, M.C., Schmidt, C., Fischer, M., Friedrich, J. (2018). Luminescence: Comprehensive Luminescence Dating Data Analysis. R package version 0.8.6. https://CRAN.R-project.org/package=Luminescence

Details

method = "Pych"

This method applies the cosmic-ray removal algorithm described by Pych (2003). Some aspects that are different to the publication:

  • For interpolation between neighbouring values the median and not the mean is used.

  • The number of breaks to construct the histogram is set to: length(number.of.input.values)/2

For further details see references below.

method = "smooth"

Method uses the function smooth to remove cosmic rays.

Arguments that can be passed are: kind, twiceit

method = "smooth.spline"

Method uses the function smooth.spline to remove cosmic rays.

Arguments that can be passed are: spar

How to combine methods?

Different methods can be combined by applying the method repeatedly to the dataset (see example).

References

Pych, W., 2003. A Fast Algorithm for Cosmic-Ray Removal from Single Images. Astrophysics 116, 148-153. http://arxiv.org/pdf/astro-ph/0311290.pdf?origin=publication_detail

See Also

'>RLum.Data.Spectrum, smooth, smooth.spline, apply_CosmicRayRemoval

Examples

Run this code
# NOT RUN {
##(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")

# }

Run the code above in your browser using DataLab