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
|
Fit FLI image cubes with Torch on GPU or CPU fallback. |
- class FLIGPUProcessor(freq, fitter_class=None, device=None)[source]#
Bases:
objectFit 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, weighting='irls', **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) – IfTrue, 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.Nonefits the full trace.weighting (
str) – Residual weights formode="NLSF"(ignored for MLE, which uses the Poisson deviance):"irls"(default) divides each squared residual by the current model value held constant in the gradient – the batched counterpart of iteratively reweighted least squares, whose converged solution solves the Poisson likelihood equations;"none"is unweighted;"neyman"divides by the measured counts (former default, biased towards short lifetimes at low counts).mode="NEYMAN"implies"neyman".variance_floor(kwarg, default 1.0) floors the IRLS variance.**kwargs (
Any) – Additional keyword options forwarded to the underlying implementation.
- Returns:
Object produced by fit image.
- Return type:
Any