linear Module
This module contains the code defining a JIT-compatible linear interpolation scheme.
LinearInterpolator
Simple JIT-ed wrapper around numpy.interp for use with vector valued functions (i.e. f(x) -> [y,z])
We use numba to just-in-time compile these methods which results in a dramatic speed up on the order of a factor of 50.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x_vals |
ndarray
|
The independent variable values, must be monotonically increasing. |
required |
y_vals |
ndarray
|
The corresponding function output. Should be a two dimensional array. The first dimension should be the same length as x. The second dimension is the length of the output of the interpolated function. |
required |
Attributes:
Name | Type | Description |
---|---|---|
x |
ndarray
|
The independent variable values, must be monotonically increasing. |
y |
ndarray
|
The function values. Should be a two dimensional array. The first dimension should be the same length as x. The second dimension is the length of the output of the interpolated function. |
x_min |
float
|
The low edge of the interpolation |
x_max |
float
|
The high edge of the interpolation |
Methods:
Name | Description |
---|---|
LinearInterpolator |
Construct the LinearInterpolator |
check_values |
Internal consistency check. Raises an Exception on failure. |
interpolate |
Perform interpolation for a set of x-coordinate values. |
Source code in src/spyral/interpolate/linear.py
check_values()
Internal consistency check. Raises an Exception on failure.
Source code in src/spyral/interpolate/linear.py
interpolate(xs)
Perform interpolation for a set of x-coordinate values.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
xs |
ndarray
|
The x-values to perform interpolation on. |
required |
Returns:
Type | Description |
---|---|
ndarray
|
An 2-D array. Each row contains the corresponding interpolated value. |