Skip to content

curves

curves

Time-course visualization functions.

This module provides functions for visualizing time-course data, AIFs, and residue functions.

plot_time_course

plot_time_course(
    time,
    signal,
    fitted=None,
    title="Time Course",
    xlabel="Time (s)",
    ylabel="Signal",
    label_measured="Measured",
    label_fitted="Fitted",
    ax=None,
    figsize=(10, 6),
)

Plot time-course data with optional fitted curve.

PARAMETER DESCRIPTION
time

Time points.

TYPE: NDArray

signal

Measured signal values.

TYPE: NDArray

fitted

Fitted/predicted signal values.

TYPE: NDArray DEFAULT: None

title

Plot title.

TYPE: str DEFAULT: 'Time Course'

xlabel

Axis labels.

TYPE: str DEFAULT: 'Time (s)'

ylabel

Axis labels.

TYPE: str DEFAULT: 'Time (s)'

label_measured

Legend labels.

TYPE: str DEFAULT: 'Measured'

label_fitted

Legend labels.

TYPE: str DEFAULT: 'Measured'

ax

Axes to plot on.

TYPE: Axes DEFAULT: None

figsize

Figure size if creating new figure.

TYPE: tuple DEFAULT: (10, 6)

RETURNS DESCRIPTION
Axes

The axes with the plot.

plot_aif

plot_aif(
    aif,
    time=None,
    population_aif=None,
    title="Arterial Input Function",
    xlabel="Time (s)",
    ylabel="Concentration (mM)",
    ax=None,
    figsize=(10, 6),
)

Plot arterial input function.

PARAMETER DESCRIPTION
aif

AIF to plot (or measured AIF array if using time parameter).

TYPE: ArterialInputFunction or NDArray

time

Time points (required if aif is an array).

TYPE: NDArray DEFAULT: None

population_aif

Population-based AIF to compare.

TYPE: NDArray DEFAULT: None

title

Plot title.

TYPE: str DEFAULT: 'Arterial Input Function'

xlabel

Axis labels.

TYPE: str DEFAULT: 'Time (s)'

ylabel

Axis labels.

TYPE: str DEFAULT: 'Time (s)'

ax

Axes to plot on.

TYPE: Axes DEFAULT: None

figsize

Figure size.

TYPE: tuple DEFAULT: (10, 6)

RETURNS DESCRIPTION
Figure or Axes

The figure or axes with the plot.

plot_residue_function

plot_residue_function(
    time,
    residue,
    title="Residue Function",
    xlabel="Time (s)",
    ylabel="R(t)",
    show_mtt=True,
    show_oscillation_warning=False,
    ax=None,
    figsize=(10, 6),
)

Plot residue function from deconvolution.

PARAMETER DESCRIPTION
time

Time points.

TYPE: NDArray

residue

Residue function values.

TYPE: NDArray

title

Plot title.

TYPE: str DEFAULT: 'Residue Function'

xlabel

Axis labels.

TYPE: str DEFAULT: 'Time (s)'

ylabel

Axis labels.

TYPE: str DEFAULT: 'Time (s)'

show_mtt

Whether to mark MTT on the plot.

TYPE: bool DEFAULT: True

show_oscillation_warning

Whether to check and warn about oscillations.

TYPE: bool DEFAULT: False

ax

Axes to plot on.

TYPE: Axes DEFAULT: None

figsize

Figure size.

TYPE: tuple DEFAULT: (10, 6)

RETURNS DESCRIPTION
Figure or Axes

The figure or axes with the plot.

plot_multi_curves

plot_multi_curves(
    time,
    curves,
    labels=None,
    colors=None,
    title="Time Courses",
    xlabel="Time (s)",
    ylabel="Signal",
    ax=None,
    figsize=(10, 6),
)

Plot multiple time courses on the same axes.

PARAMETER DESCRIPTION
time

Time points.

TYPE: NDArray

curves

List of time courses to plot.

TYPE: list[NDArray]

labels

Labels for each curve.

TYPE: list[str] DEFAULT: None

colors

Colors for each curve.

TYPE: list[str] DEFAULT: None

title

Plot title.

TYPE: str DEFAULT: 'Time Courses'

xlabel

Axis labels.

TYPE: str DEFAULT: 'Time (s)'

ylabel

Axis labels.

TYPE: str DEFAULT: 'Time (s)'

ax

Axes to plot on.

TYPE: Axes DEFAULT: None

figsize

Figure size.

TYPE: tuple DEFAULT: (10, 6)

RETURNS DESCRIPTION
Axes

The axes with the plot.