# LinearInterpolation#

class pyopenms.LinearInterpolation#

Bases: object

Cython implementation of _LinearInterpolation[double,double]

Original C++ documentation is available here

Provides access to linearly interpolated values (and derivatives) from discrete data points. Values beyond the given range of data points are implicitly taken as zero.

The input is just a vector of values (“Data”). These are interpreted as the y-coordinates at the x-coordinate positions 0,…,data_.size-1.

The interpolated data can also be scaled and shifted in the x-dimension by an affine mapping. That is, we have “inside” and “outside” x-coordinates. The affine mapping can be specified in two ways: - using setScale() and setOffset(), - using setMapping()

By default the identity mapping (scale=1, offset=0) is used.

Using the value() and derivative() methods you can sample linearly interpolated values for a given x-coordinate position of the data and the derivative of the data

__init__()#

__init__(self) None

__init__(self, in_0: LinearInterpolation) None

__init__(self, scale: float, offset: float) None

Methods

 __init__ Overload: addValue(self, arg_pos, arg_value) Performs linear resampling. derivative(self, arg_pos) Returns the interpolated derivative empty(self) Returns true if getData() is empty getData(self) Returns the internal random access container from which interpolated values are being sampled getOffset(self) "Offset" is the point (in "outside" units) which corresponds to "Data[0]" getScale(self) "Scale" is the difference (in "outside" units) between consecutive entries in "Data" index2key(self, pos) The transformation from "inside" to "outside" coordinates key2index(self, pos) The transformation from "outside" to "inside" coordinates setData(self, data) Assigns data to the internal random access container from which interpolated values are being sampled setMapping Overload: setOffset(self, offset) "Offset" is the point (in "outside" units) which corresponds to "Data[0]" setScale(self, scale) "Scale" is the difference (in "outside" units) between consecutive entries in "Data" supportMax(self) supportMin(self) value(self, arg_pos) Returns the interpolated value
addValue(self, arg_pos: float, arg_value: float) None#

Performs linear resampling. The arg_value is split up and added to the data points around arg_pos

derivative(self, arg_pos: float) float#

Returns the interpolated derivative

empty(self) bool#

Returns true if getData() is empty

getData(self) List[float]#

Returns the internal random access container from which interpolated values are being sampled

getInsideReferencePoint(self) float#
getOffset(self) float#

“Offset” is the point (in “outside” units) which corresponds to “Data[0]”

getOutsideReferencePoint(self) float#
getScale(self) float#

“Scale” is the difference (in “outside” units) between consecutive entries in “Data”

index2key(self, pos: float) float#

The transformation from “inside” to “outside” coordinates

key2index(self, pos: float) float#

The transformation from “outside” to “inside” coordinates

setData(self, data: List[float]) None#

Assigns data to the internal random access container from which interpolated values are being sampled

setMapping()#

setMapping(self, scale: float, inside: float, outside: float) None

setMapping(self, inside_low: float, outside_low: float, inside_high: float, outside_high: float) None
setOffset(self, offset: float) None#

“Offset” is the point (in “outside” units) which corresponds to “Data[0]”

setScale(self, scale: float) None#

“Scale” is the difference (in “outside” units) between consecutive entries in “Data”

supportMax(self) float#
supportMin(self) float#
value(self, arg_pos: float) float#

Returns the interpolated value