pyfli.simulator.calibration.data_io#

Load the experimental decay cube, IRF, mask and AlliGator / SPCImage / pyfli maps.

Functions

_amplitude_to_intensity(a1, tau1, tau2)

_as_cube(arr)

_canonical(raw, alpha_kind)

Map loader-specific keys to tau1/tau2/alpha1/efficiency/tau/photon_count.

_detect_source(path)

_load_mask(mask_path, spatial_shape)

_load_pyfli_npy(path)

_to_ns(tau)

SPCImage exports lifetimes in ps; anything with a median above 50 is treated as ps.

load_experimental_data(data_path[, ...])

Load the 3D decay cube (and optional IRF / mask) with pyfli.io.DataOperations and optionally apply pyfli's spatial binning (FLIBinner).

load_reference_maps(path[, source, alpha_kind])

Load optional parameter maps from AlliGator (*Map.txt folder), SPCImage (*.asc folder) or pyfli (a session .npy file, or a session folder in which case the first match of PYFLI_REFERENCE_PATTERNS is used).

Classes

ExperimentalData(decay, irf, mask, source_path)

ReferenceMaps(source, path, maps, ...)

Exceptions

MaskShapeError

The mask's spatial shape differs from the decay cube's.

class ExperimentalData(decay: ndarray, irf: ndarray | None, mask: ndarray | None, source_path: str, bin_radius: int = 0)[source]#

Bases: object

Parameters:
decay: ndarray#
irf: ndarray | None#
mask: ndarray | None#
source_path: str#
bin_radius: int = 0#
property n_bins: int#
property spatial_shape: tuple[int, int]#
class ReferenceMaps(source: str, path: str, maps: dict[str, numpy.ndarray]=<factory>)[source]#

Bases: object

Parameters:
source: str#
path: str#
maps: dict[str, ndarray]#
aligned_with(spatial_shape)[source]#
Parameters:

spatial_shape (tuple[int, int])

Return type:

bool

values(key, mask=None)[source]#

Finite values of one map, restricted to mask when the shapes agree.

Parameters:
Return type:

ndarray

exception MaskShapeError[source]#

Bases: ValueError

The mask’s spatial shape differs from the decay cube’s.

load_experimental_data(data_path, irf_path=None, bg_path=None, mask_path=None, bin_radius=0)[source]#

Load the 3D decay cube (and optional IRF / mask) with pyfli.io.DataOperations and optionally apply pyfli’s spatial binning (FLIBinner). Binning a provided mask is not needed: it stays in the original pixel grid.

Parameters:
  • data_path (str)

  • irf_path (str | None)

  • bg_path (str | None)

  • mask_path (str | None)

  • bin_radius (int)

Return type:

ExperimentalData

load_reference_maps(path, source='auto', alpha_kind='auto')[source]#

Load optional parameter maps from AlliGator (*Map.txt folder), SPCImage (*.asc folder) or pyfli (a session .npy file, or a session folder in which case the first match of PYFLI_REFERENCE_PATTERNS is used).

alpha_kind says whether the source’s fraction is an intensity fraction (pyfli, AlliGator f1_i) or an amplitude fraction (SPCImage a1[%], AlliGator f1_a).

Parameters:
Return type:

ReferenceMaps