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

Home » Public Forums » archive » Re: array operations
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: array operations [message #55814 is a reply to message #55813] Wed, 12 September 2007 03:18 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
payon@gmx.de writes:
> Hello,
> I have a small question to an array operation.
>
> I have a 3-dimensional array. 10x10x100 ... the first 2 dimensions
> 10x10 are spatial dimensions (so one image with 10 width with and 10
> pix height). The third dimension is the time dimension. So every
> images was acquired 100 times.
>
> What I wanted to do is now to compute the the mean of every pixel in
> time dimension.
>
> So for one special pixel (e.g. [3,3]) i would write
>
> meanpixel = mean(myarray[3,3,*])
>
> but how is it, if i would like to do this operation for every pixel in
> the spatial dimensions? I just saw a possibility with a for loop.
>

If you are just computing the mean value, then using TOTAL is the
fastest. You can sum over any axis you wish, and then divide by the
number of pixels in the sum.

For example,
mean_image = total(myarray,3) / 100
would give the mean image. The "3" tells TOTAL to sum over the third
dimension.


Good luck,
Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: array operations
Next Topic: ion problem

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

Current Time: Wed Oct 08 18:07:14 PDT 2025

Total time taken to generate the page: 0.00460 seconds