0
votes

My problem is calculating the area under the peaks in my FT-IR analysis. I usually work with Origin but I would like to see if I get a better result working with Python. The data I'm using is linked here and the code is below. The problem I'm facing is, I don't know how to find the start and the end of the peak to calculate the area and how to set a Baseline.

I found this answered question about how to calculate the area under multiple peaks but I don't know how to implement it in my code: How to get value of area under multiple peaks

import numpy as np
from numpy import trapz
import matplotlib.pyplot as plt
import pandas as pd

df = pd.read_csv(r'CuCO3.csv', skiprows=5)
print(df)
Wavenumber = df.iloc[:,0]
Absorbance = df.iloc[:,1]
Wavenumber_Peak = Wavenumber.iloc[700:916] #Where the peaks start/end that i want to calculate the area
Absorbance_Peak = Absorbance.iloc[700:916] #Where the peaks start/end that i want to calculate the area

plt.figure()
plt.plot(Wavenumber_Peak, Absorbance_Peak)
plt.show()

Plot of the peaks to calculate the area:

enter image description here

What is wrong with the code from the post you linked? You should always try to get as far as you can and ask more specific questions as soon as you face problems. - Marc Felix
Additionally, you wrote that you link the dataset, but I can not see a link to it. Am I missing something? - Marc Felix
Hey, sorry. The problem im having is, I dont know how to continue it so that it finds the start and end of each peak and calculate the area of them. Here is the file, as mention in my code, the row where the peaks I want to calculate start at row 700 and end at row 916: docs.google.com/spreadsheets/d/… - Wollmy