daplis_rtp.functions.unpack module
Module with scripts for unpacking data from LinoSPAD2.
This file can also be imported as a module and contains the following functions:
unpack_bin - function for unpacking data from LinoSPAD2. Utilizes
the numpy library to speed up the process. Works with firmware versions 2212b and 2212s.
- daplis_rtp.functions.unpack.unpack_bin(file, board_number: str, fw_ver: str, timestamps: int = 512, absolute_timestamps: bool = False)[source]
Unpack binary data from LinoSPAD2.
Unpacks binary-encoded .dat files with data from LinoSPAD2 into a matrix with dimensions [64, # of timestamps*cycles + cycles, 2], where the third axis contains the timestamp and a pixel coordinate in the particular TDC.
- Parameters:
file (str) – Name of the ‘.dat’ data file to unpack.
board_number (str) – LinoSPAD2 daugtherboard number.
fw_ver (str) – LinoSPAD2 firmware version, ‘2212b’ or ‘2212s’.
timestamps (int, optional) – Number of timestamps per TDC per acquisition cycle, by default 512.
absolute_timestamps (bool, optional) – Indicator for data files collected with absolute timestamps. In such files, each acquisition cycle is preceded by two 32-bit words holding the 64-bit absolute timestamp of the cycle; these words are cut here so that the rest of the data can be unpacked as usual. By default False.
- Returns:
data_matrix – Matrix of timestamps in each TDC, with the pixel number in that TDC alongside each of them.
- Return type:
ndarray
- Raises:
ValueError – Raised if the firmware version is not one of ‘FW_VERSIONS’, or if the file does not match the ‘absolute_timestamps’ setting.