comet_maths.interpolation.interpolation.Interpolator

comet_maths.interpolation.interpolation.Interpolator#

class comet_maths.interpolation.interpolation.Interpolator(relative: bool | None = True, method: str | None = 'cubic', method_hr: str | None = 'cubic', unc_methods: List[str] | None = None, unc_methods_hr: List[str] | None = None, min_scale: float | None = 0.3, extrapolate: str | None = 'nearest', add_model_error: bool | None = True, plot_residuals: bool | None = False)[source]#

Class to provide a set of interpolation methods for the interpolation of data. The class provides a range of interpolation methods, and enables propagation of uncertainties through the interpolation by providing measurement functions that only take the numerical input quantities as arguments. All the other options for interpolation are stored in the class attributes.

Parameters:
  • relative – Boolean to indicate whether a relative normalisation (True) or absolute normalisation (False) should be used. Defaults to True.

  • method – Sting to indicate which interpolation method should be used to interpolate between normalised data (core interpolation step within the approach). Defaults to Gaussian Progress Regression.

  • method_hr – String to indicate which interpolation method should be used to interpolate between high resolution measurements. Defaults to cubic spline interpolation.

  • unc_methods – interpolation methods to use in the calculation of the model error for interpolation between normalised data. Not used for gpr. Defaults to None, in which case a standard list is used for each interpolation method.

  • unc_methods_hr – interpolation methods to use in the calculation of the model error for interpolation between high resolution measurements. Not used for gpr. Defaults to None, in which case a standard list is used for each interpolation method.

  • 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”.

  • 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

  • plot_residuals – Boolean to indicate whether a plot of the residuals should be made (and stored as residuals.png). Defaults to False

__init__(relative: bool | None = True, method: str | None = 'cubic', method_hr: str | None = 'cubic', unc_methods: List[str] | None = None, unc_methods_hr: List[str] | None = None, min_scale: float | None = 0.3, extrapolate: str | None = 'nearest', add_model_error: bool | None = True, plot_residuals: bool | None = False) None[source]#

Methods

__init__([relative, method, method_hr, ...])

interpolate_1d(x_i, y_i, x)

Interpolates 1D data to defined coordinates x in 1D

interpolate_1d_along_example(x_i, y_i, x_hr, ...)

Method for interpolating between datapoints by following an example.