comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » constant time cadence
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
constant time cadence [message #94361] Thu, 20 April 2017 03:39 Go to next message
gunvicsin11 is currently offline  gunvicsin11
Messages: 93
Registered: November 2012
Member
Hi all,
I have a set of data with time cadence of 6s , 7s , 8s sometimes 11s, 80s, 300s like that. But I want them to be of constant 360s time cadence. How can I do that, anybody have idea.
thanks
Re: constant time cadence [message #94362 is a reply to message #94361] Thu, 20 April 2017 05:46 Go to previous messageGo to next message
natha is currently offline  natha
Messages: 482
Registered: October 2007
Senior Member
Interpolation (see function interpol) or nearest neighbor. Example:

n=10
new_data=replicate(!values.f_nan,n)
new_time=lindgen(n)*300L

for i=0L, n-1 do begin
dist=min(abs(your_time - new_time[i]),pos)
if dist lt 5 then new_data[i]=your_data[pos]
endfor

In this example "your_time" and "your_data" are you arrays. Note that I set a tolerance of 5 seconds, you could change that...


Using interpol, would be something like:

new_data=interpol(your_data,your_time,new_time)
Re: constant time cadence [message #94363 is a reply to message #94361] Thu, 20 April 2017 05:46 Go to previous messageGo to next message
Matthew Argall is currently offline  Matthew Argall
Messages: 286
Registered: October 2011
Senior Member
Via interpolation.

;Create sample time and data arrays
time = [0:720:6]
time = [time, [time[-1] + 7:time[-1]+728:7] ]
time = [time, [time[-1] + 8:time[-1]+728:8] ]
time = [time, [time[-1] + 11:time[-1]+770:11] ]
time = [time, [time[-1] + 80:time[-1]+800:80] ]
time = [time, [time[-1] + 300:time[-1]+900:300] ]
data = FIndGen( N_Elements(time) )

;Create desired time cadence and interpolate data
tout = [time[0]:time[-1]:360.0]
dout = Interpol(data, time, tout)
Re: constant time cadence [message #94364 is a reply to message #94361] Thu, 20 April 2017 05:58 Go to previous messageGo to next message
lecacheux.alain is currently offline  lecacheux.alain
Messages: 325
Registered: January 2008
Senior Member
Le jeudi 20 avril 2017 12:39:19 UTC+2, sid a écrit :
> Hi all,
> I have a set of data with time cadence of 6s , 7s , 8s sometimes 11s, 80s, 300s like that. But I want them to be of constant 360s time cadence. How can I do that, anybody have idea.
> thanks


new_data = INTERPOLATE(data, INTERPOL(dindgen(times.length), times, new_times)
Re: constant time cadence [message #94365 is a reply to message #94361] Thu, 20 April 2017 05:59 Go to previous messageGo to next message
lecacheux.alain is currently offline  lecacheux.alain
Messages: 325
Registered: January 2008
Senior Member
Le jeudi 20 avril 2017 12:39:19 UTC+2, sid a écrit :
> Hi all,
> I have a set of data with time cadence of 6s , 7s , 8s sometimes 11s, 80s, 300s like that. But I want them to be of constant 360s time cadence. How can I do that, anybody have idea.
> thanks

new_data =  INTERPOLATE(data, INTERPOL(dindgen(times.length), times, new_times))
Re: constant time cadence [message #94366 is a reply to message #94361] Fri, 21 April 2017 00:21 Go to previous messageGo to next message
gunvicsin11 is currently offline  gunvicsin11
Messages: 93
Registered: November 2012
Member
On Thursday, April 20, 2017 at 4:09:19 PM UTC+5:30, sid wrote:
> Hi all,
> I have a set of data with time cadence of 6s , 7s , 8s sometimes 11s, 80s, 300s like that. But I want them to be of constant 360s time cadence. How can I do that, anybody have idea.
> thanks

Thanks everyone for the help, But I dont want to do interpolation. Its ok if I have approximately 360s. I need to addup the time cadence and bring to approximately 360s. How can I do this automatically.
Re: constant time cadence [message #94367 is a reply to message #94366] Fri, 21 April 2017 05:42 Go to previous message
natha is currently offline  natha
Messages: 482
Registered: October 2007
Senior Member
Use my nearest neighbor code
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Saving file after editting
Next Topic: How to get _overloadSize to return N_Dimensions=0?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 07:17:36 PDT 2025

Total time taken to generate the page: 0.00604 seconds