Skip to content

Preprocessing Nodes

Summary

Reference: nodes that transform spectra before modeling — scatter correction, derivatives, smoothing, baseline handling, alignment, and clipping.

Preprocessing nodes transform spectra before modeling.

Most preprocessing nodes accept a SpectralDataset port and return a transformed SpectralDataset port. At runtime, those ports carry SherpaDataset objects with spectral axes and processing history, so reports and exported workflows can show what happened before modeling.

Baseline, Smoothing, and Derivatives

  • baseline.penalized_ls: Correct smooth fluorescence, scattering, or instrument baseline while preserving peaks. Larger lam makes a smoother baseline.
  • baseline.rubberband: You want the cited lower-convex-envelope baseline removed from every spectrum. Use Clip Range upstream to select an interval.
  • preprocess.smooth: Reduce noise before derivatives, peak finding, or visualization. For Savitzky-Golay, size should be odd and larger than order.
  • preprocess.derivative: Remove broad baseline trends or emphasize bands; common for NIR and Raman preprocessing. Derivatives amplify noise, so smooth carefully.
  • preprocess.cosmic_ray: Remove Raman spike artifacts before modeling or peak finding. Uses centered local median and MAD-style spike detection. The first and last (window - 1) / 2 features are preserved unassessed because a complete centered neighborhood is unavailable there.

SciPy's savgol_filter is the underlying reference point for Savitzky-Golay concepts such as window length, polynomial order, and derivative order: https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.savgol_filter.html.

Rubberband baseline correction follows the spectroscopy treatment discussed by Butler et al., Analyst 143 (2018), DOI 10.1039/C8AN01384E. Its lower convex envelope uses Andrew's monotone-chain construction, Information Processing Letters 9 (1979), DOI 10.1016/0020-0190(79)90072-3. The full connected spectral interval is used; place Clip Range upstream when only a declared interval should be corrected.

Managed optimization coverage

The expanded managed profile includes Clip Feature Range, Rubberband, Cosmic Ray Removal, and Clip Floor, alongside the existing normalization, smoothing, derivatives, scaling, MSC, EMSC, OSC and penalized baseline operations. Each proposed recipe runs through the canonical nodes during validation and full refit. Its canonical application package repeats the recorded preprocessing on new spectra. Sample-local corrections are recomputed independently for each incoming spectrum; no population-fitted correction is relearned from prediction samples.

  • Clip Feature Range: bounds use the measured axis units and must stay inside the source range for new or edited campaign intervals. An unchanged seed interval may surround the source range (for example 400–4000 on 650–4000 data). Keep/remove intervals preserve axis order. Removing an internal band does not make the remaining coordinates uniformly spaced; operations requiring a uniform grid can still refuse it.
  • Rubberband: correction uses each spectrum's lower convex envelope. Endpoints can become constant; autoscaled PLS can refuse them. Mean-centered PLS avoids scaling those constant columns. The proposal compiler refuses a known constant- endpoint path into autoscaled PLS before spending a trial; it does not mistake standalone Scale / Center's safe constant-variable handling for that refusal.
  • Cosmic Ray Removal: removes local spikes with the recorded window and threshold. Review narrow real peaks before accepting a correction.
  • Clip Floor: enforces a declared intensity floor. This is appropriate when the measurement/model requires it, not a general promise of improved PLS.

Clip Range's numerical reference is NumPy Boolean indexing; Clip Floor uses lower-bound clipping. These references define the operators, not a promise of improved predictions.

Managed eligibility does not certify every combination of parameters or inputs. Ordinary legacy saved-model replay keeps its existing unsupported-operation refusals; this promotion qualifies the canonical application-package path.

Wavenumber Align remains outside this expansion. Time-series windows/trends, paired-reference scaling and instrument-transfer operations need separate validation of ordering or reference populations. Apply Fitted nodes consume a recorded correction rather than propose a new fitting step. Additional wavelength selection methods are deferred without a scheduled date.

A campaign created under the previous managed profile retains its recorded results for inspection. Start a fresh campaign to use the expanded profile; previous results are not rewritten or treated as new-profile execution evidence.

