mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2026-10-27 14:21:28 +01:00
Optimized pedestal tracking with FastPedestal and performance improvements to the cluster finder. - ~2x faster hitting 14k FPS on benchmark dataset on 16 core threadripper pro **Changes** - No bounds check on interior of frame. (only within half of a cluster) (~15% improvement) - Cache threshold (std*n_rms) Biggest improvement comes from not computing std for each access - Cache pedestal subtracted frame - Switched to FastPedestal which assumes we reached steady state **Things tried but rejected:** - Always store cluster values, commit on val==max (~15% drop in frame rate) **Options** - using 16 bit clusters and 16 bit pedestal. (slows down the single threaded case but allow us to reach 12k with multi threading) **Other notes on performance** - Passing in memory frames from python and doing nothing: 0.8us/frame - Passing + pedestal subtraction: 28us/frame - Passing + pedestal + cluster finding (no store): 652us/frame - Passing + pedestal + cluster finding: 886 us/frame
25 lines
735 B
Python
25 lines
735 B
Python
from . import _aare
|
|
import numpy as np
|
|
from .factory import _type_to_char
|
|
|
|
|
|
def Cluster(x : int, y : int, data, cluster_size=(3,3), dtype = np.int32):
|
|
"""
|
|
Factory function to create a Cluster object. Provides a cleaner syntax for
|
|
the templated Cluster in C++.
|
|
|
|
.. code-block:: python
|
|
|
|
from aare import Cluster
|
|
|
|
Cluster(cluster_size=(3,3), dtype=np.float64)
|
|
"""
|
|
|
|
try:
|
|
class_name = f"Cluster{cluster_size[0]}x{cluster_size[1]}{_type_to_char(dtype)}"
|
|
cls = getattr(_aare, class_name)
|
|
except AttributeError:
|
|
raise ValueError(f"Unsupported combination of type and cluster size: {dtype}/{cluster_size} when requesting {class_name}")
|
|
|
|
return cls(x, y, data)
|