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
 Calculating time intervals

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
Vinnie88 Posted - 07/26/2017 : 07:28:35 AM
Hi there!

I could not find anything related so apologies if it doubles.

I basically have a time-temperature graph, over a month timeframe, and I would need to know how long the temperature is over a certain value or between values every day of that month.
I thought about filtering but is there anything more "automatic"?

Is there something I am missing on origin or do I need to use python/R?

Many thanks for your help!

Origin Ver. and Service Release (Select Help-->About Origin): 2016
Operating System: Windows 7

Vinnie
3   L A T E S T    R E P L I E S    (Newest First)
Hideo Fujii Posted - 07/28/2017 : 2:34:22 PM
Hi Vinnie,

Though still unclear some part, but if you want to get the total of X periods at a single Y level, or between a
range of Y levels, you can try the following ways - both utilize the Level Crossing app
(http://www.originlab.com/FileExchange/details.aspx?fid=225).
In the sample below, Book1 contains the Date data in A(X), and some economic data in B(Y).

Case 1: At a Single Y Level

1) Apply the Level Crossing app (with Worksheet Output option) as in Graph1. Make a new output to create
QKLevelCrossing worksheet.

2) As you see in the sample, QKLevelCrossing worksheet contains the "Direction" column (D(Y)) to show upward(1)
or downward(-1) alternatingly. You want to calculate the X distances in "X Value" (B(X)) when Direction changes
from 1 to -1, then sum them up. To do so, you can calculate the X distance to the next data point in B(X)
when Direction is 1.
That is, you can make another column, and run the Set Column Values tool with the formula:
col(D)==1?col(B)[i+1]-col(B)[i]:0 . (in column K)

3) To get the total of the column K, make another column, and run the Set Column Values tool with Before Formula Scripts,
col(J)[1]=total(col(I)) . The result will show in column J.



Case 2: Between a Range of Two Y Levels

1) Run 2 instances of the Level Crossing app. (Graph2)
2) Sort the output worksheet by Date. (QkLevelCros1)
3) You want to calculate the X distances when consecutive two Direction values are either both 1, or both -1.
To determine the pairs, multiply the pair of Directions, and select the row when the result is 1 (i.e., 1*1, or -1*-1).
So, you can set the formula for column I to: col(D)[i]*col(D)[i+1]==1?col(B)[i+1]-col(B)[i]:0
4) As in Case 1, the result in the column J.



To automatize such process, you can save your project as an Analysis Template for later use.

I hope this suggests a way for your work.

--Hideo Fujii
OriginLab

P.S. I have realized that in Case 2, when the curve enters from the lower limit, exits from the lower limit again
without crossing upper limit, you need further elaboration of the formula. Please take this point in your consideration.
Vinnie88 Posted - 07/26/2017 : 11:56:05 AM
Hi,
thanks for your reply.

I have a set of data in a month timeframe.

Every day has many temperatures values, with certain sampling time.

What I would need to know is for how long (time wise) every day my temperature goes over 60°C, for example, and how long stays between 2 other values.

Any way the plot can tell me that the temperature went up above 60°C for at least an hour?

(What I meant with the filter was more of a "manual" way, like filtering the temperatures over 60°C and then checking consecutive values in the data, but it's not a very good way for me to do it on a large bunch of data)

I hope I explained my self a little better.



Many thanks for your help!
Vinnie

Vinnie
arstern Posted - 07/26/2017 : 10:56:20 AM
Hi,

I am not exactly sure why you would want to filter your data? Could you explain in more detail? Maybe provide a screenshot of your data?

Do you want the x-axis to be something like day 1, day 2, day 3 (to show the temperature for every day of that month?) or do you want the x-axis to show how many days that temperature stayed at that level i.e. 2 days, 5 days.

From your description, I'm thinking you want to use a box chart:
http://www.originlab.com/doc/Origin-Help/Create-Box-Chart
(This is beneficial for showing the range of temperatures on each day)

Thanks,
Aviel
OriginLab

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