Range, Alignment, Normalization, and Scaling

  • preprocess.clip_range: Keep a chemically relevant wavenumber range and drop unneeded variables. Check axis direction after cropping.
  • preprocess.clip_floor: Remove negative values before non-negative methods such as NMF.
  • preprocess.wavenumber_align: Align absolute-wavenumber spectra onto a common spectral grid before stacking, transfer, or comparison. Both inputs must declare absolute wavenumber in canonical cm-1; Raman shift is a different quantity and is refused. The connected reference supplies the exact output grid. A finer output grid is interpolation and does not add measured spectral resolution.
  • preprocess.normalize: Apply sample-local SNV or row scaling; no cohort statistics are learned.
  • preprocess.msc: Fit a reference spectrum from a declared cohort, then correct additive and multiplicative scatter with that frozen reference. Connect training/reference rows to reference when correcting held-out or future samples. first is row-order sensitive.
  • preprocess.scale: Fit mean-centering, autoscaling, or Pareto statistics before PCA, PLS, SVR, or KNN. Sample-wise maximum scaling is preprocess.normalize with method=scale and scale_method=max.
  • preprocess.shared_reference_scale: Fit one scale state on retained calibration rows and apply it to both branches of a fixed held-out PLS split. Connect reference_scaled to PLS training and default to its prediction node. This separate operation preserves the historical Scale / Center contract.
  • preprocess.emsc: Fit a reference spectrum and polynomial nuisance basis, then correct spectra with that frozen state. first means the first ordered reference row and is therefore row-order sensitive; prefer an explicit one-row reference input when that spectrum is intentional. Connect training rows to reference when correcting held-out or future samples; connect known interferent spectra to constituents.
  • preprocess.osc: Remove spectral variation orthogonal to the target before calibration. Use only inside validation folds to avoid leakage.

Apply Frozen Preprocessing State

These application nodes replay a state fitted by the corresponding producer. They do not refit a reference, scaling vector, constituent basis, or target- orthogonal projection on application data.

Time-Series Helpers

Calibration Transfer

  • transfer.pds: Fit local PLS maps from paired primary/secondary standards. Unsupported local rank is rejected rather than silently reduced.
  • transfer.sws: Fit one affine secondary-to-primary relation at each wavelength from exactly paired standards. Requires identical measured spectral axes and non-constant secondary channels.
  • transfer.ds: Fit the published global Moore-Penrose secondary-to-primary spectral map. Primary and secondary feature counts may differ because the fitted matrix binds both axes.
  • transfer.apply_fitted: Apply an upstream digest-bound PDS, DS, or SWS state without refitting standards. The application axis and units must match the fitted secondary space exactly.

The Calibration Transfer Method Comparison starter splits the same paired M5/MP5 measurements by ordered sample identity, fits all three methods on the training standards, and applies each frozen state only to the held-out MP5 rows. It does not treat MP6 as if it came from the MP5 instrument. The displayed transfer-error tables describe training-standard reconstruction; held-out primary-versus-standardized error remains a separate evaluation step and is not implied by those tables.

Notes

Preprocessing nodes in the current registry are Sherpa-native. The optional SpectroChemPy boundary is limited to the private matrix adapter used by EFA, MCR-ALS, and SIMPLISMA; it adds no preprocessing, reference-data, public conversion, or file-reader authority.

EMSC is a fitted transform. Its saved state binds the reference spectrum, optional constituent spectra, feature coordinates, and units. Applying that state to a different feature axis fails rather than silently recomputing or coercing the correction. The node is available for local workbench workflows; managed-search eligibility requires a separately reviewed, bounded search envelope.

MSC is also a fitted transform. SNV and row scaling remain under preprocess.normalize because they are sample-local; MSC has its own operation identity because its reference must be learned from declared training/reference rows and replayed without refitting. Its saved state binds the reference method, reference spectrum, feature coordinates, and units. Managed-search eligibility requires a separately reviewed, bounded search envelope.

Wavenumber alignment records the source and reference axis quantities, whether the reference grid is finer than the measured source grid, and the corresponding upsampling factor. This is an interpolation-density statement only: no interpolation method creates spectral resolution that the instrument did not measure. When collection assembly or a common-grid operation refuses otherwise compatible absolute-wavenumber inputs, its error names preprocess.wavenumber_align as the explicit remediation rather than silently interpolating during admission.

Reference scaling input authority

