daplis.functions.calc_diff module
Module for computing timestamp differences.
Compares all timestamps from the same cycle for the given pair of pixels against a given value (delta_window). Differences in that window are saved and returned as a list.
This file can also be imported as a module and contains the following functions:
calculate_differences - calculate timestamp differences
for the given pair of pixels. Works only with firmware version ‘2212’. Uses a faster algorithm than the standard version.
calculate_differences_1v1 - calculate timestamp
differences for the given pair of pixels. Works only with firmware version ‘2212’. Uses a faster algorithm than the standard version. Calculated only for the diagonal pixels, i.e., 1-1, 2-2, etc., and not for all pairs.
- daplis.functions.calc_diff.calculate_differences(data: ndarray, pixels: list[int] | list[list[int]], delta_window: float = 50000.0, cycle_length: float = 4000000000.0)[source]
Calculate timestamp differences for firmware version 2212.
Calculate timestamp differences for the given pixels and LinoSPAD2 firmware version 2212. Uses moving window algorithm for coincidence calculation.
- Parameters:
data (ndarray) – Matrix of timestamps, where rows correspond to the TDCs.
pixels (List[int] | List[List[int]]) – List of pixel numbers for which the timestamp differences should be calculated and saved or list of two lists with pixel numbers for peak vs. peak calculations.
delta_window (float, optional) – Width of the time window for counting timestamp differences. The default is 50e3 (50 ns).
cycle_length (float, optional) – Length of each acquisition cycle. The default is 4e9 (4 ms).
- Returns:
deltas_all – Dictionary containing timestamp differences for each pair of pixels.
- Return type:
dict
- daplis.functions.calc_diff.calculate_differences_1v1(data: ndarray, pixels: list[int] | list[list[int]], delta_window: float = 50000.0, cycle_length: float = 4000000000.0)[source]
Calculate timestamp differences for explicit 1-to-1 pixel pairs.
Like calculate_differences but pairs pixels_left[i] with pixels_right[i] only — no cross product. Requires both lists to have the same length.
- Parameters:
data (ndarray) – Dict of timestamp arrays keyed by pixel number string, as returned by the current unpacker pipeline.
pixels (List[int] | List[List[int]]) – Two lists of equal length: [[q0, q1, …], [w0, w1, …]]. Pair i is (pixels_left[i], pixels_right[i]).
delta_window (float, optional) – Width of the coincidence window in ps. The default is 50e3 (50 ns).
cycle_length (float, optional) – Length of each acquisition cycle in ps. The default is 4e9 (4 ms).
- Returns:
deltas_all – Timestamp differences keyed by
"q,w"for each pair.- Return type:
dict