RubberbandCorrection#
- class chemotools.baseline.RubberbandCorrection[fuente]
Bases:
DocLinkMixin,TransformerMixin,OneToOneFeatureMixin,BaseEstimatorA transformer that removes a baseline using the rubberband method.
The rubberband baseline is the lower convex hull of the spectrum — the set of straight-line segments a rubber band would form if stretched along the underside of the spectrum. The baseline is subtracted from each spectrum, leaving the peaks resting on a flat zero background.
The lower convex hull is computed with Andrew’s monotone chain algorithm [1] [2] in feature-index space, so the feature axis (e.g. wavenumbers) is assumed to be sorted; even spacing is not required. The method has no parameters.
- Variables:
n_features_in (int) – The number of features in the input data.
Referencias
Ejemplos
>>> from chemotools.baseline import RubberbandCorrection >>> from chemotools.datasets import load_fermentation_train >>> # Load sample data >>> X, _ = load_fermentation_train() >>> # Instantiate the transformer >>> transformer = RubberbandCorrection() RubberbandCorrection() >>> transformer.fit(X) >>> # Generate baseline-corrected data >>> X_corrected = transformer.transform(X)
- fit(X: ndarray, y=None) RubberbandCorrection[fuente]
Fit the transformer to the input data.
- Parámetros:
X (np.ndarray of shape (n_samples, n_features)) – The input data to fit the transformer to.
y (None) – Ignored to align with API.
- Devuelve:
self – The fitted transformer.
- Tipo del valor devuelto:
RubberbandCorrection
- transform(X: ndarray, y=None) ndarray[fuente]
Transform the input data by subtracting the rubberband baseline.
- Parámetros:
X (np.ndarray of shape (n_samples, n_features)) – The input data to transform.
y (None) – Ignored to align with API.
- Devuelve:
X_transformed – The baseline-corrected data.
- Tipo del valor devuelto:
np.ndarray of shape (n_samples, n_features)