Scaling state serializer 2 binds its means/scales to the ordered feature axis (or tabular feature labels), signal units, declared signal quantity and measurement mode. These checks apply to the live reference port, saved state, generated Python, and saved-model preprocessing replay. A feature count alone is insufficient. Reordering requires an explicit alignment before scaling.

Scaling state serializer 1 did not retain this authority and requires refitting for current replay; its historical evidence remains unchanged. Two anonymous arrays still support positional research, without a claim of named feature or signal compatibility. Saved preprocessing chains preserve the live unit effects of normalization, MSC, scaling and derivatives before checking the next fitted operation.

Pareto scaling divides by the square root of standard deviation, so dimensional signal units become square-root units, for example sqrt(mg/L). Unknown units remain unknown; they are not relabeled dimensionless.

MSC reference signal authority

MSC serializer 2 retains ordered feature identity, reference signal units, signal quantity and measurement mode. Application requires compatible authority before correction: conversions must be explicit. MSC fits X = b R + a and returns (X-a)/b, whose units belong to reference R; it does not produce a dimensionless spectrum unless the reference is dimensionless. Unknown units remain unknown. Live execution, generated Python and saved-model replay use the same state. Serializer 1 lacks this evidence and requires refitting; historical records are not silently upgraded. A first reference retains an actual training spectrum, so it must not be treated as data-free state.

Numerical inclusion and boundary safeguards

Reference fitting (including centering, autoscale, and MSC) refuses datasets with unmaterialized sample or variable exclusions. Apply the explicit sample and variable filters first. Autoscale and internal PCA scaling treat variation within a column-relative floating-point resolution bound as constant, avoiding unit-weight amplification of roundoff. Internal PLS autoscaling refuses such columns, as it does exact constants. Meaningful low-amplitude signals near zero remain eligible for scaling.

Norris–Williams derivatives retain zero-filled unsupported edge positions. The second derivative has twice the first derivative's unsupported margin: 2 * (gap + segment - 1) points on each side. Its averaging stencils never use artificial zeros from the first pass. Settings leaving no valid interior are rejected.

Registry reference

Generated from registered node metadata. Edit methodology and examples outside the marked section. Defaults and options below are JSON values; null means no concrete default is declared. Internal parameters are retained for contract inspection and are not scientist-editable controls. Conditional visibility describes the editor; execution admission remains node-owned.

Node Operation
Baseline (Penalized LS) baseline.penalized_ls
Baseline (Rubberband) baseline.rubberband
Apply Reference EMSC (Imported) preprocess.apply_fitted_emsc
Apply Reference MSC (Imported) preprocess.apply_fitted_msc
Apply Reference OSC (Imported) preprocess.apply_fitted_osc
Apply Reference Scale (Imported) preprocess.apply_fitted_scale
Clip Floor preprocess.clip_floor
Clip Feature Range preprocess.clip_range
Cosmic Ray Removal preprocess.cosmic_ray
Derivative preprocess.derivative
EMSC preprocess.emsc
Multiplicative Scatter Correction (MSC) preprocess.msc
Normalize preprocess.normalize
Orthogonal Signal Correction preprocess.osc
Scale / Center preprocess.scale
Shared Reference Scale preprocess.shared_reference_scale
Smooth preprocess.smooth
Wavenumber Align preprocess.wavenumber_align
Moving Window time_series.moving_window
Trend Removal time_series.trend_removal
Apply Fitted Spectral Transfer transfer.apply_fitted
Direct Standardization transfer.ds
Piecewise Direct Standardization transfer.pds
Single-Wavelength Standardization transfer.sws

Baseline (Penalized LS) (baseline.penalized_ls)

Ports

Direction Port Type URI Required Variadic Accepted data roles
input default spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]
output default spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]

Parameters

