[SciPy-user] neighbourhood of randomly scattered points

fred fredmfp@gmail....
Thu Aug 30 02:24:26 CDT 2007

Robert Kern a écrit :
> Show us your code, if you think there is a problem in it.
I really think there is no problem in my code,
it has been already validated.

My 2D data array is a n=501x501 array.
If I get n points from it, the neighbourhood is uniform,
I think this is a problem for nobody ;-)

In fact, I don't get n points, but far less, say 15000.

If these points were uniformly distributed,
I think I could not see theses structures: theses structures are not an 

>  Looking at images is a
> very poor way to judge randomness;
Yes, but one can see structures.
The question is : why I can see these structures .
Do they have any meaning ?
I was expecting to see no structure at all, in fact.
But may be I'm wrong.

I understand the trick like this : if I get 90 neighbours
in a neighbourhood, the density of points is much higher
than in a neighbourhood where I get only 40 neighbours per points.
So, for me, it is not uniformly distributed.

>  intuition isn't very good. I'm trying to
> verify your numbers quantitatively, but without knowing how you implemented the
> circular neighborhood, I can't. If you picked the most dense spot and the least
> dense, then those values appear reasonable.
Quite straightforward ;-)

I use something like this :

nbx, nby are the neighbourhood dimensions.

x0, y0 are the points coordinates.
x, y are the neighbourhood points coordinates

For a rectangular neighbourhood, I use

for all (x0,y0) points
for all (x, y) points
if  abs(x-x0) <= nbx and abs(y-y0) <= nby
  nb0 = nb0 +1

For a circular neighbourhood, I use

for all (x0, y0) points
for all (x, y) points
if ((x-x0)/nbx)**2 + ((y-y0)/nby)**2 <=  1
  nb0 = nb0 + 1

BTW, I did not look at your url yet.



More information about the SciPy-user mailing list