[SciPy-User] KDTree count_neighbors
Anne Archibald
aarchiba at physics.mcgill.ca
Fri Jul 2 16:25:35 EDT 2010
The count_neighbors function is designed to compare close neighbors
between two trees, not between one tree and one point or one tree and
one array of points. I think the fastest way to get what you want is
to just query for the neighbors and take the length of the resulting
list. You could also try putting your query point (or points) into a
KDtreel; if you have many query points this will be much faster.
Anne
On 2 July 2010 16:15, elmar <elmar at net4werling.de> wrote:
> Am 02.07.2010 21:44, schrieb Sturla Molden:
>> elmar skrev:
>>> Can anyone give me some support ? Any help is wellcome !
>>>
>>
>> You are passing an array instead of a KDTree.
>>
>> def count_neighbors(self, other, r, p=2.):
>> """Count how many nearby pairs can be formed.
>>
>> Count the number of pairs (x1,x2) can be formed, with x1 drawn
>> from self and x2 drawn from other, and where distance(x1,x2,p)<=r.
>> This is the "two-point correlation" described in Gray and Moore 2000,
>> "N-body problems in statistical learning", and the code here is based
>> on their algorithm.
>>
>> Parameters
>> ==========
>>
>> other : KDTree
>
> hi sturla,
>
> it's late, it's hot, football is on TV and
>
> num = KDTree.count_neighbors(point, tree, r)
>
> aren't working neither-
>
> Can you give a newby a more detailed help ?
>
> elmar
>
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
More information about the SciPy-User
mailing list