Parameter Editor type Required Default Options / enum Bounds / step Visibility / category Description
method select true "als" ["als", "arpls", "airpls"] — {"category": "basic"} Closed penalized least-squares algorithm choice.
lam number false 100000.0 — {"min_value": 100.0} {"category": "basic"} Exact smoothness penalty; larger values produce a smoother baseline. Hosted execution requires lambda at most 1e9. Increase by about 10× for residual baseline curvature; decrease if peaks flatten.
p number false 0.001 — {"max_value": 0.9999, "min_value": 0.0001, "step": 0.0001} {"category": "basic", "visible_when": {"method": ["als"]}} Exact ALS asymmetry; non-default values are rejected for ArPLS and AirPLS. Hosted execution requires ALS asymmetry at most 0.1. Keeps both ALS weight classes at or above 1e-4 so neither side of the asymmetric fit becomes numerically zero-weighted.
max_iter number false 50 — {"max_value": 1000, "min_value": 5, "step": 5} {"category": "advanced"} Iteration limit per spectrum. A spectrum that reaches it keeps its last baseline and is reported in a warning. Hosted execution admits at most 100 iterations per spectrum. Caps the number of sparse linear solves per spectrum so the node remains inside its declared local worker resource envelope.
tol number false 1e-06 — {"max_value": 0.999999, "min_value": 1e-10} {"category": "advanced"} Finite convergence tolerance strictly between zero and one. Hosted execution requires tolerance at most 1e-2. Preserves the algorithm's strict tolerance-below-one invariant at the six-decimal UI precision.

Baseline (Rubberband) (baseline.rubberband)

Ports

Direction Port Type URI Required Variadic Accepted data roles
input default spectrasherpa://types/SpectralDataset/1.0 true false []
output default spectrasherpa://types/SpectralDataset/1.0 true false []

Parameters

No parameters.

Apply Reference EMSC (Imported) (preprocess.apply_fitted_emsc)

Ports

Direction Port Type URI Required Variadic Accepted data roles
input default spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]
output default spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]

Parameters

Parameter Editor type Required Default Options / enum Bounds / step Visibility / category Description
artifact_digest text true null — — {"category": "internal"} —
serializer text true null — — {"category": "internal"} —
source_contract_digest text true null — — {"category": "internal"} —
state_content_digest text true null — — {"category": "internal"} —
state_digest text true null — — {"category": "internal"} —
state_node_id text true null — — {"category": "internal"} —

Apply Reference MSC (Imported) (preprocess.apply_fitted_msc)

Ports

Direction Port Type URI Required Variadic Accepted data roles
input default spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]
output default spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]

Parameters

Parameter Editor type Required Default Options / enum Bounds / step Visibility / category Description
artifact_digest text true null — — {"category": "internal"} —
serializer text true null — — {"category": "internal"} —
source_contract_digest text true null — — {"category": "internal"} —
state_content_digest text true null — — {"category": "internal"} —
state_digest text true null — — {"category": "internal"} —
state_node_id text true null — — {"category": "internal"} —

Apply Reference OSC (Imported) (preprocess.apply_fitted_osc)

Ports

Direction Port Type URI Required Variadic Accepted data roles
input default spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]
output default spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]

Parameters

Parameter Editor type Required Default Options / enum Bounds / step Visibility / category Description
artifact_digest text true null — — {"category": "internal"} —
serializer text true null — — {"category": "internal"} —
source_contract_digest text true null — — {"category": "internal"} —
state_content_digest text true null — — {"category": "internal"} —
state_digest text true null — — {"category": "internal"} —
state_node_id text true null — — {"category": "internal"} —

Apply Reference Scale (Imported) (preprocess.apply_fitted_scale)

Ports

Direction Port Type URI Required Variadic Accepted data roles
input default spectrasherpa://types/SpectralDataset/1.0 true false []
output default spectrasherpa://types/SpectralDataset/1.0 true false []

Parameters

Parameter Editor type Required Default Options / enum Bounds / step Visibility / category Description
artifact_digest text true null — — {"category": "internal"} —
serializer text true null — — {"category": "internal"} —
source_contract_digest text true null — — {"category": "internal"} —
state_content_digest text true null — — {"category": "internal"} —
state_digest text true null — — {"category": "internal"} —
state_node_id text true null — — {"category": "internal"} —

Clip Floor (preprocess.clip_floor)

Ports

Direction Port Type URI Required Variadic Accepted data roles
input default spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]
output default spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]

Parameters

Parameter Editor type Required Default Options / enum Bounds / step Visibility / category Description
floor number true 0.0 — {"step": 0.001} {"category": "basic"} Exact minimum value; every smaller finite value is set to this threshold.

Clip Feature Range (preprocess.clip_range)

Ports

Direction Port Type URI Required Variadic Accepted data roles
input default spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]
output default spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]

Parameters

