cremerlab / hplc-py

A Python utility for the processing and quantification of chromatography data
https://cremerlab.github.io/hplc-py/
GNU General Public License v3.0
27 stars 5 forks source link

Reporting of maximum signal value #16

Closed flo-kr closed 4 months ago

flo-kr commented 5 months ago

I noticed that when calling the value for 'Amplitude', the value always seems to be lower than the actual maximal values that can be called through _chrom.unmixedchromatograms() and also lower than the max values recorded in the original chromatogram in the first place.

To my understanding, 'amplitude' would be the difference between the baseline and the maximal value. Is this the intended idea?

Best

Florian

gchure commented 5 months ago

Hi Florian,

Thanks for opening an issue. As described here, the amplitude is not the maximum value--it's a weight applied to a skew normal distribution during the fitting.

For example, these are plots of an amplitude-weighed skew-normal distribution with the same amplitude parameter, but varying skew (alpha):

Screenshot 2024-05-07 at 12 40 21

If you want to know the maximum value of peaks that are not overlapping, you'd be better off either a) using scipy.signal.find_peaks and then use those indices to extract the signal value of those indices, or b) you could get these indices from hplc-py by looking at the attribute Chromatogram._peak_indices.

It would be pretty simple to add a height or maximum value in quantities returned by fit_peaks. I will look at that as soon as I have a chance, but you (or anyone else) are welcome to submit a pull request with the change.

gchure commented 4 months ago

Hi @flo-kr , I've added reporting of the maximum signal value a new statistic reported when fit_peaks is called. Please let me know if this solves your problem!