Files
aare/docs/src/python/cluster/pyClusterVector.rst
T
mazzol_a 6ff664f812
Build on RHEL9 / build (push) Successful in 2m24s
Build on RHEL8 / build (push) Successful in 2m54s
Run tests using data on local RHEL8 / build (push) Successful in 3m52s
Build on local RHEL8 / build (push) Successful in 2m34s
allow passing mask to clustervector (#304)
- passing mask to ClusterVector 
- creates a copy of the ClusterVector

Co-authored-by: Erik Fröjdh <erik.frojdh@psi.ch>
2026-04-17 17:13:02 +02:00

1.6 KiB

ClusterVector

The ClusterVector, holds clusters from the ClusterFinder. Since it is templated in C++ we use a suffix indicating the type of cluster it holds. The suffix follows the same pattern as for ClusterFile i.e. ClusterVector_Cluster3x3i for a vector holding 3x3 integer clusters.

At the moment the functionality from python is limited and it is not supported to push_back clusters to the vector. The intended use case is to pass it to C++ functions that support the ClusterVector or to view it as a numpy array.

View ClusterVector as numpy array

from aare import ClusterFile
with ClusterFile("path/to/file") as f:
    cluster_vector = f.read_frame()

# Create a copy of the cluster data in a numpy array
clusters = np.array(cluster_vector)

# Avoid copying the data by passing copy=False
clusters = np.array(cluster_vector, copy = False)

ClusterVector

Below is the API of the ClusterVector_Cluster3x3i but all variants share the same API.

aare._aare.ClusterVector_Cluster3x3i

Free Functions:

reduce_to_3x3

Reduce a single Cluster to 3x3 by taking the 3x3 subcluster with highest photon energy.

reduce_to_2x2

Reduce a single Cluster to 2x2 by taking the 2x2 subcluster with highest photon energy.