Fixed ClusterVector move, filtering, and improved documentation (#357)
Run tests using data on local RHEL8 / build (push) Failing after 4m6s
Build on local RHEL8 / build (push) Successful in 2m52s
Build on RHEL9 / build (push) Successful in 2m44s
Build on RHEL8 / build (push) Successful in 3m16s

- Default `ClusterVector` move operations simplifying the code and
fixing a bug.
- Fixed inconsistent frame number type (uint64/int32)
- Validate Python masks as one-dimensional, C-contiguous Boolean arrays,
handle empty masks safely, and reserve filtered storage based on the
selected cluster count.
- Align the C++ and Python API documentation with the implementation,
including concise `hitmap` and reduction documentation and a correctly
rendered constructor example.
This commit is contained in:
Erik Fröjdh authored and GitHub committed 2026-09-07 08:19:26 +02:00
1 parent 4eb2bfcfcc
commit dd409cfe41
11 files changed
+450 -187

No files matched your search

+24 -7
View File
@@ -7,16 +7,33 @@ from .ClusterFinder import _get_class
def ClusterVector(cluster_size=(3,3), dtype = np.int32):
"""
Factory function to create a ClusterVector object. Provides a cleaner syntax for
the templated ClusterVector in C++.
Create an empty ClusterVector for a supported cluster size and pixel dtype.
.. code-block:: python
Parameters
----------
cluster_size : tuple[int, int], default=(3, 3)
Cluster dimensions in the x and y directions.
dtype : numpy.dtype, default=numpy.int32
Pixel storage type. The cluster size and dtype combination must have a
compiled binding.
from aare import ClusterVector
ClusterVector(cluster_size=(3,3), dtype=np.float64)
Returns
-------
ClusterVector
An empty vector with frame number 0 and space reserved for at least
1024 clusters.
Raises
------
ValueError
If the requested size and dtype combination is unavailable.
Examples
--------
>>> import numpy as np
>>> from aare import ClusterVector
>>> clusters = ClusterVector(cluster_size=(3, 3), dtype=np.float64)
"""
cls = _get_class("ClusterVector", cluster_size, dtype)
return cls()