pyfli.solver.cpu_processor#

Process FLI image cubes on CPU with parallel pixel-level fitting.

This module belongs to pyfli.solver and is part of PyFLI least-squares, maximum- likelihood, CPU, GPU, binned, and global FLI fitting routines. Public API includes classes FLICPUProcessor.

Classes

FLICPUProcessor(freq, fitter_class)

Run pixel-wise FLI fitting on CPU.

class FLICPUProcessor(freq, fitter_class)[source]#

Bases: object

Run pixel-wise FLI fitting on CPU. The processor parallelizes fitting across image pixels, reconstructs parameter maps, saves results, and loads saved maps.

Parameters:
  • freq (float) – Acquisition frequency information used to derive timing constants.

  • fitter_class (Any) – Fitter class instantiated by the processor.

process_image(image_cube, irf_cube, mask=None, data_name='FLIM_Dataset', model_type='bi-exponential', estimator='least_squares', p0=None, bounds=None, n_jobs=-1, backend='loky', fit_indices=None, **kwargs)[source]#

Process image.

Parameters:
  • image_cube (np.ndarray) – Time-resolved decay image cube.

  • irf_cube (np.ndarray) – Instrument response cube aligned with the decay image cube.

  • mask (np.ndarray | None) – Boolean or labeled mask selecting pixels for the operation.

  • data_name (str) – Label assigned to the fitted or processed dataset.

  • model_type (str) – FLI model family, such as mono- or bi-exponential.

  • estimator (str) – Estimator name used to choose a fitting objective.

  • p0 (Any | None) – Initial parameter vector supplied to the optimizer.

  • bounds (np.ndarray | None) – Lower and upper parameter bounds supplied to the optimizer.

  • n_jobs (int) – Number of parallel jobs used for CPU fitting.

  • backend (str) – Joblib execution backend used for parallel CPU fitting.

  • fit_indices (tuple[int, int] | None) – Optional (gate_num_start, gate_num_end) gate range to fit over, e.g. to focus on the tail of the decay. None fits the full trace.

  • **kwargs (Any) – Additional keyword options forwarded to the underlying implementation.

Returns:

Object produced by process image.

Return type:

Any

save_results(dataset, folder='results')[source]#

Save results.

Parameters:
  • dataset (np.ndarray) – Dataset dictionary or fit result collection to save.

  • folder (str) – Output directory used when saving results.

Returns:

No object is returned; the function save results.

Return type:

None

load_map(h5_path, map_name='tau1_map')[source]#

Load map.

Parameters:
  • h5_path (str) – Filesystem path used by the routine.

  • map_name (str) – Name of the saved parameter map to load.

Returns:

Object produced by load map.

Return type:

Any