dosma.MonoExponentialFit

class dosma.MonoExponentialFit(x: Optional[Sequence[float]] = None, y: Optional[Sequence[dosma.core.med_volume.MedicalVolume]] = None, mask: Optional[dosma.core.med_volume.MedicalVolume] = None, bounds: Tuple[float] = (0, 100.0), tc0: Union[float, str] = 30.0, r2_threshold: float = 'preferences', decimal_precision: int = 1, num_workers: int = 0, chunksize: int = 1000, verbose: bool = False)[source]

Fit quantitative values using mono-exponential fit of model \(y=a*exp(-x/tc)\).

Parameters
  • x (array-like) – 1D array of independent variables corresponding to different volumes.

  • y (list[MedicalVolumes]) – Volumes (in order) corresponding to independent variable in x.

  • mask (MedicalVolume, optional) – Mask of pixels to fit. If specified, pixels outside of mask region are ignored and set to np.nan. Speeds fitting time as fewer fits are required.

  • bounds (tuple[float, float], optional) – Upper and lower bound for quantitative values. Values outside those bounds will be set to np.nan.

  • tc0 (float, optional) – Initial time constant guess. If "polyfit", this guess will be determined by first doing a polynomial fit on the log-linearized form of the monoexponential equation \(\log y = \log a - \frac{t}{tc}\). Note for polyfit initialization, subvolumes should not have any nan or infinite values.

  • decimal_precision (int, optional) – Rounding precision after the decimal point.

  • num_workers (int, optional) – Maximum number of workers to use for fitting.

  • chunksize (int, optional) – Size of chunks sent to worker processes when num_workers > 0. When show_pbar=True, this defaults to the standard value in tqdm.concurrent.process_map().

  • verbose (bool, optional) – If True, show progress bar. Note this can increase runtime slightly when using multiple workers.

__init__(x: Optional[Sequence[float]] = None, y: Optional[Sequence[dosma.core.med_volume.MedicalVolume]] = None, mask: Optional[dosma.core.med_volume.MedicalVolume] = None, bounds: Tuple[float] = (0, 100.0), tc0: Union[float, str] = 30.0, r2_threshold: float = 'preferences', decimal_precision: int = 1, num_workers: int = 0, chunksize: int = 1000, verbose: bool = False)[source]

Methods

__init__([x, y, mask, bounds, tc0, ...])

fit([x, y, mask])

Perform monoexponential fitting.