Skip to content

Commit

Permalink
deploy: 16fcd90
Browse files Browse the repository at this point in the history
  • Loading branch information
ltorres6 committed Mar 28, 2024
0 parents commit fbbdb23
Show file tree
Hide file tree
Showing 189 changed files with 38,868 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .buildinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 9417a2e8125c6bb90d935aa69e428f2b
tags: 645f666f9bcd5a90fca523b33c5a78b7
Empty file added .nojekyll
Empty file.
48 changes: 48 additions & 0 deletions _downloads/13d29bba0b7f4883cb92cda379ddc864/plot_dummy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
"""
==============
A dummy script
==============
Dummy script to illustrate structure of examples folder
"""

# %%
# Import necessary packages
import numpy as np
import matplotlib.pyplot as plt
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()

# %%
# The bolus arrival time (BAT) defaults to 30s. 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
48 changes: 48 additions & 0 deletions _downloads/6794ff0fe2ebfd1be519862fb198ceb5/plot_aif_parker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
"""
======================================
The Parker AIF - a play with variables
======================================
Simulating a Parker AIF with different settings.
"""

# %%
# Import necessary packages
import numpy as np
import matplotlib.pyplot as plt
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()

# %%
# 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
53 changes: 53 additions & 0 deletions _downloads/7aabdb582807b10ab82e2dcfaa256c12/plot_extended_tofts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
"""
====================
The Extended Tofts model
====================
Simulating tissue concentrations from extended Tofts model with different settings.
"""

# %%
# Import necessary packages
import numpy as np
import matplotlib.pyplot as plt
import osipi

# %%
# Generate Parker AIF with default settings.

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

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

# %%
# Plot the tissue concentrations for an extracellular volume fraction of 0.2 and 3 different plasma volumes of 0.05, 0.2 and 0.6
Ktrans = 0.2 # in units of 1/min
ve = 0.2 # volume fraction between 0 and 1
vp = [0.05, 0.2, 0.6] # volume fraction between 0 and 1
ct = osipi.extended_tofts(t, ca, Ktrans, ve, vp[0])
plt.plot(t, ct, 'b-', label=f'vp = {vp[0]}')
ct = osipi.extended_tofts(t, ca, Ktrans, ve, vp[1])
plt.plot(t, ct, 'g-', label=f'vp = {vp[1]}')
ct = osipi.extended_tofts(t, ca, Ktrans, ve, vp[2])
plt.plot(t, ct, 'm-', label=f'vp = {vp[2]}')
plt.xlabel('Time (sec)')
plt.ylabel('Tissue concentration (mM)')
plt.legend()
plt.show()

# %%
# Comparing different discretization methods for an extracellular volume fraction of 0.2, Ktrans of 0.2 /min and vp of 0.05
ct = osipi.extended_tofts(t, ca, Ktrans, ve, vp[0]) # Defaults to Convolution
plt.plot(t, ct, 'b-', label='Convolution')
ct = osipi.extended_tofts(t, ca, Ktrans, ve, vp[0], discretization_method='exp')
plt.plot(t, ct, 'g-', label='Exponential Convolution')
plt.title(f'Ktrans = {Ktrans} /min')
plt.xlabel('Time (sec)')
plt.ylabel('Tissue concentration (mM)')
plt.legend()
plt.show()

# Choose the last image as a thumbnail for the gallery
# sphinx_gallery_thumbnail_number = -1
86 changes: 86 additions & 0 deletions _downloads/9dd8307460a64f1314f28e1650ea27b2/plot_aif_parker.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n# The Parker AIF - a play with variables\n\nSimulating a Parker AIF with different settings. \n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Import necessary packages\n\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import numpy as np\nimport matplotlib.pyplot as plt\nimport osipi"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Generate synthetic AIF with default settings and plot the result.\n\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"# 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.\nt = np.arange(0, 6*60, 0.5)\n\n# Create an AIF with default settings\nca = osipi.aif_parker(t)\n\n# Plot the AIF over the full range\nplt.plot(t, ca, 'r-')\nplt.plot(t, 0*t, 'k-')\nplt.xlabel('Time (sec)')\nplt.ylabel('Plasma concentration (mM)')\nplt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The bolus arrival time (BAT) defaults to 0s. What happens if we change it? Let's try, by changing it in steps of 30s:\n\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"ca = osipi.aif_parker(t, BAT=0)\nplt.plot(t, ca, 'b-', label='BAT = 0s')\nca = osipi.aif_parker(t, BAT=30)\nplt.plot(t, ca, 'r-', label='BAT = 30s')\nca = osipi.aif_parker(t, BAT=60)\nplt.plot(t, ca, 'g-', label='BAT = 60s')\nca = osipi.aif_parker(t, BAT=90)\nplt.plot(t, ca, 'm-', label='BAT = 90s')\nplt.xlabel('Time (sec)')\nplt.ylabel('Plasma concentration (mM)')\nplt.legend()\nplt.show()\n\n# Choose the last image as a thumbnail for the gallery\n# sphinx_gallery_thumbnail_number = -1"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.16"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
52 changes: 52 additions & 0 deletions _downloads/a33e2b5538ac861c3439d2b7ac57fc73/plot_tofts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
"""
====================
The Tofts model
====================
Simulating tissue concentrations from Tofts model with different settings.
"""

