clustering — Clustering#
Module documentation#
Clustering facilities.
- class hexsample.clustering.Cluster(x: ndarray, y: ndarray, pha: ndarray)[source]#
Small container class describing a cluster.
- x: ndarray#
- y: ndarray#
- pha: ndarray#
- versors() Tuple[ndarray, ndarray][source]#
Return the versors u and v for the cluster. Their definitions depend on the cluster size. For 2-pixel clusters u is the versor that points from the center of the pixel with the highest pha to the center of the other one, while v is the versor perpendicular to u in counterclockwise direction. For 3-pixel clusters u points from the center of the pixel with the highest pha to the midpoint of the line that connects the centers of the other two pixels, and v is perpendicular to u and points towards the second most charged pixel.
Returns#
- unp.ndarray
The u versor.
- vnp.ndarray
The v versor.
- eta(eta_2pix_rad: float, eta_2pix_pivot: float, eta_3pix_rad0: float, eta_3pix_rad1: float, eta_3pix_rad_pivot: float, eta_3pix_theta0: float, pitch: float) Tuple[float, float][source]#
Return the cluster reconstructed position using the eta function calibrated for 2 and 3 pixel clusters. If cluster size is not 2 or 3, reconstruct the position with the centroid.
Arguments#
- eta_2pix_radfloat
Probit function sigma parameter for two pixel events.
- eta_2pix_pivotfloat
Transition value from linear (0 to pivot) to probit (> pivot) for two pixel events.
- eta_3pix_rad0float
Probit function offset parameter for three pixel events radial position component.
- eta_3pix_rad1float
Probit function sigma parameter for three pixel events radial position component.
- eta_3pix_rad_pivotfloat
Transition value from linear (0 to pivot) to probit (> pivot) for three pixel events radial position component.
- eta_3pix_theta0float
Probit function sigma parameter for three pixel events angular position component.
- pitchfloat
The pitch of the pixels.
- class hexsample.clustering.ClusteringBase(grid: HexagonalGrid, zero_sup_threshold: float)[source]#
Base class for the clustering.
- grid: HexagonalGrid#
- zero_sup_threshold: float#
- position_suppress(pha: ndarray, col: ndarray, row: ndarray) Tuple[ndarray, ndarray, ndarray][source]#
Suppress pixels in the cluster that do not satisfy the position requirements.
If the cluster contains 2 or fewer pixels, no action is taken. For clusters with more than 2 pixels, the algorithm retains the two most charged pixels and only one additional neighbor (the one with the highest charge) of the second pixel, discarding all others.
Arguments#
- phanp.ndarray
The array of pulse heights of the pixels in the cluster, ordered in decreasing order.
- colnp.ndarray
The array of column indexes of the pixels in the cluster.
- rownp.ndarray
The array of row indexes of the pixels in the cluster.
Returns#
- phanp.ndarray
The array of pulse heights of the pixels in the cluster after position suppression, ordered in decreasing order.
- colnp.ndarray
The array of column indexes of the pixels in the cluster after position suppression, ordered in decreasing order of pulse height.
- rownp.ndarray
The array of row indexes of the pixels in the cluster after position suppression, ordered in decreasing order of pulse height.
- run(event: DigiEventRectangular) Cluster[source]#
Workhorse method to be reimplemented by derived classes.
- class hexsample.clustering.ClusteringNN(grid: HexagonalGrid, zero_sup_threshold: float, num_neighbors: int)[source]#
Neirest neighbor clustering.
This is a very simple clustering strategy where we use the highest pixel in the event as a seed, loop over the six neighbors (after the zero suppression) and keep the N highest pixels.
Arguments#
- num_neighborsint
The number of neighbors (between 0 and 6) to include in the cluster.
- num_neighbors: int#