bioniumx.preprocessing.continuum_normalize

bioniumx.preprocessing.continuum_normalize(spectrum: BioniumXObject, method: str = 'polynomial', degree: int = 2)[source]

Normalize a spectrum by dividing by its continuum.

The continuum represents the baseline flux/depth devoid of absorption features. This function fits a model (e.g., polynomial) to the pseudo-continuum points and divides the entire spectrum by this model.

Parameters:
  • spectrum (BioniumXObject) – The input spectrum.

  • method (str, optional) – Method for fitting the continuum. Currently supports “polynomial” or “mean”. Default is “polynomial”.

  • degree (int, optional) – Degree of the polynomial if method is “polynomial”. Default is 2.

Returns:

normalized – A new spectrum object normalized to its continuum.

Return type:

BioniumXObject

Raises:

ValueError – If an unsupported method is specified.

Examples

>>> spec_norm = continuum_normalize(spec, method="polynomial", degree=2)