nirs4all.operators.augmentation.splines module
- class nirs4all.operators.augmentation.splines.Spline_Curve_Simplification(spline_points=None, uniform=False, random_state=None)[source]
Bases:
TransformerMixin,BaseEstimatorClass to simplify a 1D signal using B-spline interpolation along the curve.
Optimized implementation with pre-allocated output arrays.
- Parameters:
- class nirs4all.operators.augmentation.splines.Spline_Smoothing(random_state=None)[source]
Bases:
TransformerMixin,BaseEstimatorClass to apply a smoothing spline to a 1D signal.
- Parameters:
random_state (int or None, optional) – Seed for the random number generator (unused, kept for API consistency).
- class nirs4all.operators.augmentation.splines.Spline_X_Perturbations(spline_degree=3, perturbation_density=0.05, perturbation_range=(-10, 10), random_state=None)[source]
Bases:
TransformerMixin,BaseEstimatorClass to apply a perturbation to a 1D signal using B-spline interpolation.
Optimized implementation with pre-generated random parameters.
- Parameters:
spline_degree (int, optional) – Degree of the spline. Default is 3 (cubic).
perturbation_density (float, optional) – Density of perturbation points relative to data size. Default is 0.05.
perturbation_range (tuple, optional) – Range of perturbation values (min, max). Default is (-10, 10).
random_state (int or None, optional) – Seed for the random number generator.
- class nirs4all.operators.augmentation.splines.Spline_X_Simplification(spline_points=None, uniform=False, random_state=None)[source]
Bases:
TransformerMixin,BaseEstimatorClass to simplify a 1D signal using B-spline interpolation along the x-axis.
Optimized implementation with pre-generated random parameters.
- Parameters:
- class nirs4all.operators.augmentation.splines.Spline_Y_Perturbations(spline_points=None, perturbation_intensity=0.005, random_state=None)[source]
Bases:
TransformerMixin,BaseEstimatorAugment the data with a perturbation on the y-axis using B-spline interpolation.
Optimized implementation with pre-generated random parameters.
- Parameters:
- nirs4all.operators.augmentation.splines.X_length(x, y)[source]
Compute the total length, segment lengths, and cumulative segment lengths of a curve.
Vectorized implementation without np.vectorize.
- Parameters:
x (ndarray) – Array of x-coordinates of the curve.
y (ndarray) – Array of y-coordinates of the curve.
- Returns:
A tuple containing the total length, segment lengths, and cumulative segment lengths.
- Return type:
- nirs4all.operators.augmentation.splines.interval_selection(n_l, CumVect)[source]
Select the interval indices that bound a given value in an array.
- nirs4all.operators.augmentation.splines.segment_length(x1, y1, x2, y2)[source]
Compute the length of a line segment given its coordinates.
- nirs4all.operators.augmentation.splines.segment_pt_coord(x1, y1, x2, y2, fracL, L)[source]
Compute the coordinates of a point on a line segment given the fraction of its length.
- Parameters:
x1 (float) – x-coordinate of the first point of the line segment.
y1 (float) – y-coordinate of the first point of the line segment.
x2 (float) – x-coordinate of the second point of the line segment.
y2 (float) – y-coordinate of the second point of the line segment.
fracL (float) – Fraction of the length of the line segment.
L (float) – Length of the line segment.
- Returns:
A tuple containing the x and y coordinates of the point on the line segment.
- Return type: