pyfli.solver.gpu_processor#

Fit FLI image cubes with Torch-based GPU optimization and optional CRLB estimates.

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 FLIGPUProcessor.

Classes

FLIGPUProcessor(freq[, fitter_class, device])

Fit FLI image cubes with Torch on GPU or CPU fallback.

class FLIGPUProcessor(freq, fitter_class=None, device=None)[source]#

Bases: object

Fit FLI image cubes with Torch on GPU or CPU fallback. It vectorizes parameter transforms, model evaluation, optimization, CRLB estimation, reconstruction, and result saving.

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

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

  • device (Any | None) – Execution device, such as a Torch device or device string.

fit_image(image_cube, irf_cube, mask=None, mode='MLE', model_type='bi-exponential', max_iter=500, CRLB=False, data_name='Torch_Fit', p0=None, fit_indices=None, **kwargs)[source]#

Fit 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.

  • mode (str) – Mode selector used by the fitting, loading, or plotting routine.

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

  • max_iter (int) – Maximum number of optimization iterations.

  • CRLB (bool) – If True, compute Cramer-Rao lower-bound uncertainty estimates.

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

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

  • 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. The forward model is still evaluated over the full trace (needed for correct IRF convolution); only the loss and fit statistics are restricted to this gate range. None fits the full trace.

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

Returns:

Object produced by fit 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