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
 Origin Forum
 Threshold analysis using set column values

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
MLaverty Posted - 08/05/2014 : 12:01:19 PM
Origin Ver. and Service Release (Select Help-->About Origin): 9.1
Operating System: Windows 7

Hello all,

Some background: I'm modeling contaminant transport in a lake. The contaminant arrives at the point of interest, peaks, and then washes out of the system. I'm looking at time and concentration.

I'm defining the arrival time of the contaminant as when the concentration first exceeds a particular value. Following the suggestions in an old forum thread (http://www.originlab.com/forum/topic.asp?TOPIC_ID=1720), I was able to have success using the following in the Set Column Values dialog:

range r1 = 1!Col(1); // time
range r2 = 1!Col(2); // concentration

THRESH = 0.1; // threshold value for arrival of contaminant
temp = (r2>THRESH)?1:0;
irel=list(1,temp); del temp;

rdays = r1[irel];

My problem: I've decided to characterize the peak by looking at how quickly the contaminant reaches certain percentages of the peak value. I want "fraction of the peak" (o.1, 0.2, ... 0.9, 1.0) in the first column of a new sheet and the time in the second column. I'm guessing that I can modify the above code to do this, but I have been unsuccessful so far. Here is what I have:

range r1 = 1!Col(1); //time
range r2 = 1!Col(2); //concentration
range r3 = Col(1); //fraction of peak (0.1 to 1.0)

limit r2;
peak = limit.ymax;
peaki = limit.imax;

rTHRESH = (peak * r3);
temp = (r2>rTHRESH)?1:0;
irel=list(1,temp); del temp;

rdays = r1[irel];

So, can I do this in the Set Column Values dialog and, if so, how? If needed, I could use the first code and have one column for each fraction of the peak, but that's rather brute force would not be very efficient.

Thanks much for your help,
-M
3   L A T E S T    R E P L I E S    (Newest First)
MLaverty Posted - 08/07/2014 : 9:20:00 PM
Thank you very much for your help. It seems to work just as I need it to (my household has been knocked flat on its back by a stomach bug that's passing through the family, so I haven't had a chance to do more than copy-paste and say, "Yay! That seems to work!" before shutting off the computer).
lkb0221 Posted - 08/05/2014 : 4:12:57 PM
For example, in SCV dialog:

Function body:
result

Before Formula Scripts:
range r1 = 1!Col(1); //time
range r2 = 1!Col(2); //concentration
range r3 = Col(1); //fraction of peak (0.1 to 1.0)

limit r2;
peak = limit.ymax;
peaki = limit.imax;

dataset result;
dataset rTHRESH;
rTHRESH = peak * r3;

for (int ii = 1; ii <= r3.GetSize(); ii++)
{
double CurrentTH = rTHRESH[ii];
dataset temp = (r2 >= CurrentTH)? 1:0;
int irel = list(1,temp);
result[ii] = r1[irel];
}
lkb0221 Posted - 08/05/2014 : 4:02:46 PM
Hi,

Notice that in your 2nd script, you actually want to output a dataset, instead of a single value as in the 1st script.
So you need to loop through all values in rTHRESH and assign each rdays value to a output dataset.

Zheng
OriginLab

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