Function that returns a subset of an R object with observations corresponding to spikes. Spikes are values in spectra that are unusually high compared to neighbors. They are usually individual values or very short runs of similar "unusual" values. Spikes caused by cosmic radiation are a frequent problem in Raman spectra. Another source of spikes are "hot pixels" in CCD and diode arrays.
spikes(x, z.threshold, max.spike.width, na.rm, ...)# S3 method for default
spikes(x, z.threshold = NA, max.spike.width = 8, na.rm = FALSE, ...)
# S3 method for numeric
spikes(x, z.threshold = NA, max.spike.width = 8, na.rm = FALSE, ...)
# S3 method for data.frame
spikes(
x,
z.threshold = 9,
max.spike.width = 8,
na.rm = FALSE,
...,
y.var.name = NULL,
var.name = y.var.name
)
# S3 method for generic_spct
spikes(
x,
z.threshold = 9,
max.spike.width = 8,
na.rm = FALSE,
...,
var.name = NULL
)
# S3 method for source_spct
spikes(
x,
z.threshold = 9,
max.spike.width = 8,
na.rm = FALSE,
unit.out = getOption("photobiology.radiation.unit", default = "energy"),
...
)
# S3 method for response_spct
spikes(
x,
z.threshold = 9,
max.spike.width = 8,
na.rm = FALSE,
unit.out = getOption("photobiology.radiation.unit", default = "energy"),
...
)
# S3 method for filter_spct
spikes(
x,
z.threshold = 9,
max.spike.width = 8,
na.rm = FALSE,
filter.qty = getOption("photobiology.filter.qty", default = "transmittance"),
...
)
# S3 method for reflector_spct
spikes(x, z.threshold = 9, max.spike.width = 8, na.rm = FALSE, ...)
# S3 method for cps_spct
spikes(
x,
z.threshold = 9,
max.spike.width = 8,
na.rm = FALSE,
...,
var.name = "cps"
)
# S3 method for raw_spct
spikes(
x,
z.threshold = 9,
max.spike.width = 8,
na.rm = FALSE,
...,
var.name = "counts"
)
# S3 method for generic_mspct
spikes(
x,
z.threshold = 9,
max.spike.width = 8,
na.rm = FALSE,
...,
var.name = NULL,
.parallel = FALSE,
.paropts = NULL
)
# S3 method for source_mspct
spikes(
x,
z.threshold = 9,
max.spike.width = 8,
na.rm = FALSE,
unit.out = getOption("photobiology.radiation.unit", default = "energy"),
...,
.parallel = FALSE,
.paropts = NULL
)
# S3 method for response_mspct
spikes(
x,
z.threshold = 9,
max.spike.width = 8,
na.rm = FALSE,
unit.out = getOption("photobiology.radiation.unit", default = "energy"),
...,
.parallel = FALSE,
.paropts = NULL
)
# S3 method for filter_mspct
spikes(
x,
z.threshold = 9,
max.spike.width = 8,
na.rm = FALSE,
filter.qty = getOption("photobiology.filter.qty", default = "transmittance"),
...,
.parallel = FALSE,
.paropts = NULL
)
# S3 method for reflector_mspct
spikes(
x,
z.threshold = 9,
max.spike.width = 8,
na.rm = FALSE,
...,
.parallel = FALSE,
.paropts = NULL
)
# S3 method for cps_mspct
spikes(
x,
z.threshold = 9,
max.spike.width = 8,
na.rm = FALSE,
...,
var.name = "cps",
.parallel = FALSE,
.paropts = NULL
)
# S3 method for raw_mspct
spikes(
x,
z.threshold = 9,
max.spike.width = 8,
na.rm = FALSE,
...,
var.name = "counts",
.parallel = FALSE,
.paropts = NULL
)
an R object
numeric Modified Z values larger than z.threshold
are considered to correspond to spikes.
integer Wider regions with high Z values are not detected as spikes.
logical indicating whether NA
values should be stripped
before searching for spikes.
ignored
character Name of column where to look for spikes.
character One of "energy" or "photon"
character One of "transmittance" or "absorbance"
if TRUE, apply function in parallel, using parallel backend provided by foreach
a list of additional options passed into the foreach function when parallel computation is enabled. This is important if (for example) your code relies on external data or packages: use the .export and .packages arguments to supply them so that all cluster nodes have the correct environment set up for computing.
A subset of x
with rows corresponding to spikes.
default
: Default returning always NA.
numeric
: Default function usable on numeric vectors.
data.frame
: Method for "data.frame" objects.
generic_spct
: Method for "generic_spct" objects.
source_spct
: Method for "source_spct" objects.
response_spct
: Method for "response_spct" objects.
filter_spct
: Method for "filter_spct" objects.
reflector_spct
: Method for "reflector_spct" objects.
cps_spct
: Method for "cps_spct" objects.
raw_spct
: Method for "raw_spct" objects.
generic_mspct
: Method for "generic_mspct" objects.
source_mspct
: Method for "source_mspct" objects.
response_mspct
: Method for "cps_mspct" objects.
filter_mspct
: Method for "filter_mspct" objects.
reflector_mspct
: Method for "reflector_mspct" objects.
cps_mspct
: Method for "cps_mspct" objects.
raw_mspct
: Method for "raw_mspct" objects.
See the documentation for find_spikes
for details of
the algorithm and implementation.
Other peaks and valleys functions:
find_peaks()
,
find_spikes()
,
get_peaks()
,
peaks()
,
replace_bad_pixs()
,
valleys()
,
wls_at_target()
# NOT RUN {
spikes(sun.spct)
# }
Run the code above in your browser using DataLab