How can I optimize this? [message #62616] |
Thu, 18 September 2008 02:46 |
hldevil
Messages: 6 Registered: September 2008
|
Junior Member |
|
|
Hi,
I'm looking for a way of optimizing a chunk of IDL code. The following
code snippet is part of a larger program. What it does is basically
test in some Anti-Coincidence Tables if a certain threshold energy is
met. Those AC-Events which meet the condition have their frame times
compared with my actual event list. If a AC frame equals an event
frame the event frame is thrown away. I've tried doing it with array
operations but always end up of having the problem that the AC and
frame array have different lengths, so just selecting via WHERE
doesn't work. Any help is very much appreciated since this part really
slows the whole program
;four different AC sets, each with each own threshhold energy
ACdeleteIDs=[WHERE((myFitsAC.AC EQ 0) AND (myFitsAC.PI GT
ACEnergies[i])),WHERE((myFitsAC.AC EQ 1) AND (myFitsAC.PI GT
ACEnergies[j])),WHERE((myFitsAC.AC EQ 2) AND (myFitsAC.PI GT
ACEnergies[k])),WHERE((myFitsAC.AC EQ 3 AND myFitsAC.PI GT
ACEnergies[l]))]
;the AC events which are above threshold
ACdeletes=myFitsAC[ACdeleteIDs]
;keep the original data for the next loop
myFitsHED2=myFitsHED
myFitsLED2=myFitsLED
;filter event list
FOR z=0L, n_elements(ACdeletes)-1 DO BEGIN
del=WHERE(myFitsHED.time EQ ACdeletes[z].time, cnt)
IF cnt GT 0 THEN myFitsHED2[del].time=-1
del=WHERE(myFitsLED.time EQ ACdeletes[z].time, cnt)
IF cnt GT 0 THEN myFitsLED2[del].time=-1
ENDFOR
myFitsHED2=myFitsHED2[WHERE(myFitsHED2.time NE -1)]
myFitsLED2=myFitsLED2[WHERE(myFitsLED2.time NE -1)]
|
|
|