The Parker AIF - a play with variables

Note

Click here to download the full example code

====================================== The Parker AIF - a play with variables ======================================

Simulating a Parker AIF with different settings.

import matplotlib.pyplot as plt

Import necessary packages

import numpy as np
import osipi

Generate synthetic AIF with default settings and plot the result.

# Define time points in units of seconds - in this case we use a time
# resolution of 0.5 sec and a total duration of 6 minutes.
t = np.arange(0, 6 * 60, 0.5)

# Create an AIF with default settings
ca = osipi.aif_parker(t)

# Plot the AIF over the full range
plt.plot(t, ca, "r-")
plt.plot(t, 0 * t, "k-")
plt.xlabel("Time (sec)")
plt.ylabel("Plasma concentration (mM)")
plt.show()

plot aif parker

The bolus arrival time (BAT) defaults to 0s. What happens if we change it? Let's try, by changing it in steps of 30s:

ca = osipi.aif_parker(t, BAT=0)
plt.plot(t, ca, "b-", label="BAT = 0s")
ca = osipi.aif_parker(t, BAT=30)
plt.plot(t, ca, "r-", label="BAT = 30s")
ca = osipi.aif_parker(t, BAT=60)
plt.plot(t, ca, "g-", label="BAT = 60s")
ca = osipi.aif_parker(t, BAT=90)
plt.plot(t, ca, "m-", label="BAT = 90s")
plt.xlabel("Time (sec)")
plt.ylabel("Plasma concentration (mM)")
plt.legend()
plt.show()

# Choose the last image as a thumbnail for the gallery
# sphinx_gallery_thumbnail_number = -1

plot aif parker

Total running time of the script: ( 0 minutes 0.188 seconds)

Download Python source code: plot_aif_parker.py

Download Jupyter notebook: plot_aif_parker.ipynb

Gallery generated by mkdocs-gallery