Integrating area under curves

Hi there.

I'm new to Igor Pro but I am not new to time-series data.

I am not sure that I know the correct questions to ask so I will just state what it is I want to do and hopefully someone will be able to point me in the right direction: I have dataset whose Y values are reported as a function of time. There are peaks in this data whose area I would like to calculate but these peaks are separated by data that is essentially baseline data.

I would like to be able to calculate and display the areas under each of the individual curves while ignoring the area under the baseline data.

I have tried the "Integrate" function that is built in to Igor Pro 6 but it appears to return a value for each of the XY data points including the baseline data... Is there a way to identify peaks (not just peak value but also the spread along the X-axis), integrate and display the areas under them? Will I have to write my own procedure to do this?

It seems as though this would be a common operation and thus that it would already be available but I can't seem to locate a way to do it.

Many thanks for your help! :)
If you handle time series data your data is probably evenly spaced along the x (time) axis and I therefore strongly suggest to use scaled data.
To lern more about scaled data execute displayHelpTopic "The Waveform Model of Data" and displayHelpTopic "Changing Dimension and Data Scaling" on Igor's command line.

Have you tried Igor's area and areaXY functions to calculate the area under the peaks. These functions return the scaled area between the curve and y=0. You have to subtract the baseline by yourself. How this can be done depends on your data. If the baseline is more or less a (noisy) constant, you can manually calculate the area under the baseline or use the area function to calculate the area under the baseline beside your peak in a commensurate intervall. This of course works only if the baseline is a constant. If this is not the case you could fit the baseline with a polynominal fit function or - more straight forward - use the Draw Wave tool to "fit" the baseline manually. To do this, display your data in a graph, choose "Show Tools" from the Graph menu and then follow the instructions you see when you execute this: displayHelpTopic "Drawing and Editing Waves". (I'd suggest to use the 'Draw Wave Monotonic' option.) As soon as you have done this you can use the areaXY function with the drawn waves (W_XPolynn and W_YPolynn) to calculate the area under the fitted baseline. Make sure to use the same x values you used to determine the area under the peak.

A stepwise instruction assuming scaled data:
  1. Display the data.

  2. Draw the baseline as explained above.

  3. Choose 'Hide Tools' and 'Show Info' from the Graph menu.

  4. Position Cursor A on the left of your peak and Cursor B on the right.

  5. Assuming the data are named datawave and the drawn baseline W_XPoly0 and W_YPoly0, execute
    print area(datawave,xcsr(A),xcsr(B))-areaXY(W_XPoly0,W_YPoly0,xcsr(A),xcsr(B))
    on Igor's command line.
In all likelihood the Multipeak Fit 2 will do what you want. Select Analysis->Packages->Multipeak Fitting ->Multipeak Fitting 2.

It's all fairly easy to use from that point on. Select the Y wave. Click on Continue. Then press Auto-locate Peaks now, or edit where you would like the peaks to be with a graph marquee. You can in linear, polynomial baselines, etc. Then do the fit. If you press the peak results button it will give all the peak parameters, including the area of each of the peaks.

That is the GUI way of doing it. As awirsing points out you can roll your own multipeak fitting routines if you need anything more involved.

Andrew
Thank you both for the replies.

I will try your suggests and report how it goes.
Multipeak Fit 2 will, indeed, allow fitting peaks and baseline, but it sounds like what mr_fosi wants is to simply detect peaks and baseline and measure the peak areas from the data. That still requires some sort of model for what the baseline does underneath the peaks (either a fitted baseline, or simply connecting the baseline on either side with a straight line are common solutions).

You might try one of the Tech Note 20 solutions. They are old, but still work. From what you describe, perhaps TN020 or TN020B might be appropriate. Consult TN020S for a description of the different versions of Technote 20.

You will find the tech notes in your Igor Pro folder, in Technical Notes:Igor Tech Notes:TN020 Peak Measurement.

It is my ambition to some day include more of the Tech Note 20 capabilities into Multipeak Fit.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
Once I removed the baseline from my data, PeakAreasUnipolar.ipf from Technical Note TN020-C did what I needed.

I have been able to get this procedure to correctly locate and integrate the area of the curves in my dataset and it didn't take much tweaking. It doesn't do as well with smoothed data as it does with the raw data and I think that is a good thing.

Thanks again for your help. :)

EDIT: I used a procedure called Baselines.ipf ver. 1.10b (7/23/07) that found here on Igor Exchange. This allows me to select the inter-peak data, fit a model (exp in my case) and subtract it from the data.