Skip to content

base

base

Base classes for all osipy components and signal models.

This module provides BaseComponent, the lightweight shared base for ALL registered osipy components (models, fitters, correctors, detectors), and BaseSignalModel, the abstract base for parametric forward models.

BaseComponent

Bases: ABC

Shared interface for all registered osipy components.

Every registered class in osipy — signal models, fitters, leakage correctors, arrival detectors, calibration methods, AIF detectors, and AIF models — inherits from this base to guarantee a minimal introspection interface.

name abstractmethod property

name

Return human-readable component name.

reference abstractmethod property

reference

Return primary literature citation for this component.

RETURNS DESCRIPTION
str

Citation string.

BaseSignalModel

Bases: BaseComponent

Abstract base class for all parametric signal models.

All modality-specific model base classes (BasePerfusionModel, IVIMModel, BaseASLModel) inherit from this class to ensure a consistent interface for registry-driven dispatch and fitting.

parameters abstractmethod property

parameters

Return list of parameter names.

parameter_units abstractmethod property

parameter_units

Return mapping of parameter names to their units.

RETURNS DESCRIPTION
dict[str, str]

Parameter units (e.g., {'Ktrans': '1/min', 've': 'mL/100mL'}).

get_bounds abstractmethod

get_bounds()

Return parameter bounds as {name: (lower, upper)}.

params_to_array

params_to_array(params)

Convert parameter dataclass or dict to array.

PARAMETER DESCRIPTION
params

Parameter dataclass or dict.

TYPE: Any

RETURNS DESCRIPTION
NDArray[floating]

Parameter values in standard order.

array_to_params

array_to_params(values)

Convert array to parameter dictionary.

PARAMETER DESCRIPTION
values

Parameter values in standard order.

TYPE: NDArray[floating]

RETURNS DESCRIPTION
dict[str, float]

Parameter dictionary.

bounds_to_arrays

bounds_to_arrays()

Convert bounds dict to lower/upper arrays.

RETURNS DESCRIPTION
tuple[NDArray, NDArray]

(lower_bounds, upper_bounds) arrays.