Help to write an area calculation procedure.

Hi everyone, I am working on an area calculation project. One two-wave XY curve is plotted out. The curve goes from the left bottom corner to the right top corner and then comes back as shown in the attached image. There are some blank areas between the going up curve and coming back curve. My job is to calculate the blank area using integration function. since the data points are in the same XY waves, the curve should be splitted into two so that the difference between the two areas under curve can be obtained. I am thinking to write a procedure to do this. However, I am totally new to Igor software. I really appreciate if anyone could help me out. Thanks.
yuzhongbo wrote:
Hi everyone, I am working on an area calculation project. One two-wave XY curve is plotted out. .....


Look at the areaXY() function as a start. You might get the answer directly using it. Alternatively or in addtion, if your (x,y) data is such that the first part has the upward trace and the second part the downward, you might consider using the integrate operation. Try using Analysis : Integrate from the menu, create a new wave (int_result), and display it to see what is happening.

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
Sounds good. Let me try. Thank you so much.
********
Duplicate/R[startP,endP] function could be used to split one curve into two. I tried to use areaXY function to calculate the area for both upward and downward curves which works very good. Now, I am wondering whether the marquee of a ROI on graph could be converted into the point number on the wave. I found x2pnt function which is described to do that. However, I just could not figure out how. Does anyone have a better idea? Thanks.
yuzhongbo wrote:
Sounds good. Let me try. Thank you so much.
********
Duplicate/R[startP,endP] function could be used to split one curve into two. I tried to use areaXY function to calculate the area for both upward and downward curves which works very good. Now, I am wondering whether the marquee ... However, I just could not figure out how. Does anyone have a better idea? Thanks.


Suppose your data looks a bit like this ...

p 0 1 2 3 4 5 6 7 8
x 0 1 2 3 4 3 2 1 0
y .....

... where the x values increase and then decrease while p increases.

* To split the waves, search for the maximum x value, use x2pnt to get the p value, then split accordingly.
* To get the difference between areas up and down, use the Integrate operation with the x-wave assigned.
-- the maximum value of the integration destination wave will be the area under the first (upward going) curve
-- the end point of the integrate destination wave will be the difference between the areas under the up and down curves

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
Thank you so much.
I have been confused by x2pnt at beginning. However, finally I get it. x2pnt and findlevel could be combined to convert x value into point number in case of XY plot.
yuzhongbo wrote:
Thank you so much.
I have been confused by x2pnt at beginning. However, finally I get it. x2pnt and findlevel could be combined to convert x value into point number in case of XY plot.


You might also be able to use WaveStats rather than findlevel and x2pnt.

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
yuzhongbo wrote:
Thank you so much.
I have been confused by x2pnt at beginning. However, finally I get it. x2pnt and findlevel could be combined to convert x value into point number in case of XY plot.

You could also use FindLevel with the /P flag.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com