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]], pix_coor: ndarray, 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. Calculates only for the diagonal pixels, i.e., 1-1, 2-2, etc., and not for all pairs.

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 or list of two lists with pixel numbers for peak vs. peak calculations.

  • pix_coor (ndarray) – Array for transforming the pixel address in terms of TDC (0 to 3) to pixel number in terms of half of the sensor (0 to 255).

  • 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