The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Automating the Integration process (Newbie here)

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
starpuma Posted - 04/20/2014 : 8:21:23 PM
Origin Ver. and Service Release (Select Help-->About Origin): OriginPro 8.5
Operating System: Windows 7

Hey everybody,

I am doing research as an undergraduate and have no clue about programming so please bear with me. So, I need to integrate a an upwards of 100 graphs and each one of them have about 200 traces each. So, far I have been using the "Integrate" gadget in Origin but I am nowhere close to being done.

So the main problem is that we can only integrate one trace or curve at a time with the "integrate" gadget and since all my integrations have the same basic parameters I figured that it would be relatively easy to automate this rather daunting task because since this is such a repetitive task. I am basically doing an absolute integration over a specific X range. I found this LabTalk script "Integrate Active Curve in Graph over a Specific X Range" from the origin's website (http://www.originlab.com/doc/LabTalk/examples/Peaks-and-Baseline) that almost does what I want. Here is the code:


The following example shows how to integrate the active curve in a graph over a specific range of x values, using the integ1 X-Function.

// Purpose: This example demonstrates the following:
// 1. import a file
// 2. create a graph
// 3. integrate the curve over a specific x range


// Create new book and import a sample file
newbook;
string fname$ = system.path.program$ + "samples\curve fitting\multiple peaks.dat";
impasc;

// Plot 4th column against 1st column as a line plot
plotxy iy:=(1,4) plot:=200;

// Get row index for x values of 6.5 and 9.5, which covers the 3rd peak in the graph
int ix1=xindex(6.5,%c);
int ix2=xindex(9.5,%c);

// Integrate this range of the curve, and list the results of integration
range rr=(%c)[$(ix1): $(ix2)];
integ1 rr;
integ1.=;

______________________________________

So according to my understanding this basically does what the integration gadget does? But I don't know if this will give me a mathematical or absolute integration.
Here is what I need: I have all the graphs plotted so could somebody please help me modify this code so it would go through all the traces or curves in a graph and integrate them. I would love you forever


Thank you so much!
1   L A T E S T    R E P L I E S    (Newest First)
greg Posted - 04/25/2014 : 3:58:59 PM
This should work in Origin 8.5

// BEGIN SCRIPT
// PROMPT for X range and calculation method
ix1 = 6.5;
ix2 = 9.5;
choice$ = Math Absolute;
ichoice = 1;
getn (From) ix1 (To) ix2 (Method) ichoice:choice$ (Integrate all plots);
// Setup
ichoice--; // math = 0, absolute = 1
newbook name:=Results;
layer.name$ = Areas;
range raData = 1;
range raArea = 2;
count = 0;
// Loop over all graphs then all plots in each graph
doc -e P
{
doc -e DY
{
count++;
range -w raC = %C;
xi1 = xindex(ix1,%C);
xi2 = xindex1(ix2,%C);
integ1 iy:=raC[xi1:xi2] baseline:=0 type:=$(ichoice) area:=myarea;
raData[count]$ = %C[x$(ix1):$(ix2)];
raArea[count] = myarea;
}
}
// END SCRIPT

REMINDER: LabTalk questions like this belong in the LabTalk Forum http://www.originlab.com/forum/forum.asp?FORUM_ID=10

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000