comet_maths.interpolation.interpolation.interpolate_1d#
- comet_maths.interpolation.interpolation.interpolate_1d(x_i: ndarray, y_i: ndarray, x: ndarray, method: str | None = 'linear', unc_methods: List[str] | None = None, u_y_i: ndarray | None = None, corr_y_i: ndarray | str | None = None, min_scale: float | None = 0.3, extrapolate: str | None = 'extrapolate', return_uncertainties: bool | None = False, return_corr: bool | None = False, include_model_uncertainties: bool | None = True, add_model_error: bool | None = False, MCsteps: int | None = 100, parallel_cores: int | None = 4, interpolate_axis: int | None = 0) ndarray | Tuple[ndarray, ndarray] | Tuple[ndarray, ndarray, ndarray] [source]#
Interpolates 1D data to defined coordinates x in 1D
- Parameters:
x_i – Independent variable quantity x (coordinate data of y_i)
y_i – measured variable quantity y (data to interpolate)
x – Independent variable quantity x for which we are trying to obtain the measurand y
method – interpolation method to be used, defaults to linear
unc_methods – interpolation methods to use in the calculation of the model error. Not used for gpr. Defaults to None, in which case a standard list is used for each interpolation method.
u_y_i – uncertainties on y_i, defaults to None
corr_y_i – error correlation matrix (can be “rand” for random, “syst” for systematic, or a custom 2D error correlation matrix), defaults to None
min_scale – minimum bound on the scale parameter in the gaussian process regression. Only used if gpr is selected as method. Defaults to 0.3
extrapolate – extrapolation method, which can be set to “extrapolate” (in which case extrapolation is used using interpolation method defined in “method”), “nearest” (in which case nearest values are used for extrapolation), or “linear” (in which case linear extrapolation is used). Defaults to “extrapolate”.
return_uncertainties – Boolean to indicate whether interpolation uncertainties should be calculated and returned. Defaults to False
return_corr – Boolean to indicate whether interpolation error-correlation matrix should be calculated and returned. Defaults to False
include_model_uncertainties – Boolean to indicate whether model uncertainties should be added to output uncertainties to account for interpolation uncertainties. Not used for gpr. Defaults to True
add_model_error – Boolean to indicate whether model error should be added to interpolated values to account for interpolation errors (useful in Monte Carlo approaches). Defaults to False
MCsteps – number of MC iterations. Defaults to 100
parallel_cores – number of CPU to be used in parallel processing. Defaults to 4
- Returns:
The measurand y evaluated at the values x (interpolated data)