Last chance! 50% off unlimited learning
Sale ends in
Last chance! 50% off unlimited learning
Sale ends in
This function calculates common signal and noise metrics for OpenSpecy
objects.
sig_noise(x, ...)# S3 method for default
sig_noise(x, ...)
# S3 method for OpenSpecy
sig_noise(
x,
metric = "run_sig_over_noise",
na.rm = TRUE,
prob = 0.5,
step = 20,
breaks = seq(min(unlist(x$spectra)), max(unlist(x$spectra)), length =
((nrow(x$spectra)^(1/3)) * (max(unlist(x$spectra)) - min(unlist(x$spectra))))/(2 *
IQR(unlist(x$spectra)))),
sig_min = NULL,
sig_max = NULL,
noise_min = NULL,
noise_max = NULL,
abs = T,
spatial_smooth = F,
sigma = c(1, 1),
threshold = NULL,
...
)
A numeric vector containing the calculated metric for each spectrum in the
OpenSpecy
object or logical value if threshold is set describing if
the numbers where above or equal to (TRUE) the threshold.
an OpenSpecy
object.
character; specifying the desired metric to calculate.
Options include "sig"
(mean intensity), "noise"
(standard
deviation of intensity), "sig_times_noise"
(absolute value of
signal times noise), "sig_over_noise"
(absolute value of signal /
noise), "run_sig_over_noise"
(absolute value of signal /
noise where signal is estimated as the max intensity and noise is
estimated as the height of a low intensity region.),
"log_tot_sig"
(sum of the inverse log intensities, useful for spectra in log units),
"tot_sig"
(sum of intensities), or "entropy"
(Shannon entropy of intensities)..
logical; indicating whether missing values should be removed
when calculating signal and noise. Default is TRUE
.
numeric single value; the probability to retrieve for the quantile where the noise will be interpreted with the run_sig_over_noise option.
numeric; the step size of the region to look for the run_sig_over_noise option.
numeric; the number or positions of the breaks for entropy calculation. Defaults to infer a decent value from the data.
numeric; the minimum wavenumber value for the signal region.
numeric; the maximum wavenumber value for the signal region.
numeric; the minimum wavenumber value for the noise region.
numeric; the maximum wavenumber value for the noise region.
logical; whether to return the absolute value of the result
logical; whether to spatially smooth the sig/noise using the xy coordinates and a gaussian smoother.
numeric; two value vector describing standard deviation for smoother in each dimension, y is specified first followed by x, should be the same for each in most cases.
numeric; if NULL, no threshold is set, otherwise use a numeric value to set the target threshold which true signal or noise should be above. The function will return a logical value instead of numeric if a threshold is set.
further arguments passed to subfunctions; currently not used.
restrict_range()
data("raman_hdpe")
sig_noise(raman_hdpe, metric = "sig")
sig_noise(raman_hdpe, metric = "noise")
sig_noise(raman_hdpe, metric = "sig_times_noise")
Run the code above in your browser using DataLab