assess_spec() scans spectra for common quality-control issues and
returns one row for each issue found.
Usage
assess_spec(x, ...)
# Default S3 method
assess_spec(x, ...)
# S3 method for class 'OpenSpecy'
assess_spec(
x,
checks = c("high_tail", "silent_region", "co2_region", "missing_values",
"flat_spectrum", "negative_intensity", "low_snr"),
high_prob = 0.9,
artifact_ratio = 3,
tail_n = 5L,
silent_region = c(1800, 2000),
co2_region = c(2200, 2420),
snr_threshold = 4,
flat_tol = sqrt(.Machine$double.eps),
negative_tol = 0,
na.rm = TRUE,
...
)Arguments
- x
an
OpenSpecyobject.- checks
character; checks to run. Options include
"high_tail","silent_region","co2_region","missing_values","flat_spectrum","negative_intensity", and"low_snr".- high_prob
numeric; spectrum-wide quantile used as the high intensity threshold for the silent-region check.
- artifact_ratio
numeric; minimum ratio between the normalized maximum in a tail or carbon dioxide region and the normalized maximum outside both artifact regions required to flag an issue.
- tail_n
integer; number of points to check at each end of the spectrum.
- silent_region
numeric length two; wavenumber range expected to be mostly silent.
- co2_region
numeric length two; carbon dioxide wavenumber range.
- snr_threshold
numeric; spectra with run signal-to-noise below this value are flagged.
- flat_tol
numeric; maximum finite intensity range considered flat.
- negative_tol
numeric; minimum allowed intensity before a spectrum is flagged as negative.
- na.rm
logical; indicating whether missing values should be removed when calculating thresholds and metrics.
- ...
further arguments passed to
sig_noise()for the"low_snr"check.
Value
A data.table-class() with one row per issue found
and columns describing the spectrum, check, issue, likely cause, potential
fix, metric value, threshold, and region. If no issues are found, an empty
data.table with the same columns is returned.
Examples
data("raman_hdpe")
assess_spec(raman_hdpe)
#> Empty data.table (0 rows and 14 cols): spectrum_index,spectrum_id,check,issue,description,likely_cause...