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

Home » Public Forums » archive » Re: simple vectorizing problem
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: simple vectorizing problem [message #62464 is a reply to message #62463] Mon, 08 September 2008 18:48 Go to previous messageGo to previous message
dpm314 is currently offline  dpm314
Messages: 3
Registered: September 2008
Junior Member
On Sep 8, 8:47 pm, dpm314 <meich...@gmail.com> wrote:
> Hey - here is a vectorizing question from an experienced programmer
> 'newish' to IDL.
>
> I have a stack of images dimensions (nx,ny, num_images) , a LOT of
> data sometimes, on which I need to preform a whole mathematical
> operation on. For example, one thing I need to do is create an array
> of the mean of each image.
>
> I've done this successfully with something like
> averages = fltarr(num_images)
> for k = 0, NUM_OF_CLICKS-1 do averages[k] = mean(image(*,*,k)
>
> which makes perfect sense to a c/c++/Fortran programmer.  But, this
> really hangs up for the size images I am working with (512*512*70000
> or more).  Is there a way to vectorize? I've tried several things
> like:
>
> averages = fltarr(num_images)
> a = indgen(num_images)
> averages(a) = mean(image(*,*,a))
>
> I've also tried reforming the image to by 2D, with dimensions [nx*ny,
> num_images] and doing a similar thing, but no luck.  That included
> making an array of integers, call it b, where b = 0, nx*ny*1 - 1,
> nx*ny*2 - 1, nx*ny*3 - 1 ... and doing something like
> averages(a) = mean(image(b[a]:b[a+1], a)
> (I know this probably will run out of bounds, I can't remember right
> now what I did, but it still didn't work and I had the series worked
> out right...)
>
> It seems that in a language like IDL there should be a way to do
> something like this without writing a for-loop.
>
> Thanks,
>
> David M.

Sorry, in the first bit of code NUM_OF_CLICKS is same thing as
num_images ... David M.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Contour Issues... Help please
Next Topic: Is there a 32/64-bit save file

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

Current Time: Wed Oct 08 16:02:03 PDT 2025

Total time taken to generate the page: 0.00468 seconds