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

Home » Public Forums » archive » Re: Strange array division 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: Strange array division problem [message #66294 is a reply to message #66293] Mon, 04 May 2009 16:35 Go to previous message
cgguido is currently offline  cgguido
Messages: 195
Registered: August 2005
Senior Member
On May 4, 4:42 pm, David Klassen <klas...@rowan.edu> wrote:
> I'm trying to create an array by reading in 2-d data and putting into
> planes in a 3-d array, however, some of the data is redundant---the 2-
> d data would go into the same plane.  In these cases, I want to
> average them so I figure I can just add the data to the current plane
> value, keeping track of how many data arrays go into each plane, then
> just divide the final 3-d array by these counts.  But I'm stuck on how
> exactly to implement that.
>
> My 3-d array X columns, Y rows, Z planes and the 2-d array is Z
> columns by Y rows (so I'm "rotating" the data and "sliding" each one
> into a column of the 3-d array---I hope that makes sense).  I then
> have a vector, xcounts, that is X elements long and as data go into
> the columns, I increment xcounts[X].
>
> So, when I'm done populating the 3-d array I need to divide each row
> in each plane by the vector xcounts.  Is there an easy way to do this
> that doesn't involve me looping through all the points?

how about:

a3d /= rebin(xcounts,z,y,x)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: remove duplicate elements from a multi-dimensional array efficiently in IDL
Next Topic: How to judge a Function's parameters ?

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

Current Time: Fri Oct 10 10:37:26 PDT 2025

Total time taken to generate the page: 0.80050 seconds