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

Home » Public Forums » archive » Re: chunk indexing like
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: chunk indexing like [message #69306 is a reply to message #69303] Sun, 10 January 2010 05:52 Go to previous messageGo to previous message
Wout De Nolf is currently offline  Wout De Nolf
Messages: 194
Registered: October 2008
Senior Member
On Sat, 9 Jan 2010 01:37:18 -0800 (PST), chris <rogass@googlemail.com>
wrote:

> h=histogram(total(n>0,/CUMULATIVE,/int)-1,/
> BINSIZE,MIN=0,REVERSE_INDICES=ri )
> nh=n_elements(h)
> chinkind=ri[0:nh-1]-ri[0]
> ind2=where([1,chinkind[1:*]-chinkind[0:nh-2]] ne 0)
> l1=lindgen(nh)-ind2[chinkind]

The code below solves the histogram approach error but even when
excluding the histogram from timing (I need chunk indexing anyway),
the loop approach is the fastest.


h=histogram(total(n>0,/CUMULATIVE,/int)-1,/BINSIZE,MIN=0,REVERSE_INDICES=ri)
nh=n_elements(h)
chunkind=ri[0:nh-1]-ri[0]

t0=systime(1)
tmp=[1,chunkind[1:*]-chunkind[0:nh-2]]
ind2=where(tmp ne 0)
tmp=total((tmp-1)>0,/cum,/int)
l2=lindgen(nh)-ind2[chunkind-tmp]
print,'Histogram-approach: ',systime(1)-t0,' seconds for
,',n_elements(n), ' elements'


Timing:
CR-Rebin/mod-approach: 1.4690001 seconds for , 10000 elements
Histogram-approach: 2.3290000 seconds for , 10000 elements
Loop-approach: 0.82800007 seconds for , 10000 elements
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Greek Symbols in Plot Annotations
Next Topic: isurface with custom palette

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

Current Time: Thu Oct 09 23:41:37 PDT 2025

Total time taken to generate the page: 0.55978 seconds