← Back to all sparks
P

prospectr

INFRA · APIS
Velocity0.0

Miscellaneous Functions for Processing and Sample Selection of Spectroscopic Data

prospectr spent its biggest release in years fixing spectra it had been quietly mangling.

spectroscopysignal-processingpreprocessingcalibration-samplingr-packages
Current state
prospectr provides the signal-processing layer for near-infrared and visible spectroscopy in R — Savitzky-Golay and gap-segment derivatives, standard normal variate, detrending, continuum removal, splice correction, plus calibration sampling algorithms like Kennard-Stone and DUPLEX and readers for ASD and BUCHI NIRCal instrument files. The May release is the substantial one: a long list of corrections to functions that were returning wrong or missing values rather than failing.
Where it's heading
The recent work is corrective rather than additive, and several items changed results silently before being caught. continuumRemoval() derived its convex-hull boundary offset from a fixed one-wavelength assumption that broke for fine-resolution spectra or non-nanometre units; cochranTest() passed an invalid argument name to prcomp() and produced incorrect principal component scores; readASD() silently dropped spectra in one branch of its text path. Two file readers were leaking connections. Alongside that runs a smaller thread of decoupling preprocessing steps from each other, most visibly detrend() gaining an snv argument so polynomial detrending can run without the SNV transform that Barnes et al. bundled with it.
Prediction
The detrend() decoupling is the only recent addition and it fits a broader pipeline-composition direction, so similar separation of other bundled preprocessing steps is the plausible next move. The misspelled substraction argument now carries a deprecation warning, which schedules its removal for a future release.

Recent moves

  1. 1mo ago

    detrend() can run without a prior SNV transformation

    A single-purpose release promoting the snv argument added in the previous version: polynomial detrending can now be applied as an independent pipeline step rather than always following SNV as in the original Barnes formulation. The default is unchanged.

    View source ↗
  2. 2mo ago

    Continuum removal, SNV and cochranTest corrected; readers stop leaking

    The correction release the package needed. continuumRemoval() becomes unit-agnostic by deriving its hull offset from actual spectral resolution and stops producing NaN at zero-reflectance bands; standardNormalVariate() handles zero-variance rows silently; cochranTest() had been passing a bad argument to prcomp() and returning incorrect PC scores. readASD() and read_nircal() both had connection leaks, and readASD() was silently dropping spectra in one path. Note the entry title says 2.2.9 while the release is 0.2.9.

    View source ↗
  3. 1y ago

    read_nircal() sample ID field fix

    A narrow fix to how the BUCHI NIRCal reader parses the sample ID field — the fourth reader-related patch in this feed.

    View source ↗
  4. 3y ago

    Non-UTF8 sample IDs no longer become NA

    Sample IDs with non-UTF8 characters were being converted to NA by read_nircal(); they now map to their corresponding codes. Documentation moves to HTML5.

    View source ↗
  5. 4y ago

    kenStone() bug fix

    A one-line release fixing a bug in the Kennard-Stone calibration sampling function, with no detail given on what it affected.

    View source ↗
  6. 4y ago

    read_nircal() execution failure fixed

    A patch for a bug that prevented read_nircal() from running at all — part of the same run of instrument-reader repairs.

    View source ↗