Protomix.normalize

normalize(spectra_df: DataFrame, method: str = 'PQN') DataFrame[source]

Apply different normalization methods to a DataFrame of spectra.

This function normalizes the spectra in the provided DataFrame using the specified method. Each row in the DataFrame represents a sample, and each column corresponds to a data point in the spectrum.

Parameters:
  • spectra_df (pd.DataFrame) – The DataFrame containing the spectra, with samples as rows and data points as columns.

  • method (str) – The normalization method to apply. Options are ‘PQN’ (Probabilistic Quotient Normalization), ‘TotalArea’ (Total Area Normalization), or ‘SNV’ (Standard Normal Variate). Default is ‘PQN’.

Returns:

The normalized spectra as a DataFrame.

Return type:

pd.DataFrame