pyfli.simulator.irf_sim.irf_offset_gen#

Sample per-call IRF time-of-flight shifts and baseline offsets for the simulator workflow.

This module belongs to pyfli.simulator.irf_sim and is part of PyFLI synthetic FLI/FLIM data generation, hardware noise modeling, calibration, and validation tools. Public API includes classes OffsetGen.

Classes

OffsetGen(irf_data[, a_range, b_range, pixel])

Samples a horizontal time-of-flight shift a and a vertical baseline offset b for a single pixel's base IRF, and applies them to produce a shifted IRF trace: I(t) -> np.roll(I, round(a)) + b.

class OffsetGen(irf_data, a_range=(-20, 100), b_range=(0, 10), pixel=(0, 0))[source]#

Bases: object

Samples a horizontal time-of-flight shift a and a vertical baseline offset b for a single pixel’s base IRF, and applies them to produce a shifted IRF trace: I(t) -> np.roll(I, round(a)) + b.

Parameters:
  • irf_data (np.ndarray) – Full IRF cube, shape (H, W, n_bins).

  • a_range (tuple[float, float]) – Uniform sampling range for the horizontal shift a, in bins.

  • b_range (tuple[float, float]) – Uniform sampling range for the vertical baseline offset b.

  • pixel (tuple[int, int]) – (row, col) pixel used to select the base IRF trace from irf_data.

sample()[source]#

Draws a and b and returns the shifted IRF as (irf_1d, a, b).

sample_cube()[source]#

Applies an independently-sampled (a, b) to every pixel of the full 3-D irf_data cube, returning the fully shifted IRF cube along with (H, W) maps of the a/b values drawn per pixel.

Returns:

(irf_cube, a_map, b_map) — the shifted (H, W, n_bins) IRF cube, and the per-pixel a/b values used to build it.

Return type:

tuple[np.ndarray, np.ndarray, np.ndarray]

sample_picked(px=None)[source]#

Picks one IRF trace out of the full 3-D irf_data cube via irf_picker() — an SNR-validated random pixel, or the given px — then draws a/b and applies them to it.

Parameters:

px (tuple[int, int] | None) – Explicit (x, y) pixel to pick, forwarded to irf_picker. A random SNR-validated pixel is chosen when omitted.

Returns:

(irf_1d, a, b) — the shifted IRF trace and the shift/offset used to build it.

Return type:

tuple[np.ndarray, float, float]