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

Home » Public Forums » archive » Re: Rapid "moving windows" access in IDL?
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: Rapid "moving windows" access in IDL? [message #37842 is a reply to message #37824] Fri, 30 January 2004 06:09 Go to previous messageGo to previous message
Chris Lee is currently offline  Chris Lee
Messages: 101
Registered: August 2003
Senior Member
In article <BC3F7CE8.18DCE%greenberg@ucdavis.edu>, "Jonathan Greenberg"
<greenberg@ucdavis.edu> wrote:


> Ok, now to make this a bit more confusing -- in practice, what I will
> actually be doing is selecting all pixels at about a given distance from
> the center point, creating a ring of pixels that will be used for the
> semivariogram. Getting back to an earlier question, is the array
> subscripting an inherently slow process, and are there "better" and
> "worse" ways of accessing array elements given an x,y coordinates? More
> thoughts?
> --j

Why not make a ring of 1s and 0s..e.g.

nx=100
ny=100

dist=shift(dist(nx,ny),nx/2, ny/2)
mask=fltarr(nx,ny)
mask[*]=0.0
outer=25
inner=23

mask[where(dist lt outer)]=1.0
mask[where(dist lt inner)]=0.0

;mask contains a ring of 1s

ring = mask * data .
OR
ring = data[where(mask eq 1)]

Chris.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Memory Headache II
Next Topic: Incremental variable names?

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

Current Time: Wed Dec 03 18:24:19 PST 2025

Total time taken to generate the page: 0.96863 seconds