kdcount package¶
Subpackages¶
Submodules¶
Module contents¶
-
class
kdcount.
KDAttr
[source]¶ Bases:
kdcount.pykdcount.KDAttr
-
class
kdcount.
KDNode
[source]¶ Bases:
kdcount.pykdcount.KDNode
-
count
(other, r, attrs=None, info={})[source]¶ Gray & Moore based fast dual tree counting.
r is the edge of bins:
-inf or r[i-1] < count[i] <= r[i]
- attrs: None or tuple
- if tuple, attrs = (attr_self, attr_other)
- Returns: count,
- count, weight of attrs is not None
-
enum
(other, rmax, process=None, bunch=100000, **kwargs)[source]¶ cross correlate with other, for all pairs closer than rmax, iterate.
>>> def process(r, i, j, **kwargs): >>> ...
>>> A.enum(... process, **kwargs): >>> ...
where r is the distance, i and j are the original input array index of the data. arbitrary args can be passed to process via kwargs.
-
enumiter
(other, rmax, bunch=100000)[source]¶ cross correlate with other, for all pairs closer than rmax, iterate.
- for r, i, j in A.enumiter(...):
- ...
where r is the distance, i and j are the original input array index of the data.
This uses a thread to convert from KDNode.enum.
-
fof
(linkinglength, out=None)[source]¶ Friend-of-Friend clustering with linking length.
Returns: the label
-
-
class
kdcount.
KDTree
(input, boxsize=None, thresh=10)[source]¶ Bases:
kdcount.pykdcount.KDTree
KDTree.root is the root node. The algorithms are implemented as methods of the node.
Parameters: input : array_like
single or double array of shape (N, ndims).
boxsize : array_like or scalar
If given, the input data is on a torus with periodic boundry. the size of the torus is given by boxsize.
thresh : int
minimal size of a leaf.