Skip to content

gamma_model

gamma_model

DSC gamma-variate binding adapter for the shared fitting infrastructure.

BoundGammaVariateModel wraps the gamma-variate function with time points, producing a FittableModel that the shared fitter can use for recirculation removal.

BoundGammaVariateModel

BoundGammaVariateModel(time, fixed=None, peak_time=None)

Bases: BaseBoundModel

Gamma-variate model with time points bound.

Wraps the gamma-variate function so the fitter only sees predict_array_batch(free_params) -> output.

PARAMETER DESCRIPTION
time

Time points in seconds.

TYPE: NDArray

fixed

Parameters to fix at constant values during fitting.

TYPE: dict[str, float] | None DEFAULT: None

peak_time

Approximate peak time for setting t0 upper bound.

TYPE: float | None DEFAULT: None

ensure_device

ensure_device(xp)

Transfer time array to the target device.

get_bounds

get_bounds()

Return bounds, optionally restricting t0 to before peak.

predict_array_batch

predict_array_batch(free_params_batch, xp)

Predict gamma-variate concentration for a batch.

PARAMETER DESCRIPTION
free_params_batch

Free parameter values, shape (n_free, n_voxels).

TYPE: NDArray

xp

Array module.

TYPE: module

RETURNS DESCRIPTION
NDArray

Predicted concentration, shape (n_time, n_voxels).

get_initial_guess_batch

get_initial_guess_batch(observed_batch, xp)

Get initial parameter guesses from curve shape.

PARAMETER DESCRIPTION
observed_batch

Observed data, shape (n_time, n_voxels).

TYPE: NDArray

xp

Array module.

TYPE: module

RETURNS DESCRIPTION
NDArray

Initial guesses, shape (n_free, n_voxels).