pflm.interp.interp1d#
- interp1d(x: ndarray, y: ndarray, x_new: ndarray, method: str = 'linear') ndarray[source][source]#
Interpolate 1D data using linear or spline interpolation.
- Parameters:
- xnp.ndarray of shape (n,)
Strictly 1D input coordinates. Duplicates are allowed but will be reduced to the first occurrence internally.
- ynp.ndarray of shape (n,)
Values at x. Must match x in length.
- x_newnp.ndarray of shape (m,)
Query points.
- method{“linear”, “spline”}, default=”linear”
Interpolation method.
- Returns:
- y_newnp.ndarray of shape (m,)
Interpolated values at x_new. The dtype follows x: float32 uses the f32 backend; otherwise f64.
- Raises:
- ValueError
If any input is not 1D, is empty, sizes mismatch, contains NaN, or method is invalid.
See also
interp2dInterpolate 2D gridded data.
Notes
Input duplicates in x are deduplicated using the first occurrence.
Backend is selected by dtype of x (float32 -> f32; otherwise f64).