nirs4all.controllers.data.resampler module
Controller for wavelength resampling operations.
This controller handles the Resampler operator, extracting wavelengths from dataset headers and managing the resampling process across multiple sources.
- class nirs4all.controllers.data.resampler.ResamplerController[source]
Bases:
OperatorControllerController for Resampler operators.
This controller: 1. Extracts wavelengths from dataset headers 2. Validates that headers are convertible to float (wavelengths in cm-1) 3. Fits the resampler with original wavelengths 4. Transforms all data to the target wavelength grid 5. Updates dataset with new features and headers 6. Supports multi-source datasets with per-source or shared parameters
- execute(step_info: ParsedStep, dataset: SpectroDataset, context: ExecutionContext, runtime_context: RuntimeContext, source: int = -1, mode: str = 'train', loaded_binaries: List[Tuple[str, Any]] | None = None, prediction_store: Any | None = None) Tuple[ExecutionContext, List][source]
Execute resampling operation.
- Parameters:
step_info – Pipeline step configuration
dataset – Dataset to operate on
context – Pipeline execution context
runtime_context – Runtime context
source – Data source index (-1 for all sources)
mode – Execution mode (“train” or “predict”)
loaded_binaries – Pre-loaded binary objects for prediction mode
prediction_store – External prediction store (unused)
- Returns:
Tuple of (updated_context, fitted_resamplers)