digi — Digitization facilities#
This module contains…
Digi event structure#
@dataclass
class DigiEventRectangular(DigiEventBase):
"""Specialized class for a digitized event based on a rectangular ROI.
This implements the basic legacy machinery of the XPOL-I and XPOL-III readout chips.
"""
roi: RegionOfInterest
Module documentation#
Digi event structures.
- class hexsample.digi.DigiEventBase(trigger_id: int, seconds: int, microseconds: int, livetime: int, pha: ndarray)[source]#
Base class for a digitized event.
This includes alll the timing information that is common to the different digitized event structure, as well as the PHA content of the pixels in the event, but no information about the physical location on the latter within the readout chip. It is responsibility of the derived classes to provide this information, in the way that is more conventient, depending on the particular readout strategy.
Arguments#
- trigger_idint
The trigger identifier.
- secondsint
The integer part of the timestamp.
- microsecondsint
The fractional part of the timestamp.
- phanp.ndarray
The pixel content of the event, in the form of a 1-dimensional array.
- trigger_id: int#
- seconds: int#
- microseconds: int#
- livetime: int#
- pha: ndarray#
- timestamp() float[source]#
Return the timestamp of the event, that is, the sum of the second and microseconds parts of the DigiEvent contributions as a floating point number.
- class hexsample.digi.DigiEventSparse(trigger_id: int, seconds: int, microseconds: int, livetime: int, pha: ndarray, columns: ndarray, rows: ndarray)[source]#
Sparse digitized event.
In this particular incarnation of a digitized event we have no ROI structure, nor any rule as to the shape or morphology of the particular set of pixels being read out. The event represent an arbitrary collection of pixels, and we carry over the arrays of their row and column identifiers, in the form of two arrays whose length must match that of the PHA values.
Arguments#
- columnsnp.ndarray
The column identifier of the pixels in the event (must have the same length of the pha class member).
- rowsnp.ndarray
The row identifier of the pixels in the event (must have the same length of the pha class member).
- columns: ndarray#
- rows: ndarray#
- classmethod from_digi(file_row: ndarray, pha: ndarray, columns: ndarray, rows: ndarray)[source]#
Alternative constructor rebuilding an object from a row on a digi file.
This is used internally when we access event data in a digi file, and we need to reassemble a DigiEvent object from a given row of a digi table.
- as_dict() dict[source]#
Return the pixel content of the event in the form of a {(col, row): pha} value.
This is useful to address the pixel content at a given coordinate. We refrain, for the moment, from implementing a __call__() hook on top of this, as the semantics would be fundamentally different from that implemented with a rectangular ROI, where the access happen in ROI coordinates, and not in chip coordinates, but we might want to come back to this.
- class hexsample.digi.DigiEventRectangular(trigger_id: int, seconds: int, microseconds: int, livetime: int, pha: ndarray, roi: RegionOfInterest)[source]#
Specialized class for a digitized event based on a rectangular ROI.
This implements the basic legacy machinery of the XPOL-I and XPOL-III readout chips.
- roi: RegionOfInterest#
- classmethod from_digi(file_row: ndarray, pha: ndarray)[source]#
Alternative constructor rebuilding an object from a row on a digi file.
This is used internally when we access event data in a digi file, and we need to reassemble a DigiEvent object from a given row of a digi table.
- highest_pixel(absolute: bool = True) Tuple[int, int][source]#
Return the coordinates (col, row) of the highest pixel.
Arguments#
- absolutebool
If true, the absolute coordinates (i.e., those referring to the readout chip) are returned; otherwise the coordinates are intended relative to the readout window (i.e., they can be used to index the pha array).
- class hexsample.digi.DigiEventCircular(trigger_id: int, seconds: int, microseconds: int, livetime: int, pha: ndarray, column: int, row: int)[source]#
Circular digitized event.
In this particular incarnation of a digitized event the ROI is built around a central pixel, that is the one corresponding to maximum PHA. The ROI is then always (except in border-pixel cases) composed by 7 pixels: the central one and its 6 neighbours.
Arguments#
- columnint
The column identifier of the maximum PHA pixel in the event in pixel coordinates.
- rowint
The column identifier of the maximum PHA pixel in the event in pixel coordinates.
- column: int#
- row: int#