spectrochempy.detrend

detrend(dataset, type='linear', bp=0, **kwargs)[source]

Remove linear trend along dim from dataset.

Wrapper of scpy.signal.detrend().

Parameters
  • dataset (|NDDataset|) – The input data.

  • type (str among [‘linear’, ‘constant’}, optional, default=’linear’) – The type of detrending. If type == 'linear' (default), the result of a linear least-squares fit to data is subtracted from data . If type == 'constant' , only the mean of data is subtracted.

  • bp (array_like of ints, optional) – A sequence of break points. If given, an individual linear fit is performed for each part of data between two break points. Break points are specified as indices into data .

  • **kwargs – Optional keyword parameters (see Other Parameters).

Returns

detrended – The detrended NDDataset .

Other Parameters
  • dim (str or int, optional, default=’x’.) – Specify on which dimension to apply this method. If dim is specified as an integer it is equivalent to the usual axis numpy parameter.

  • inplace (bool, optional, default=False.) – True if we make the transform inplace. If False, the function return a new object

See also

BaselineCorrection

Manual baseline correction.

abs

Automatic baseline correction.

autosub

Subtraction of reference.

Examples

>>> dataset = scp.read("irdata/nh4y-activation.spg")
>>> dataset.detrend(type='constant')
NDDataset: [float64] a.u. (shape: (y:55, x:5549))