locan.data.cluster.clustering.cluster_by_bin#
- locan.data.cluster.clustering.cluster_by_bin(locdata, loc_properties=None, min_samples=1, bins=None, n_bins=None, bin_size=None, bin_edges=None, bin_range=None, return_counts=False)[source]#
Cluster localizations in locdata by binning all localizations with regard to loc_properties and collecting all localizations per bin as cluster.
- Parameters:
locdata (
LocData
) – Localization data.loc_properties (
Optional
[list
[str
]]) – Localization properties to be grouped into bins. If None The coordinate_values of locdata are used.min_samples (
int
) – The minimum number of samples per bin to be considered as cluster.bins (
UnionType
[Bins
,Axis
,AxesTuple
,None
]) – The bin specification as defined inBins
bin_edges (
UnionType
[Sequence
[float
],Sequence
[Sequence
[float
]],None
]) – Array of bin edges with shape (n_bin_edges,) or (dimension, n_bin_edges) for all or each dimension.n_bins (
UnionType
[int
,Sequence
[int
],None
]) – The number of bins for all or each dimension. 5 yields 5 bins in all dimensions. (2, 5) yields 2 bins for one dimension and 5 for the other dimension.bin_size (
UnionType
[float
,Sequence
[float
],Sequence
[Sequence
[float
]],None
]) – The size of bins in units of locdata coordinate units for all or each dimension. 5 would describe bin_size of 5 for all bins in all dimensions. (2, 5) yields bins of size 2 for one dimension and 5 for the other dimension. To specify arbitrary sequence of bin_sizes use bin_edges instead.bin_range (tuple[float, ...] | tuple[tuple[float, float], ...] | Literal['zero'] | None) – The data bin_range to be taken into consideration for all or each dimension. ((min_x, max_x), (min_y, max_y), …) bin_range for each coordinate; for None (min, max) bin_range are determined from data; for ‘zero’ (0, max) bin_range with max determined from data.
return_counts (
bool
) – If true, n_elements per bin are returned.
- Returns:
Tuple with bins, bin_indices, collection of all generated selections (i.e. localization clusters), and counts per bin.
- Return type:
tuple[Bins | None, npt.NDArray[np.int64], LocData, npt.NDArray[np.int64] | None]