Resize#
Functions for resizing N-dimensional data using standard spline interpolation, or specialized least-squares / oblique projection methods.
- splineops.resize.resize.resize(data: ndarray[tuple[Any, ...], dtype[_ScalarT]], *, zoom_factors: float | Sequence[float] | None = None, output: ndarray[tuple[Any, ...], dtype[_ScalarT]] | dtype | None = None, output_size: Tuple[int, ...] | None = None, method: str = 'cubic', modes: str | Sequence[str] = 'mirror') ndarray[tuple[Any, ...], dtype[_ScalarT]] #
Resize an N-dimensional array using splines.
- Parameters:
data (ndarray) – Input array.
zoom_factors (float or sequence of float, optional) – Per-axis scale factors. Ignored if output_size is given.
output (ndarray or dtype, optional) –
If an
ndarray
is supplied, the result is written in-place and the same array is returned.If a
dtype
is supplied, a new array of that dtype is allocated and returned.output_size (tuple of int, optional) – Desired shape (overrides zoom_factors).
method (string) –
Preset selecting both the algorithm and the spline degree:
fast: interpolation, degree 0
linear: interpolation, degree 1
quadratic: interpolation, degree 2
cubic: interpolation, degree 3
linear-fast_antialiasing: oblique, degree 1
quadratic-fast_antialiasing: oblique, degree 2
cubic-fast_antialiasing: oblique, degree 3
linear-best_antialiasing: least-squares, degree 1
quadratic-best_antialiasing: least-squares, degree 2
cubic-best_antialiasing: least-squares, degree 3
Note that anti-aliasing variants are preferred when down-sampling.
modes (str or sequence of str, optional) – Boundary handling passed to
splineops.interpolate.TensorSpline
(ignored by the anti-aliasing presets).
- Returns:
Resized data – either a new array or the one supplied via output.
- Return type:
ndarray
See also#
TensorSpline
The base class used internally for spline interpolation.