Parameter Editor type Required Default Options / enum Bounds / step Visibility / category Description
minimum number true 400.0 — — {"category": "basic"} Inclusive lower bound expressed in the input feature-axis units.
maximum number true 4000.0 — — {"category": "basic"} Inclusive upper bound expressed in the input feature-axis units.
exclude_range boolean true false — — {"category": "basic"} When checked, remove the inclusive range and keep features outside it.

Cosmic Ray Removal (preprocess.cosmic_ray)

Ports

Direction Port Type URI Required Variadic Accepted data roles
input default spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]
output default spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]

Parameters

Parameter Editor type Required Default Options / enum Bounds / step Visibility / category Description
window number true 7 — {"max_value": 101, "min_value": 3, "step": 2} {"category": "basic"} Odd number of spectral features in each local Hampel neighborhood. The half-window at each spectrum edge is preserved unassessed. Bounds the per-spectrum neighborhood work while covering a much wider region than an isolated detector spike.
zscore number true 3.0 — {"min_value": 1.5, "step": 0.5} {"category": "basic"} Threshold in normal-consistent local MAD scale units.

Derivative (preprocess.derivative)

Ports

Direction Port Type URI Required Variadic Accepted data roles
input default spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]
output default spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]

Parameters

Parameter Editor type Required Default Options / enum Bounds / step Visibility / category Description
method select true "savitzky_golay" [{"label": "Savitzky-Golay", "value": "savitzky_golay"}, {"label": "Norris-Williams", "value": "norris_williams"}] — {"category": "basic"} Derivative algorithm
deriv select true "1" ["1", "2"] — {"category": "basic"} First or second derivative order
size number false 11 — {"min_value": 3, "step": 2} {"category": "basic", "visible_when": {"method": ["savitzky_golay"]}} Odd Savitzky-Golay window size. Hosted execution admits Savitzky-Golay windows from 5 through 31 points.
order number false 2 — {"min_value": 1, "step": 1} {"category": "basic", "visible_when": {"method": ["savitzky_golay"]}} Savitzky-Golay polynomial order. Hosted execution admits polynomial orders from 2 through 4.
gap number false 5 — {"min_value": 1, "step": 1} {"category": "basic", "visible_when": {"method": ["norris_williams"]}} Norris-Williams gap size. Hosted execution admits Norris-Williams gaps from 1 through 15.
segment number false 5 — {"min_value": 1, "step": 1} {"category": "basic", "visible_when": {"method": ["norris_williams"]}} Norris-Williams segment size. Hosted execution admits Norris-Williams segments from 1 through 15.

EMSC (preprocess.emsc)

Ports

Direction Port Type URI Required Variadic Accepted data roles
input default spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]
input reference spectrasherpa://types/SpectralDataset/1.0 false false ["X_spectra"]
input constituents spectrasherpa://types/SpectralDataset/1.0 false false ["X_spectra"]
output default spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]

Parameters

Parameter Editor type Required Default Options / enum Bounds / step Visibility / category Description
reference_method select true "mean" [{"label": "Mean of reference rows", "value": "mean"}, {"label": "Median of reference rows", "value": "median"}, {"label": "First reference row (order-sensitive)", "value": "first"}] — {"category": "basic"} Rule used to fit the reference spectrum. 'First' means the first row of the ordered reference input and therefore changes if those rows are reordered; prefer an explicit one-row reference input when that spectrum is intentional.
poly_order number true 2 — {"max_value": 5, "min_value": 0, "step": 1} {"category": "basic"} Polynomial nuisance order, including the constant term. Higher orders are unstable and confound spectral structure with baseline shape.

Multiplicative Scatter Correction (MSC) (preprocess.msc)

Ports

Direction Port Type URI Required Variadic Accepted data roles
input default spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]
input reference spectrasherpa://types/SpectralDataset/1.0 false false ["X_spectra"]
output default spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]

Parameters

Parameter Editor type Required Default Options / enum Bounds / step Visibility / category Description
reference_method select true "mean" [{"label": "Mean of reference rows", "value": "mean"}, {"label": "Median of reference rows", "value": "median"}, {"label": "First reference row (order-sensitive)", "value": "first"}] — {"category": "basic"} Rule used to fit the reference spectrum. 'First' is row-order sensitive; connect an explicit one-row reference when that spectrum is intentional. Hosted managed execution admits mean or median only; use mean with an explicit one-row reference to apply that exact spectrum.

