ClusterFile

The ClusterFile class is the main interface to read and write clusters in aare. Unfortunately the old file format does not include metadata like the cluster size and the data type. This means that the user has to know this information from other sources. Specifying the wrong cluster size or data type will lead to garbage data being read.

class aare.ClusterFile(fname, cluster_size=(3, 3), dtype=<class 'numpy.int32'>, chunk_size=1000)

Factory function to create a ClusterFile object. Provides a cleaner syntax for the templated ClusterFile in C++.

from aare import ClusterFile

with ClusterFile("clusters.clust", cluster_size=(3,3), dtype=np.int32) as cf:
    # cf is now a ClusterFile_Cluster3x3i object but you don't need to know that.
    for clusters in cf:
        # Loop over clusters in chunks of 1000
        # The type of clusters will be a ClusterVector_Cluster3x3i in this case

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

class aare._aare.ClusterFile_Cluster3x3i

Bases: pybind11_object

__init__(self: aare._aare.ClusterFile_Cluster3x3i, arg0: os.PathLike, chunk_size: int = 1000, mode: str = 'r') None
close(self: aare._aare.ClusterFile_Cluster3x3i) None
read_clusters(self: aare._aare.ClusterFile_Cluster3x3i, n_clusters: int) aare::ClusterVector<aare::Cluster<int, (unsigned char)3, (unsigned char)3, unsigned short>, void>
read_frame(self: aare._aare.ClusterFile_Cluster3x3i) aare::ClusterVector<aare::Cluster<int, (unsigned char)3, (unsigned char)3, unsigned short>, void>
set_gain_map(self: aare._aare.ClusterFile_Cluster3x3i, arg0: numpy.ndarray[numpy.float64]) None
set_noise_map(self: aare._aare.ClusterFile_Cluster3x3i, noise_map: numpy.ndarray[numpy.int32]) None
set_roi(self: aare._aare.ClusterFile_Cluster3x3i, roi: aare._aare.ROI) None
write_frame(self: aare._aare.ClusterFile_Cluster3x3i, arg0: aare::ClusterVector<aare::Cluster<int, (unsigned char)3, (unsigned char)3, unsigned short>, void>) None