Re: Positions in 3-d [message #43821 is a reply to message #43820] |
Fri, 29 April 2005 11:35  |
Xavier Llobet
Messages: 7 Registered: April 2005
|
Junior Member |
|
|
In article <1114797354.327497.219120@f14g2000cwb.googlegroups.com>,
panblosky@gmail.com wrote:
> Hi, I have the following problem. I have a 3xn array, where n can go
> from 32000 to 16.000.000. This array represents positions in space, or
> just lets say x,y,z. The numbers go from 0 to 1. I have a cube of sides
> 1. I divide that cube into a 3-D grid, where my gridsize can go from 32
> to 512 in every direction (depends on how big I want the grid). So, in
> 1-D, the box is going to be divided in:
>
> lon=findgen(n0)/float(n0-1)*float(boxsize)/boxsize
>
> where n0 is the size of the grid (for example, 128) and boxsize is 1.
> The same thing goes for the other two dimensions.
> Now, I want to find what points (x,y,z) lies in which gridcell
> (between lon[i+1] and lon[i] in every direction).
> If I do it with a for loop (together with a where), it will take for
> ever. I have tried sorting, but I just can't get it right. Does
> somebody knows a fast way?
> Thanks,
>
> Pablo
Look at the HISTOGRAM function, REVERSE_INDICES keyword.
--
_xavier
--
Only one "o" in my e-mail address
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
|
|
|