Normalize (preprocess.normalize)

Ports

Direction Port Type URI Required Variadic Accepted data roles
input default spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]
output default spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]

Parameters

Parameter Editor type Required Default Options / enum Bounds / step Visibility / category Description
method select true "snv" [{"label": "SNV", "value": "snv"}, {"label": "Scale", "value": "scale"}] — {"category": "basic"} Normalization method
std_ddof select false 0 [{"label": "Population (ddof=0)", "value": 0}, {"label": "Sample (ddof=1)", "value": 1}] — {"category": "advanced", "visible_when": {"method": ["snv"]}} Standard-deviation convention used by SNV
scale_method select false "max" ["max", "area", "minmax"] — {"category": "basic", "visible_when": {"method": ["scale"]}} Sample-wise scaling method

Orthogonal Signal Correction (preprocess.osc)

Ports

Direction Port Type URI Required Variadic Accepted data roles
input default spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]
input reference spectrasherpa://types/SpectralDataset/1.0 false false ["X_spectra"]
input y spectrasherpa://types/TargetMatrix/1.0 false false ["y_continuous"]
output default spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]

Parameters

Parameter Editor type Required Default Options / enum Bounds / step Visibility / category Description
n_components number true 1 — {"max_value": 10, "min_value": 1, "step": 1} {"category": "basic"} Dominant target-orthogonal spectral components to remove. Bounds SVD work and prevents an interactive correction from removing an unreviewably broad orthogonal subspace; resolved data rank imposes the tighter runtime limit.

Scale / Center (preprocess.scale)

Ports

Direction Port Type URI Required Variadic Accepted data roles
input default spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra", "X_features"]
input reference spectrasherpa://types/SpectralDataset/1.0 false false ["X_spectra", "X_features"]
output default spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra", "X_features"]

Parameters

Parameter Editor type Required Default Options / enum Bounds / step Visibility / category Description
method select true "mean_center" [{"label": "Mean Center", "value": "mean_center"}, {"label": "Autoscale", "value": "autoscale"}, {"label": "Pareto", "value": "pareto"}] — {"category": "basic"} Reference-fitted scaling method.
center boolean false true — — {"category": "basic", "visible_when": {"method": ["autoscale", "pareto"]}} Subtract the fitted reference mean before autoscaling or Pareto scaling.

Shared Reference Scale (preprocess.shared_reference_scale)

Ports

Direction Port Type URI Required Variadic Accepted data roles
input default spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra", "X_features"]
input reference spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra", "X_features"]
output default spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra", "X_features"]
output reference_scaled spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra", "X_features"]

Parameters

Parameter Editor type Required Default Options / enum Bounds / step Visibility / category Description
method select true "mean_center" [{"label": "Mean Center", "value": "mean_center"}, {"label": "Autoscale", "value": "autoscale"}, {"label": "Pareto", "value": "pareto"}] — {"category": "basic"} Reference-fitted scaling method.
center boolean false true — — {"category": "basic", "visible_when": {"method": ["autoscale", "pareto"]}} Subtract the fitted reference mean before autoscaling or Pareto scaling.

Smooth (preprocess.smooth)

Ports

Direction Port Type URI Required Variadic Accepted data roles
input default spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]
output default spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]

Parameters

Parameter Editor type Required Default Options / enum Bounds / step Visibility / category Description
method select true "savitzky_golay" [{"label": "Savitzky-Golay", "value": "savitzky_golay"}, {"label": "Whittaker", "value": "whittaker"}, {"label": "Gaussian", "value": "gaussian"}] — {"category": "basic"} Smoothing algorithm
size number true 11 — {"min_value": 3, "step": 2} {"category": "basic", "visible_when": {"method": ["savitzky_golay"]}} Odd Savitzky-Golay window size
order number true 2 — {"min_value": 1, "step": 1} {"category": "basic", "visible_when": {"method": ["savitzky_golay"]}} Savitzky-Golay polynomial order
lam number true 100.0 — {"min_value": 1} {"category": "basic", "visible_when": {"method": ["whittaker"]}} Whittaker smoothness penalty
d select true "2" ["1", "2", "3"] — {"category": "advanced", "visible_when": {"method": ["whittaker"]}} Whittaker difference order
sigma number true 2.0 — {"min_value": 0.1, "step": 0.1} {"category": "basic", "visible_when": {"method": ["gaussian"]}} Gaussian kernel width

