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

Home » Public Forums » archive » help on avoiding a FOR loop
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
help on avoiding a FOR loop [message #69509] Mon, 18 January 2010 06:45
hldevil is currently offline  hldevil
Messages: 6
Registered: September 2008
Junior Member
Hi there,

maybe someone can help me on avoiding this FOR loop:

ha=histogram(myBin.event, binSize=1, reverse_indices=r_acc, min=0)

FOR i=0L, n_elements(ha)-1 DO BEGIN
IF (ha[i] ne 0) THEN BEGIN
idx=reverse_indices(ha, r_acc, i)
myBin2[idx].energy=total(myBin[idx].energy, /CUMULATIVE)/
total(myBin[idx].energy)
ENDIF
ENDFOR

To explain: I have a dataset, which contains multiple energy entries
which can be linked to individual events. The energies should be
comulatively summed for each event. Each event spreads over roughly
10-100 energy entries and I am looping in excess of 1 Mio. events. For
all what I know this is "sub-optimal" in IDL, since I'm actually doing
very little processing in each loop-iteration.

Cheers and thanks in advance,

Steffen
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: How can we pass Greek symbols and formula to IPLOT?
Next Topic: rois_to_csv.pro

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

Current Time: Wed Oct 08 13:51:19 PDT 2025

Total time taken to generate the page: 0.00418 seconds