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

Home » Public Forums » archive » Technique to find maximum in 100x100 element moving box
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: Technique to find maximum in 100x100 element moving box [message #93765 is a reply to message #93761] Thu, 13 October 2016 10:01 Go to previous messageGo to previous message
Lajos Foldy is currently offline  Lajos Foldy
Messages: 176
Registered: December 2011
Senior Member
On Thursday, October 13, 2016 at 5:02:14 PM UTC+2, Samantha Tushaus wrote:
> Interestingly, my method, the "dilute" method, and the no-ifs loop all take the same amount of time (63, 64, and 62 seconds, respectively).

Try this:

tmp1=transpose(data)
tmp2=fltarr(ny,nx,/nozero)
FOR i = 0, nx-1 DO BEGIN
FOR j = 0, ny-1 DO BEGIN
IF (j-m2) LT 0 THEN low_ind_j = 0 ELSE low_ind_j = j-m2
IF (j+m2) GT (ny-1) THEN hi_ind_j = ny-1 ELSE hi_ind_j = j+m2
tmp2[j,i] = max(tmp1[low_ind_j:hi_ind_j, i])
ENDFOR
ENDFOR
tmp2=transpose(tmp2)
data_max=fltarr(nx,ny,/nozero)
FOR j = 0, ny-1 DO BEGIN
FOR i = 0, nx-1 DO BEGIN
IF (i-m2) LT 0 THEN low_ind_i = 0 ELSE low_ind_i = i-m2
IF (i+m2) GT (nx-1) THEN hi_ind_i = nx-1 ELSE hi_ind_i = i+m2
data_max[i,j] = max(tmp2[low_ind_i:hi_ind_i,j])
ENDFOR
ENDFOR

regards,
Lajos
[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
Previous Topic: Structures and arrays of structures
Next Topic: repeated use of TVRD() gives different results

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

Current Time: Wed Oct 08 15:48:35 PDT 2025

Total time taken to generate the page: 0.00453 seconds