Wavenumber Align (preprocess.wavenumber_align)

Ports

Direction Port Type URI Required Variadic Accepted data roles
input spectra spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]
input reference spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]
output default spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]

Parameters

Parameter Editor type Required Default Options / enum Bounds / step Visibility / category Description
method select true "pchip" ["pchip", "linear", "sinc"] — {"category": "basic"} Exact interpolation rule; sinc requires a uniform source grid. Upsampling never implies additional measured resolution.
extrapolation select true "reject" ["reject"] — {"category": "basic"} Fail when the reference grid extends beyond measured source coverage.

Moving Window (time_series.moving_window)

Ports

Direction Port Type URI Required Variadic Accepted data roles
input default spectrasherpa://types/SpectralDataset/1.0 true false []
output default spectrasherpa://types/SpectralDataset/1.0 true false []

Parameters

Parameter Editor type Required Default Options / enum Bounds / step Visibility / category Description
window_size number true 10 — {"max_value": 100000, "min_value": 2, "step": 1} {"category": "basic"} Number of consecutive spectra in each window Bounds window metadata and worker memory on local batch analyses.
step_size number true 1 — {"max_value": 100000, "min_value": 1, "step": 1} {"category": "basic"} Number of spectra to move between windows (1=maximum overlap) Bounds window traversal and worker memory on local batch analyses.
aggregation select false "none" ["none", "mean", "median", "std"] — {"category": "basic"} How to aggregate spectra within each window

Trend Removal (time_series.trend_removal)

Ports

Direction Port Type URI Required Variadic Accepted data roles
input default spectrasherpa://types/SpectralDataset/1.0 true false []
output default spectrasherpa://types/SpectralDataset/1.0 true false []

Parameters

Parameter Editor type Required Default Options / enum Bounds / step Visibility / category Description
method select true "linear" ["linear", "polynomial", "difference", "moving_average"] — {"category": "basic"} Method for trend removal
poly_order number false 2 — {"max_value": 10, "min_value": 1, "step": 1} {"category": "basic"} Polynomial order (for polynomial method) Bounds polynomial conditioning and local worker cost.
window_size number false 5 — {"max_value": 100000, "min_value": 2, "step": 1} {"category": "basic"} Window size for moving average baseline Bounds moving-average worker memory and makes the admitted domain explicit.

Apply Fitted Spectral Transfer (transfer.apply_fitted)

Ports

Direction Port Type URI Required Variadic Accepted data roles
input default spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]
input fitted_state spectrasherpa://types/SpectralTransferModel/1.0 true false []
output default spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]

Parameters

No parameters.

Direct Standardization (transfer.ds)

Ports

Direction Port Type URI Required Variadic Accepted data roles
input X_primary spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]
input X_secondary spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]
output X_standardized spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]
output fitted_state spectrasherpa://types/SpectralTransferModel/1.0 true false []
output transfer_error spectrasherpa://types/ValidationResult/1.0 true false []

Parameters

No parameters.

Piecewise Direct Standardization (transfer.pds)

Ports

Direction Port Type URI Required Variadic Accepted data roles
input X_primary spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]
input X_secondary spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]
output X_standardized spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]
output fitted_state spectrasherpa://types/SpectralTransferModel/1.0 true false []
output transfer_error spectrasherpa://types/ValidationResult/1.0 true false []

Parameters

Parameter Editor type Required Default Options / enum Bounds / step Visibility / category Description
half_window number true 3 — {"min_value": 0, "step": 1} {"category": "basic"} Secondary channels on either side of each primary wavelength.
n_components number true 2 — {"min_value": 1, "step": 1} {"category": "basic"} Exact local PLS rank; unsupported ranks are rejected rather than truncated.

Single-Wavelength Standardization (transfer.sws)

Ports

Direction Port Type URI Required Variadic Accepted data roles
input X_primary spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]
input X_secondary spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]
output X_standardized spectrasherpa://types/SpectralDataset/1.0 true false ["X_spectra"]
output fitted_state spectrasherpa://types/SpectralTransferModel/1.0 true false []
output transfer_error spectrasherpa://types/ValidationResult/1.0 true false []

Parameters

No parameters.