So you need to integrate the shown curve in a certain range? Then areaxy is what you are looking for. Or Integrate for more control.
Or do you want to integrate an analytic function? Then go for Integrate1D.
Create a duplicate of your waves from X_min to X_max using the Duplication operation or dialog.
Then in the Integrate dialog in the Analysis menu, choose these subset x and y waves.
If you want just the value of the area under the curve, use the areaxy function, which takes an xmin,xmax range.
Take out the square brackets from the areaXY command so that it reads AreaXY(wave0, wave1, 43.7343, 45.3866)
Square brackets in any function format indicates the parameters are optional. If you didn't include those parameters in your function i.e. just AreaXY(wave0, wave1) it will integrate over the entire wave.
Take out the square brackets from the areaXY command so that it reads AreaXY(wave0, wave1, 43.7343, 45.3866)
Square brackets in any function format indicates the parameters are optional. If you didn't include those parameters in your function i.e. just AreaXY(wave0, wave1) it will integrate over the entire wave.
Take out the square brackets from the areaXY command so that it reads AreaXY(wave0, wave1, 43.7343, 45.3866)
Square brackets in any function format indicates the parameters are optional. If you didn't include those parameters in your function i.e. just AreaXY(wave0, wave1) it will integrate over the entire wave.
Tom
Still has the same problem (attached). It doesn't recognise this command somehow.
The same goes for AreaXY, i.e. use printAreaXY(wave0, wave1) in the command line. The areaxy function gives back a number, with which you would have to do something (i.e. assign to a variable in a user function).
So make sure you use only commands which work in the command line, not commands which need to be in a procedure or handled otherwise. I think the wording in the help is as follows: commands called 'operation' are useable in the command line and commands called 'function' are not (see description in the help browser). So 'print' is a operation which can be executed in the command line (and will handle the result from the area function, which does not work alone).
Yes, confusing error message, isn't it? You can't invoke a built-in function without using the return value somehow. You have to use it in an expression, assign it to a variable or print it. In 6.3 we've improved the error message, as shown in the attached screen shot.
By the area of the individual peaks you mean that you fitted all these Gaussians and look at their area output, correct?
I guess then you can't compare with the overall area given by areaxy. Those fitted peaks are largely overlapping, especially in the tail region. From the information provided, it is a bit hard to tell what you want to achieve and what you have used so far. But I suppose these peaks are not fitted with the multipeakfit package (which are the way to go with this spectrum, I think). Go to Analysis -> Packages -> Multipeak Fitting to use it (there is a help provided in the menu).
How come the area under the entire spectra is smaller than the summed area of individual peaks?
I would expect it to be different. Look at the figure it seems that the fitted peaks describe only a small part of the spectrum, and e.g. much of the non-zero 'background' or 'offset' is not included in the fits. This will be included in the direct integration.
It's also hard to tell from this figure if the fitted peaks describe the data well, which would be a prerequisite.
The left endpoint of your spectrum appears to be less than zero. If you are calculating the area of the entire curve, points below zero will reduce the total area. However, from the looks of your curve, this shouldn't cause the total area to be less than the area just of the peaks.... unless the peak area is taken from y=0 rather than the baseline joining the apparent endpoints of the peaks.
As a test, I would suggest calculating areaxy for just one peak over the same limits as the fitted curve for that same peak. This may help illuminate the situation.
Did you fit the peaks individually? That is, did you use CurveFit or the Curve Fit dialog to fit little pieces of the data set? If so, the substantial overlap would mean that summing the peaks counts some of the area twice.
For overlapping peaks, I recommend the Multipeak Fit 2 package. Take a look at the demo: File->Example Experiments->Curve Fitting Multipeak Fit 2 Demo.pxp.
If you still can't figure it out, send me a copy of your Igor experiment file to support@wavemetrics.com.
If you are calculating the area of the entire curve, points below zero will reduce the total area.
When calculating the area under a peak, is it possible to define a baseline joining the end points of the peak and such that the area is calculated between the peak and the baseline rather than between the peak and y=0?
If not, I'd probably have to plot each peak on a separate graph and subtract its y data by the end point value in y.
When calculating the area under a peak, is it possible to define a baseline joining the end points of the peak and such that the area is calculated between the peak and the baseline rather than between the peak and y=0?
If not, I'd probably have to plot each peak on a separate graph and subtract its y data by the end point value in y.
Look here http://www.igorexchange.com/project/Packages/category/55 for baseline packages. They can be used to fit a baseline under your data. Remove that baseline, then redo the peak fitting and area calculations. Or, remove the baseline from the fitted curve and then calculate the area.
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
So you need to integrate the shown curve in a certain range? Then areaxy is what you are looking for. Or Integrate for more control.
Or do you want to integrate an analytic function? Then go for Integrate1D.
Shouldn't the 'Integrate...' function give the area below this curve?
No. It gives the integrated waveform. If you use differentiate you get the derivative of the waveform at each point. Integrate is the reverse.
Right- and if you make a graph of wave0_INT or wave3_INT you will see that. The last point of each of those waves should be roughly equal to the result given by Area(). The fact that you got two _INT waves suggests you selected both waves as Y waves; the waveform analog of AreaXY() would be to select one wave in the Y list and the other in the X list.
areaxy
is what you are looking for. OrIntegrate
for more control.Or do you want to integrate an analytic function? Then go for
Integrate1D
.July 7, 2012 at 09:18 am - Permalink
Then in the Integrate dialog in the Analysis menu, choose these subset x and y waves.
If you want just the value of the area under the curve, use the areaxy function, which takes an xmin,xmax range.
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
July 7, 2012 at 09:25 am - Permalink
But I followed what's shown in the command help file for the areaXY function. It's still not working.
The wave names for the Xwave and Ywave are correct (attached).
July 7, 2012 at 11:22 pm - Permalink
AreaXY(wave0, wave1, 43.7343, 45.3866)
Square brackets in any function format indicates the parameters are optional. If you didn't include those parameters in your function i.e. just
AreaXY(wave0, wave1)
it will integrate over the entire wave.Tom
July 8, 2012 at 03:31 am - Permalink
Thanks Tom!
I'll try again.
July 8, 2012 at 10:04 pm - Permalink
Still has the same problem (attached). It doesn't recognise this command somehow.
July 8, 2012 at 11:57 pm - Permalink
Not sure why!
July 9, 2012 at 12:00 am - Permalink
print AreaXY(wave0, wave1)
in the command line. The areaxy function gives back a number, with which you would have to do something (i.e. assign to a variable in a user function).So make sure you use only commands which work in the command line, not commands which need to be in a procedure or handled otherwise. I think the wording in the help is as follows: commands called 'operation' are useable in the command line and commands called 'function' are not (see description in the help browser). So 'print' is a operation which can be executed in the command line (and will handle the result from the area function, which does not work alone).
July 9, 2012 at 04:26 am - Permalink
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
July 9, 2012 at 09:10 am - Permalink
The area of the entire spectra is 467814
And that of those 6 peaks (from left to right)are as follow:
288294
67254
129156
28109
101026
27632
So, if 467814 subtracts the sum of those peaks, gives a negative value??
It can't be correct!
July 9, 2012 at 08:40 pm - Permalink
I guess then you can't compare with the overall area given by areaxy. Those fitted peaks are largely overlapping, especially in the tail region. From the information provided, it is a bit hard to tell what you want to achieve and what you have used so far. But I suppose these peaks are not fitted with the multipeakfit package (which are the way to go with this spectrum, I think). Go to Analysis -> Packages -> Multipeak Fitting to use it (there is a help provided in the menu).
July 10, 2012 at 02:29 am - Permalink
I would expect it to be different. Look at the figure it seems that the fitted peaks describe only a small part of the spectrum, and e.g. much of the non-zero 'background' or 'offset' is not included in the fits. This will be included in the direct integration.
It's also hard to tell from this figure if the fitted peaks describe the data well, which would be a prerequisite.
July 10, 2012 at 03:55 am - Permalink
As a test, I would suggest calculating areaxy for just one peak over the same limits as the fitted curve for that same peak. This may help illuminate the situation.
July 10, 2012 at 06:03 am - Permalink
For overlapping peaks, I recommend the Multipeak Fit 2 package. Take a look at the demo: File->Example Experiments->Curve Fitting Multipeak Fit 2 Demo.pxp.
If you still can't figure it out, send me a copy of your Igor experiment file to support@wavemetrics.com.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
July 10, 2012 at 08:51 am - Permalink
Dear chozo
When I fit each of these peaks, I defined a fit range in x such that the area should only be under the peak and between, say x_1, x_2.
Where x_1 and x_2 refer to the point numbers in the x wave.
And, I used the multipeakfit package.
July 10, 2012 at 06:39 pm - Permalink
When calculating the area under a peak, is it possible to define a baseline joining the end points of the peak and such that the area is calculated between the peak and the baseline rather than between the peak and y=0?
If not, I'd probably have to plot each peak on a separate graph and subtract its y data by the end point value in y.
July 10, 2012 at 06:53 pm - Permalink
Look here http://www.igorexchange.com/project/Packages/category/55 for baseline packages. They can be used to fit a baseline under your data. Remove that baseline, then redo the peak fitting and area calculations. Or, remove the baseline from the fitted curve and then calculate the area.
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
July 11, 2012 at 04:55 am - Permalink
The peak functions have no vertical offset term. If the data have a baseline (like yours does) you need to include a baseline function in the fit.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
July 11, 2012 at 09:12 am - Permalink
I used the 'Analysis' 'Integrate...'
but it returns these messages
Integrate wave0/D=wave0_INT
Integrate wave3/D=wave3_INT
Shouldn't the 'Integrate...' function give the area below this curve?
July 11, 2012 at 11:39 pm - Permalink
No. It gives the integrated waveform. If you use differentiate you get the derivative of the waveform at each point. Integrate is the reverse.
July 12, 2012 at 01:01 am - Permalink
Right- and if you make a graph of wave0_INT or wave3_INT you will see that. The last point of each of those waves should be roughly equal to the result given by Area(). The fact that you got two _INT waves suggests you selected both waves as Y waves; the waveform analog of AreaXY() would be to select one wave in the Y list and the other in the X list.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
July 12, 2012 at 09:15 am - Permalink