# %%
# Import necessary packages
import numpy as np
import matplotlib.pyplot as plt
import osipi

# %%
# Generate Parker AIF with default settings.

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

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

# %%
# Plot the tissue concentrations for an extracellular volume fraction of 0.2 and 3 different transfer rate constants of 0.05, 0.2 and 0.6 /min
Ktrans = [0.05, 0.2, 0.6] # in units of 1/min
ve = 0.2 # volume fraction between 0 and 1
ct = osipi.tofts(t, ca, Ktrans=Ktrans[0], ve=ve)
plt.plot(t, ct, 'b-', label=f'Ktrans = {Ktrans[0]} /min')
ct = osipi.tofts(t, ca, Ktrans[1], ve)
plt.plot(t, ct, 'g-', label=f'Ktrans = {Ktrans[1]} /min')
ct = osipi.tofts(t, ca, Ktrans[2], ve)
plt.plot(t, ct, 'm-', label=f'Ktrans = {Ktrans[2]} /min')
plt.xlabel('Time (sec)')
plt.ylabel('Tissue concentration (mM)')
plt.legend()
plt.show()

# %%
# Comparing different discretization methods for an extracellular volume fraction of 0.2 and Ktrans of 0.2 /min
ct = osipi.tofts(t, ca, Ktrans=Ktrans[1], ve=ve) # Defaults to Convolution
plt.plot(t, ct, 'b-', label='Convolution')
ct = osipi.tofts(t, ca, Ktrans=Ktrans[1], ve=ve, discretization_method='exp')
plt.plot(t, ct, 'g-', label='Exponential Convolution')
plt.title(f'Ktrans = {Ktrans[1]} /min')
plt.xlabel('Time (sec)')
plt.ylabel('Tissue concentration (mM)')
plt.legend()
plt.show()

# Choose the last image as a thumbnail for the gallery
# sphinx_gallery_thumbnail_number = -1
86 changes: 86 additions & 0 deletions _downloads/d7fc8c919b404352d2799a152138fb85/plot_dummy.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n# A dummy script\n\nDummy script to illustrate structure of examples folder \n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Import necessary packages\n\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import numpy as np\nimport matplotlib.pyplot as plt\nimport osipi"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Generate synthetic AIF with default settings and plot the result.\n\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"# 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.\nt = np.arange(0, 6*60, 0.5)\n\n# Create an AIF with default settings\nca = osipi.aif_parker(t)\n\n# Plot the AIF over the full range\nplt.plot(t, ca, 'r-')\nplt.plot(t, 0*t, 'k-')\nplt.xlabel('Time (sec)')\nplt.ylabel('Plasma concentration (mM)')\nplt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The bolus arrival time (BAT) defaults to 30s. What happens if we change it? Let's try, by changing it in steps of 30s:\n\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"ca = osipi.aif_parker(t, BAT=0)\nplt.plot(t, ca, 'b-', label='BAT = 0s')\nca = osipi.aif_parker(t, BAT=30)\nplt.plot(t, ca, 'r-', label='BAT = 30s')\nca = osipi.aif_parker(t, BAT=60)\nplt.plot(t, ca, 'g-', label='BAT = 60s')\nca = osipi.aif_parker(t, BAT=90)\nplt.plot(t, ca, 'm-', label='BAT = 90s')\nplt.xlabel('Time (sec)')\nplt.ylabel('Plasma concentration (mM)')\nplt.legend()\nplt.show()\n\n# Choose the last image as a thumbnail for the gallery\n# sphinx_gallery_thumbnail_number = -1"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.16"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Loading

0 comments on commit fbbdb23

Please sign in to comment.