# Integration of FTIR Absorbance Spectrum in Python

Hello I have a FTIR (fourier transform infrared) absorbance spectrum of a sample, Integrating the single lines is correlated to the quantity of substance present in the sample. The spectrum part I'm interested in is something like this:

And I want to calculate the integral under a peak, in respect of the baseline, or something like this area:

My idea was to get the baseline with a filter or something to cut the peaks and then integrate the curve with simpson method (and subtract the baseline integral on the same interval) or subtract the baseline to the curve and integrate then. Is there any way to get the baseline with packages like scipy or others? I'm new to spectrum analysis and I would be thankful for any suggestion!

• Are you looking for an algorithmic approach to automatically detect the first or largest peak and do this over many cycles or you just need to do this a few times manually? Commented Mar 24, 2021 at 10:54
• I can do it manually, I found an algorithm which is called "Asymmetric Least Squares Smoothing" by P. Eilers and H. Boelens in 2005. I'm testing it right now to see if I can find a way to fit a correct baseline. Commented Mar 24, 2021 at 10:56
• Right, so just remove the samples where the peaks are and put that into your curve fit; it seems to me a linear fit between the local mean on each side of the group of two large peaks would be sufficient. Then Simpson’s rule just reduces to summing the sample differences (peak to base) to get a comparative area. Commented Mar 24, 2021 at 11:00
• The photodetector is proportional to incident power not magnitude so a simple sum of the powers (in each sample along the horizontal axis) makes sense to get the total power under the curve, subtracting the background noise contributions. Commented Mar 24, 2021 at 11:02