diff --git a/docs/source/generated/backreferences/osipi.aif_parker.examples b/docs/source/generated/backreferences/osipi.aif_parker.examples index 099b5ed..19ff462 100755 --- a/docs/source/generated/backreferences/osipi.aif_parker.examples +++ b/docs/source/generated/backreferences/osipi.aif_parker.examples @@ -11,6 +11,70 @@ Examples using ``osipi.aif_parker``
+.. thumbnail-parent-div-open + +.. raw:: html + +
+ +.. only:: html + + .. image:: /generated/examples/aif/images/thumb/sphx_glr_plot_aif_parker_thumb.png + :alt: + + :ref:`sphx_glr_generated_examples_aif_plot_aif_parker.py` + +.. raw:: html + +
The Parker AIF - a play with variables
+
+ + +.. only:: not html + + * :ref:`sphx_glr_generated_examples_aif_plot_aif_parker.py` + +.. raw:: html + +
+ +.. only:: html + + .. image:: /generated/examples/aif/images/thumb/sphx_glr_plot_dummy_thumb.png + :alt: + + :ref:`sphx_glr_generated_examples_aif_plot_dummy.py` + +.. raw:: html + +
A dummy script
+
+ + +.. only:: not html + + * :ref:`sphx_glr_generated_examples_aif_plot_dummy.py` + +.. raw:: html + +
+ +.. only:: html + + .. image:: /generated/examples/tissue/images/thumb/sphx_glr_plot_tofts_thumb.png + :alt: + + :ref:`sphx_glr_generated_examples_tissue_plot_tofts.py` + +.. raw:: html + +
The Tofts model
+
+ + +.. only:: not html + + * :ref:`sphx_glr_generated_examples_tissue_plot_tofts.py` .. raw:: html @@ -33,6 +97,8 @@ Examples using ``osipi.aif_parker`` * :ref:`sphx_glr_generated_examples_tissue_plot_extended_tofts.py` +.. thumbnail-parent-div-close + .. raw:: html
diff --git a/docs/source/generated/backreferences/osipi.extended_tofts.examples b/docs/source/generated/backreferences/osipi.extended_tofts.examples index fab4186..945a7bb 100755 --- a/docs/source/generated/backreferences/osipi.extended_tofts.examples +++ b/docs/source/generated/backreferences/osipi.extended_tofts.examples @@ -11,6 +11,7 @@ Examples using ``osipi.extended_tofts``
+.. thumbnail-parent-div-open .. raw:: html @@ -33,6 +34,8 @@ Examples using ``osipi.extended_tofts`` * :ref:`sphx_glr_generated_examples_tissue_plot_extended_tofts.py` +.. thumbnail-parent-div-close + .. raw:: html
diff --git a/docs/source/generated/backreferences/osipi.tofts.examples b/docs/source/generated/backreferences/osipi.tofts.examples index 8157cbb..78bbfe4 100755 --- a/docs/source/generated/backreferences/osipi.tofts.examples +++ b/docs/source/generated/backreferences/osipi.tofts.examples @@ -11,6 +11,7 @@ Examples using ``osipi.tofts``
+.. thumbnail-parent-div-open .. raw:: html @@ -33,6 +34,8 @@ Examples using ``osipi.tofts`` * :ref:`sphx_glr_generated_examples_tissue_plot_tofts.py` +.. thumbnail-parent-div-close + .. raw:: html
diff --git a/docs/source/generated/examples/aif/images/sphx_glr_plot_aif_parker_001.png b/docs/source/generated/examples/aif/images/sphx_glr_plot_aif_parker_001.png index ebf46b3..b08ebc8 100755 Binary files a/docs/source/generated/examples/aif/images/sphx_glr_plot_aif_parker_001.png and b/docs/source/generated/examples/aif/images/sphx_glr_plot_aif_parker_001.png differ diff --git a/docs/source/generated/examples/aif/images/sphx_glr_plot_aif_parker_002.png b/docs/source/generated/examples/aif/images/sphx_glr_plot_aif_parker_002.png index 90f32a6..326d195 100755 Binary files a/docs/source/generated/examples/aif/images/sphx_glr_plot_aif_parker_002.png and b/docs/source/generated/examples/aif/images/sphx_glr_plot_aif_parker_002.png differ diff --git a/docs/source/generated/examples/aif/images/sphx_glr_plot_dummy_001.png b/docs/source/generated/examples/aif/images/sphx_glr_plot_dummy_001.png index ebf46b3..b08ebc8 100755 Binary files a/docs/source/generated/examples/aif/images/sphx_glr_plot_dummy_001.png and b/docs/source/generated/examples/aif/images/sphx_glr_plot_dummy_001.png differ diff --git a/docs/source/generated/examples/aif/images/sphx_glr_plot_dummy_002.png b/docs/source/generated/examples/aif/images/sphx_glr_plot_dummy_002.png index 90f32a6..326d195 100755 Binary files a/docs/source/generated/examples/aif/images/sphx_glr_plot_dummy_002.png and b/docs/source/generated/examples/aif/images/sphx_glr_plot_dummy_002.png differ diff --git a/docs/source/generated/examples/aif/images/thumb/sphx_glr_plot_aif_parker_thumb.png b/docs/source/generated/examples/aif/images/thumb/sphx_glr_plot_aif_parker_thumb.png index 5fb3446..22d8ed5 100755 Binary files a/docs/source/generated/examples/aif/images/thumb/sphx_glr_plot_aif_parker_thumb.png and b/docs/source/generated/examples/aif/images/thumb/sphx_glr_plot_aif_parker_thumb.png differ diff --git a/docs/source/generated/examples/aif/images/thumb/sphx_glr_plot_dummy_thumb.png b/docs/source/generated/examples/aif/images/thumb/sphx_glr_plot_dummy_thumb.png index 5fb3446..22d8ed5 100755 Binary files a/docs/source/generated/examples/aif/images/thumb/sphx_glr_plot_dummy_thumb.png and b/docs/source/generated/examples/aif/images/thumb/sphx_glr_plot_dummy_thumb.png differ diff --git a/docs/source/generated/examples/aif/index.rst b/docs/source/generated/examples/aif/index.rst index d9ec3b3..c83c965 100755 --- a/docs/source/generated/examples/aif/index.rst +++ b/docs/source/generated/examples/aif/index.rst @@ -8,16 +8,15 @@ Arterial Input Functions - - .. raw:: html
+.. thumbnail-parent-div-open .. raw:: html -
+
.. only:: html @@ -34,7 +33,7 @@ Arterial Input Functions .. raw:: html -
+
.. only:: html @@ -49,6 +48,8 @@ Arterial Input Functions
+.. thumbnail-parent-div-close + .. raw:: html
diff --git a/docs/source/generated/examples/aif/plot_aif_parker.ipynb b/docs/source/generated/examples/aif/plot_aif_parker.ipynb index f0452bc..3276336 100755 --- a/docs/source/generated/examples/aif/plot_aif_parker.ipynb +++ b/docs/source/generated/examples/aif/plot_aif_parker.ipynb @@ -1,113 +1,97 @@ { - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "\n# The Parker AIF - a play with variables\n\nSimulating a Parker AIF with different settings. \n" - ] + "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": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "import matplotlib.pyplot as plt" + ] + }, + { + "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 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\n# 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\nchange 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.10.8" + } }, - { - "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\n", - "import matplotlib.pyplot as plt\n", - "import 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.\n", - "t = np.arange(0, 6 * 60, 0.5)\n", - "\n", - "# Create an AIF with default settings\n", - "ca = osipi.aif_parker(t)\n", - "\n", - "# Plot the AIF over the full range\n", - "plt.plot(t, ca, \"r-\")\n", - "plt.plot(t, 0 * t, \"k-\")\n", - "plt.xlabel(\"Time (sec)\")\n", - "plt.ylabel(\"Plasma concentration (mM)\")\n", - "plt.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)\n", - "plt.plot(t, ca, \"b-\", label=\"BAT = 0s\")\n", - "ca = osipi.aif_parker(t, BAT=30)\n", - "plt.plot(t, ca, \"r-\", label=\"BAT = 30s\")\n", - "ca = osipi.aif_parker(t, BAT=60)\n", - "plt.plot(t, ca, \"g-\", label=\"BAT = 60s\")\n", - "ca = osipi.aif_parker(t, BAT=90)\n", - "plt.plot(t, ca, \"m-\", label=\"BAT = 90s\")\n", - "plt.xlabel(\"Time (sec)\")\n", - "plt.ylabel(\"Plasma concentration (mM)\")\n", - "plt.legend()\n", - "plt.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 + "nbformat": 4, + "nbformat_minor": 0 } diff --git a/docs/source/generated/examples/aif/plot_aif_parker.py b/docs/source/generated/examples/aif/plot_aif_parker.py index 4338078..374cbce 100755 --- a/docs/source/generated/examples/aif/plot_aif_parker.py +++ b/docs/source/generated/examples/aif/plot_aif_parker.py @@ -1,7 +1,9 @@ -"""====================================== +""" +====================================== +The Parker AIF - a play with variables +====================================== -The Parker AIF - a play with variables ====================================== Simulating a Parker -AIF with different settings. +Simulating a Parker AIF with different settings. """ diff --git a/docs/source/generated/examples/aif/plot_aif_parker.py.md5 b/docs/source/generated/examples/aif/plot_aif_parker.py.md5 index 38d4e11..3b68fca 100755 --- a/docs/source/generated/examples/aif/plot_aif_parker.py.md5 +++ b/docs/source/generated/examples/aif/plot_aif_parker.py.md5 @@ -1 +1 @@ -2ad42a0f8a1b8aa8ec46f9a5f66e86e4 +e93d51ea52bd242140d5fb616a34364e diff --git a/docs/source/generated/examples/aif/plot_aif_parker.rst b/docs/source/generated/examples/aif/plot_aif_parker.rst index f862c5c..f5df0a9 100755 --- a/docs/source/generated/examples/aif/plot_aif_parker.rst +++ b/docs/source/generated/examples/aif/plot_aif_parker.rst @@ -2,7 +2,7 @@ .. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: -.. "generated/examples/aif/plot_aif_parker.py" +.. "generated\examples\aif\plot_aif_parker.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html @@ -11,7 +11,7 @@ :class: sphx-glr-download-link-note :ref:`Go to the end ` - to download the full example code + to download the full example code. .. rst-class:: sphx-glr-example-title @@ -24,16 +24,29 @@ The Parker AIF - a play with variables Simulating a Parker AIF with different settings. -.. GENERATED FROM PYTHON SOURCE LINES 10-11 +.. GENERATED FROM PYTHON SOURCE LINES 9-12 + +.. code-block:: Python + + + import matplotlib.pyplot as plt + + + + + + + + +.. GENERATED FROM PYTHON SOURCE LINES 13-14 Import necessary packages -.. GENERATED FROM PYTHON SOURCE LINES 11-15 +.. GENERATED FROM PYTHON SOURCE LINES 14-17 -.. code-block:: default +.. code-block:: Python import numpy as np - import matplotlib.pyplot as plt import osipi @@ -43,26 +56,27 @@ Import necessary packages -.. GENERATED FROM PYTHON SOURCE LINES 16-17 +.. GENERATED FROM PYTHON SOURCE LINES 18-19 Generate synthetic AIF with default settings and plot the result. -.. GENERATED FROM PYTHON SOURCE LINES 17-31 +.. GENERATED FROM PYTHON SOURCE LINES 19-34 -.. code-block:: default +.. code-block:: Python - # 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) + # 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.plot(t, ca, "r-") + plt.plot(t, 0 * t, "k-") + plt.xlabel("Time (sec)") + plt.ylabel("Plasma concentration (mM)") plt.show() @@ -77,25 +91,26 @@ Generate synthetic AIF with default settings and plot the result. -.. GENERATED FROM PYTHON SOURCE LINES 32-33 +.. GENERATED FROM PYTHON SOURCE LINES 35-37 -The bolus arrival time (BAT) defaults to 0s. What happens if we change it? Let's try, by changing it in steps of 30s: +The bolus arrival time (BAT) defaults to 0s. What happens if we +change it? Let's try, by changing it in steps of 30s: -.. GENERATED FROM PYTHON SOURCE LINES 33-49 +.. GENERATED FROM PYTHON SOURCE LINES 37-53 -.. code-block:: default +.. code-block:: Python ca = osipi.aif_parker(t, BAT=0) - plt.plot(t, ca, 'b-', label='BAT = 0s') + plt.plot(t, ca, "b-", label="BAT = 0s") ca = osipi.aif_parker(t, BAT=30) - plt.plot(t, ca, 'r-', label='BAT = 30s') + plt.plot(t, ca, "r-", label="BAT = 30s") ca = osipi.aif_parker(t, BAT=60) - plt.plot(t, ca, 'g-', label='BAT = 60s') + 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.plot(t, ca, "m-", label="BAT = 90s") + plt.xlabel("Time (sec)") + plt.ylabel("Plasma concentration (mM)") plt.legend() plt.show() @@ -116,7 +131,7 @@ The bolus arrival time (BAT) defaults to 0s. What happens if we change it? Let's .. rst-class:: sphx-glr-timing - **Total running time of the script:** (0 minutes 0.110 seconds) + **Total running time of the script:** (0 minutes 0.183 seconds) .. _sphx_glr_download_generated_examples_aif_plot_aif_parker.py: @@ -125,17 +140,14 @@ The bolus arrival time (BAT) defaults to 0s. What happens if we change it? Let's .. container:: sphx-glr-footer sphx-glr-footer-example + .. container:: sphx-glr-download sphx-glr-download-jupyter - + :download:`Download Jupyter notebook: plot_aif_parker.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_aif_parker.py ` - .. container:: sphx-glr-download sphx-glr-download-jupyter - - :download:`Download Jupyter notebook: plot_aif_parker.ipynb ` - .. only:: html diff --git a/docs/source/generated/examples/aif/plot_aif_parker_codeobj.pickle b/docs/source/generated/examples/aif/plot_aif_parker_codeobj.pickle index 7f1df19..51b6d51 100755 Binary files a/docs/source/generated/examples/aif/plot_aif_parker_codeobj.pickle and b/docs/source/generated/examples/aif/plot_aif_parker_codeobj.pickle differ diff --git a/docs/source/generated/examples/aif/plot_dummy.ipynb b/docs/source/generated/examples/aif/plot_dummy.ipynb index 7da2ef2..2565681 100755 --- a/docs/source/generated/examples/aif/plot_dummy.ipynb +++ b/docs/source/generated/examples/aif/plot_dummy.ipynb @@ -1,113 +1,97 @@ { - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "\n# A dummy script\n\nDummy script to illustrate structure of examples folder \n" - ] + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\n# A dummy script\n\nDummy script to illustrate structure of examples folder\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "import matplotlib.pyplot as plt" + ] + }, + { + "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 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\n# 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\nchange 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.10.8" + } }, - { - "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\n", - "import matplotlib.pyplot as plt\n", - "import 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.\n", - "t = np.arange(0, 6 * 60, 0.5)\n", - "\n", - "# Create an AIF with default settings\n", - "ca = osipi.aif_parker(t)\n", - "\n", - "# Plot the AIF over the full range\n", - "plt.plot(t, ca, \"r-\")\n", - "plt.plot(t, 0 * t, \"k-\")\n", - "plt.xlabel(\"Time (sec)\")\n", - "plt.ylabel(\"Plasma concentration (mM)\")\n", - "plt.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)\n", - "plt.plot(t, ca, \"b-\", label=\"BAT = 0s\")\n", - "ca = osipi.aif_parker(t, BAT=30)\n", - "plt.plot(t, ca, \"r-\", label=\"BAT = 30s\")\n", - "ca = osipi.aif_parker(t, BAT=60)\n", - "plt.plot(t, ca, \"g-\", label=\"BAT = 60s\")\n", - "ca = osipi.aif_parker(t, BAT=90)\n", - "plt.plot(t, ca, \"m-\", label=\"BAT = 90s\")\n", - "plt.xlabel(\"Time (sec)\")\n", - "plt.ylabel(\"Plasma concentration (mM)\")\n", - "plt.legend()\n", - "plt.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 + "nbformat": 4, + "nbformat_minor": 0 } diff --git a/docs/source/generated/examples/aif/plot_dummy.py.md5 b/docs/source/generated/examples/aif/plot_dummy.py.md5 index 7c38a5e..481354c 100755 --- a/docs/source/generated/examples/aif/plot_dummy.py.md5 +++ b/docs/source/generated/examples/aif/plot_dummy.py.md5 @@ -1 +1 @@ -3393738ee0ad511916ee690ca9a231be +80d36b7d06c5985854776b4c11214ab1 diff --git a/docs/source/generated/examples/aif/plot_dummy.rst b/docs/source/generated/examples/aif/plot_dummy.rst index 5d43ebc..06dee68 100755 --- a/docs/source/generated/examples/aif/plot_dummy.rst +++ b/docs/source/generated/examples/aif/plot_dummy.rst @@ -2,7 +2,7 @@ .. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: -.. "generated/examples/aif/plot_dummy.py" +.. "generated\examples\aif\plot_dummy.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html @@ -11,7 +11,7 @@ :class: sphx-glr-download-link-note :ref:`Go to the end ` - to download the full example code + to download the full example code. .. rst-class:: sphx-glr-example-title @@ -24,16 +24,29 @@ A dummy script Dummy script to illustrate structure of examples folder -.. GENERATED FROM PYTHON SOURCE LINES 10-11 +.. GENERATED FROM PYTHON SOURCE LINES 8-11 + +.. code-block:: Python + + + import matplotlib.pyplot as plt + + + + + + + + +.. GENERATED FROM PYTHON SOURCE LINES 12-13 Import necessary packages -.. GENERATED FROM PYTHON SOURCE LINES 11-15 +.. GENERATED FROM PYTHON SOURCE LINES 13-16 -.. code-block:: default +.. code-block:: Python import numpy as np - import matplotlib.pyplot as plt import osipi @@ -43,26 +56,27 @@ Import necessary packages -.. GENERATED FROM PYTHON SOURCE LINES 16-17 +.. GENERATED FROM PYTHON SOURCE LINES 17-18 Generate synthetic AIF with default settings and plot the result. -.. GENERATED FROM PYTHON SOURCE LINES 17-31 +.. GENERATED FROM PYTHON SOURCE LINES 18-33 -.. code-block:: default +.. code-block:: Python - # 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) + # 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.plot(t, ca, "r-") + plt.plot(t, 0 * t, "k-") + plt.xlabel("Time (sec)") + plt.ylabel("Plasma concentration (mM)") plt.show() @@ -77,25 +91,26 @@ Generate synthetic AIF with default settings and plot the result. -.. GENERATED FROM PYTHON SOURCE LINES 32-33 +.. GENERATED FROM PYTHON SOURCE LINES 34-36 -The bolus arrival time (BAT) defaults to 30s. What happens if we change it? Let's try, by changing it in steps of 30s: +The bolus arrival time (BAT) defaults to 30s. What happens if we +change it? Let's try, by changing it in steps of 30s: -.. GENERATED FROM PYTHON SOURCE LINES 33-49 +.. GENERATED FROM PYTHON SOURCE LINES 36-52 -.. code-block:: default +.. code-block:: Python ca = osipi.aif_parker(t, BAT=0) - plt.plot(t, ca, 'b-', label='BAT = 0s') + plt.plot(t, ca, "b-", label="BAT = 0s") ca = osipi.aif_parker(t, BAT=30) - plt.plot(t, ca, 'r-', label='BAT = 30s') + plt.plot(t, ca, "r-", label="BAT = 30s") ca = osipi.aif_parker(t, BAT=60) - plt.plot(t, ca, 'g-', label='BAT = 60s') + 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.plot(t, ca, "m-", label="BAT = 90s") + plt.xlabel("Time (sec)") + plt.ylabel("Plasma concentration (mM)") plt.legend() plt.show() @@ -116,7 +131,7 @@ The bolus arrival time (BAT) defaults to 30s. What happens if we change it? Let' .. rst-class:: sphx-glr-timing - **Total running time of the script:** (0 minutes 0.078 seconds) + **Total running time of the script:** (0 minutes 0.118 seconds) .. _sphx_glr_download_generated_examples_aif_plot_dummy.py: @@ -125,17 +140,14 @@ The bolus arrival time (BAT) defaults to 30s. What happens if we change it? Let' .. container:: sphx-glr-footer sphx-glr-footer-example + .. container:: sphx-glr-download sphx-glr-download-jupyter - + :download:`Download Jupyter notebook: plot_dummy.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_dummy.py ` - .. container:: sphx-glr-download sphx-glr-download-jupyter - - :download:`Download Jupyter notebook: plot_dummy.ipynb ` - .. only:: html diff --git a/docs/source/generated/examples/aif/plot_dummy_codeobj.pickle b/docs/source/generated/examples/aif/plot_dummy_codeobj.pickle index 7f1df19..51b6d51 100755 Binary files a/docs/source/generated/examples/aif/plot_dummy_codeobj.pickle and b/docs/source/generated/examples/aif/plot_dummy_codeobj.pickle differ diff --git a/docs/source/generated/examples/aif/sg_execution_times.rst b/docs/source/generated/examples/aif/sg_execution_times.rst index de64540..9b8a507 100755 --- a/docs/source/generated/examples/aif/sg_execution_times.rst +++ b/docs/source/generated/examples/aif/sg_execution_times.rst @@ -6,10 +6,35 @@ Computation times ================= -**00:00.188** total execution time for **generated_examples_aif** files: +**00:00.301** total execution time for 2 files **from generated\examples\aif**: -+------------------------------------------------------------------------------------+-----------+--------+ -| :ref:`sphx_glr_generated_examples_aif_plot_aif_parker.py` (``plot_aif_parker.py``) | 00:00.110 | 0.0 MB | -+------------------------------------------------------------------------------------+-----------+--------+ -| :ref:`sphx_glr_generated_examples_aif_plot_dummy.py` (``plot_dummy.py``) | 00:00.078 | 0.0 MB | -+------------------------------------------------------------------------------------+-----------+--------+ +.. container:: + + .. raw:: html + + + + + + + + .. list-table:: + :header-rows: 1 + :class: table table-striped sg-datatable + + * - Example + - Time + - Mem (MB) + * - :ref:`sphx_glr_generated_examples_aif_plot_aif_parker.py` (``plot_aif_parker.py``) + - 00:00.183 + - 0.0 + * - :ref:`sphx_glr_generated_examples_aif_plot_dummy.py` (``plot_dummy.py``) + - 00:00.118 + - 0.0 diff --git a/docs/source/generated/examples/index.rst b/docs/source/generated/examples/index.rst index 8172642..1f44f23 100755 --- a/docs/source/generated/examples/index.rst +++ b/docs/source/generated/examples/index.rst @@ -8,12 +8,13 @@ Illustrating common use cases of osipi. - - .. raw:: html
+.. thumbnail-parent-div-open + +.. thumbnail-parent-div-close .. raw:: html @@ -25,16 +26,15 @@ Arterial Input Functions - - .. raw:: html
+.. thumbnail-parent-div-open .. raw:: html -
+
.. only:: html @@ -51,7 +51,7 @@ Arterial Input Functions .. raw:: html -
+
.. only:: html @@ -66,6 +66,8 @@ Arterial Input Functions
+.. thumbnail-parent-div-close + .. raw:: html
@@ -76,12 +78,11 @@ Tissue concentrations - - .. raw:: html
+.. thumbnail-parent-div-open .. raw:: html @@ -117,6 +118,8 @@ Tissue concentrations
+.. thumbnail-parent-div-close + .. raw:: html
diff --git a/docs/source/generated/examples/index.rst.new b/docs/source/generated/examples/index.rst.new deleted file mode 100644 index 031e6a8..0000000 --- a/docs/source/generated/examples/index.rst.new +++ /dev/null @@ -1,23 +0,0 @@ - - -.. _sphx_glr_generated_examples: - -######## -Examples -######## - -Illustrating common use cases of osipi. - - - -.. raw:: html - -
- -.. thumbnail-parent-div-open - -.. thumbnail-parent-div-close - -.. raw:: html - -
diff --git a/docs/source/generated/examples/tissue/images/sphx_glr_plot_extended_tofts_001.png b/docs/source/generated/examples/tissue/images/sphx_glr_plot_extended_tofts_001.png index 7946b14..d1fd592 100755 Binary files a/docs/source/generated/examples/tissue/images/sphx_glr_plot_extended_tofts_001.png and b/docs/source/generated/examples/tissue/images/sphx_glr_plot_extended_tofts_001.png differ diff --git a/docs/source/generated/examples/tissue/images/sphx_glr_plot_extended_tofts_002.png b/docs/source/generated/examples/tissue/images/sphx_glr_plot_extended_tofts_002.png index f3cf070..579b30a 100755 Binary files a/docs/source/generated/examples/tissue/images/sphx_glr_plot_extended_tofts_002.png and b/docs/source/generated/examples/tissue/images/sphx_glr_plot_extended_tofts_002.png differ diff --git a/docs/source/generated/examples/tissue/images/sphx_glr_plot_tofts_001.png b/docs/source/generated/examples/tissue/images/sphx_glr_plot_tofts_001.png index ba5f383..7ef6265 100755 Binary files a/docs/source/generated/examples/tissue/images/sphx_glr_plot_tofts_001.png and b/docs/source/generated/examples/tissue/images/sphx_glr_plot_tofts_001.png differ diff --git a/docs/source/generated/examples/tissue/images/sphx_glr_plot_tofts_002.png b/docs/source/generated/examples/tissue/images/sphx_glr_plot_tofts_002.png index 49b1ccd..0276780 100755 Binary files a/docs/source/generated/examples/tissue/images/sphx_glr_plot_tofts_002.png and b/docs/source/generated/examples/tissue/images/sphx_glr_plot_tofts_002.png differ diff --git a/docs/source/generated/examples/tissue/images/thumb/sphx_glr_plot_tofts_thumb.png b/docs/source/generated/examples/tissue/images/thumb/sphx_glr_plot_tofts_thumb.png index 6aaabaa..bd0ec5f 100755 Binary files a/docs/source/generated/examples/tissue/images/thumb/sphx_glr_plot_tofts_thumb.png and b/docs/source/generated/examples/tissue/images/thumb/sphx_glr_plot_tofts_thumb.png differ diff --git a/docs/source/generated/examples/tissue/index.rst b/docs/source/generated/examples/tissue/index.rst index a1b6f62..f2e344d 100755 --- a/docs/source/generated/examples/tissue/index.rst +++ b/docs/source/generated/examples/tissue/index.rst @@ -8,12 +8,11 @@ Tissue concentrations - - .. raw:: html
+.. thumbnail-parent-div-open .. raw:: html @@ -49,6 +48,8 @@ Tissue concentrations
+.. thumbnail-parent-div-close + .. raw:: html
diff --git a/docs/source/generated/examples/tissue/plot_extended_tofts.ipynb b/docs/source/generated/examples/tissue/plot_extended_tofts.ipynb index 52b04cd..b4d9c3c 100755 --- a/docs/source/generated/examples/tissue/plot_extended_tofts.ipynb +++ b/docs/source/generated/examples/tissue/plot_extended_tofts.ipynb @@ -1,133 +1,115 @@ { - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "\n# The Extended Tofts model\n\nSimulating tissue concentrations from extended Tofts model with different settings.\n" - ] + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\n# The Extended Tofts model\n\nSimulating tissue concentrations from extended Tofts model with different settings.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "import matplotlib.pyplot as plt" + ] + }, + { + "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 osipi" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Generate Parker AIF with default settings.\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\n# resolution of 1 sec and a total duration of 6 minutes.\nt = np.arange(0, 6 * 60, 1)\n\n# Create an AIF with default settings\nca = osipi.aif_parker(t)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Plot the tissue concentrations for an extracellular volume fraction\nof 0.2 and 3 different plasma volumes of 0.05, 0.2 and 0.6\n\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "Ktrans = 0.2 # in units of 1/min\nve = 0.2 # volume fraction between 0 and 1\nvp = [0.05, 0.2, 0.6] # volume fraction between 0 and 1\nct = osipi.extended_tofts(t, ca, Ktrans, ve, vp[0])\nplt.plot(t, ct, \"b-\", label=f\"vp = {vp[0]}\")\nct = osipi.extended_tofts(t, ca, Ktrans, ve, vp[1])\nplt.plot(t, ct, \"g-\", label=f\"vp = {vp[1]}\")\nct = osipi.extended_tofts(t, ca, Ktrans, ve, vp[2])\nplt.plot(t, ct, \"m-\", label=f\"vp = {vp[2]}\")\nplt.xlabel(\"Time (sec)\")\nplt.ylabel(\"Tissue concentration (mM)\")\nplt.legend()\nplt.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Comparing different discretization methods for an extracellular\nvolume fraction of 0.2, Ktrans of 0.2 /min and vp of 0.05\n\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "ct = osipi.extended_tofts(t, ca, Ktrans, ve, vp[0]) # Defaults to Convolution\nplt.plot(t, ct, \"b-\", label=\"Convolution\")\nct = osipi.extended_tofts(t, ca, Ktrans, ve, vp[0], discretization_method=\"exp\")\nplt.plot(t, ct, \"g-\", label=\"Exponential Convolution\")\nplt.title(f\"Ktrans = {Ktrans} /min\")\nplt.xlabel(\"Time (sec)\")\nplt.ylabel(\"Tissue 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.10.8" + } }, - { - "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\n", - "import matplotlib.pyplot as plt\n", - "import osipi" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Generate Parker AIF with default settings.\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 1 sec and a total duration of 6 minutes.\n", - "t = np.arange(0, 6 * 60, 1)\n", - "\n", - "# Create an AIF with default settings\n", - "ca = osipi.aif_parker(t)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "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\n\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": false - }, - "outputs": [], - "source": [ - "Ktrans = 0.2 # in units of 1/min\n", - "ve = 0.2 # volume fraction between 0 and 1\n", - "vp = [0.05, 0.2, 0.6] # volume fraction between 0 and 1\n", - "ct = osipi.extended_tofts(t, ca, Ktrans, ve, vp[0])\n", - "plt.plot(t, ct, \"b-\", label=f\"vp = {vp[0]}\")\n", - "ct = osipi.extended_tofts(t, ca, Ktrans, ve, vp[1])\n", - "plt.plot(t, ct, \"g-\", label=f\"vp = {vp[1]}\")\n", - "ct = osipi.extended_tofts(t, ca, Ktrans, ve, vp[2])\n", - "plt.plot(t, ct, \"m-\", label=f\"vp = {vp[2]}\")\n", - "plt.xlabel(\"Time (sec)\")\n", - "plt.ylabel(\"Tissue concentration (mM)\")\n", - "plt.legend()\n", - "plt.show()" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Comparing different discretization methods for an extracellular volume fraction of 0.2, Ktrans of 0.2 /min and vp of 0.05\n\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": false - }, - "outputs": [], - "source": [ - "ct = osipi.extended_tofts(t, ca, Ktrans, ve, vp[0]) # Defaults to Convolution\n", - "plt.plot(t, ct, \"b-\", label=\"Convolution\")\n", - "ct = osipi.extended_tofts(t, ca, Ktrans, ve, vp[0], discretization_method=\"exp\")\n", - "plt.plot(t, ct, \"g-\", label=\"Exponential Convolution\")\n", - "plt.title(f\"Ktrans = {Ktrans} /min\")\n", - "plt.xlabel(\"Time (sec)\")\n", - "plt.ylabel(\"Tissue concentration (mM)\")\n", - "plt.legend()\n", - "plt.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.11.2" - } - }, - "nbformat": 4, - "nbformat_minor": 0 + "nbformat": 4, + "nbformat_minor": 0 } diff --git a/docs/source/generated/examples/tissue/plot_extended_tofts.py.md5 b/docs/source/generated/examples/tissue/plot_extended_tofts.py.md5 index ec1a537..1e726a8 100755 --- a/docs/source/generated/examples/tissue/plot_extended_tofts.py.md5 +++ b/docs/source/generated/examples/tissue/plot_extended_tofts.py.md5 @@ -1 +1 @@ -fe125cfe0a7b9603e82149422673111f +67f6424a8ea349ea69f2a6e0993d78c7 diff --git a/docs/source/generated/examples/tissue/plot_extended_tofts.rst b/docs/source/generated/examples/tissue/plot_extended_tofts.rst index 3fc70b2..13d638f 100755 --- a/docs/source/generated/examples/tissue/plot_extended_tofts.rst +++ b/docs/source/generated/examples/tissue/plot_extended_tofts.rst @@ -2,7 +2,7 @@ .. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: -.. "generated/examples/tissue/plot_extended_tofts.py" +.. "generated\examples\tissue\plot_extended_tofts.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html @@ -11,29 +11,42 @@ :class: sphx-glr-download-link-note :ref:`Go to the end ` - to download the full example code + to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_generated_examples_tissue_plot_extended_tofts.py: -======================== +========================= The Extended Tofts model -======================== +========================= Simulating tissue concentrations from extended Tofts model with different settings. -.. GENERATED FROM PYTHON SOURCE LINES 10-11 +.. GENERATED FROM PYTHON SOURCE LINES 8-11 + +.. code-block:: Python + + + import matplotlib.pyplot as plt + + + + + + + + +.. GENERATED FROM PYTHON SOURCE LINES 12-13 Import necessary packages -.. GENERATED FROM PYTHON SOURCE LINES 11-15 +.. GENERATED FROM PYTHON SOURCE LINES 13-16 .. code-block:: Python import numpy as np - import matplotlib.pyplot as plt import osipi @@ -43,17 +56,18 @@ Import necessary packages -.. GENERATED FROM PYTHON SOURCE LINES 16-17 +.. GENERATED FROM PYTHON SOURCE LINES 17-18 Generate Parker AIF with default settings. -.. GENERATED FROM PYTHON SOURCE LINES 17-24 +.. GENERATED FROM PYTHON SOURCE LINES 18-26 .. code-block:: Python - # 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) + # 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) @@ -65,25 +79,26 @@ Generate Parker AIF with default settings. -.. GENERATED FROM PYTHON SOURCE LINES 25-26 +.. GENERATED FROM PYTHON SOURCE LINES 27-29 -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 +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 -.. GENERATED FROM PYTHON SOURCE LINES 26-40 +.. GENERATED FROM PYTHON SOURCE LINES 29-43 .. code-block:: Python - Ktrans = 0.2 # in units of 1/min + 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 + 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]}') + 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]}') + 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.plot(t, ct, "m-", label=f"vp = {vp[2]}") + plt.xlabel("Time (sec)") + plt.ylabel("Tissue concentration (mM)") plt.legend() plt.show() @@ -99,21 +114,22 @@ Plot the tissue concentrations for an extracellular volume fraction of 0.2 and 3 -.. GENERATED FROM PYTHON SOURCE LINES 41-42 +.. GENERATED FROM PYTHON SOURCE LINES 44-46 -Comparing different discretization methods for an extracellular volume fraction of 0.2, Ktrans of 0.2 /min and vp of 0.05 +Comparing different discretization methods for an extracellular +volume fraction of 0.2, Ktrans of 0.2 /min and vp of 0.05 -.. GENERATED FROM PYTHON SOURCE LINES 42-54 +.. GENERATED FROM PYTHON SOURCE LINES 46-58 .. code-block:: Python - 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)') + 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() @@ -134,7 +150,7 @@ Comparing different discretization methods for an extracellular volume fraction .. rst-class:: sphx-glr-timing - **Total running time of the script:** (0 minutes 0.113 seconds) + **Total running time of the script:** (0 minutes 0.136 seconds) .. _sphx_glr_download_generated_examples_tissue_plot_extended_tofts.py: diff --git a/docs/source/generated/examples/tissue/plot_extended_tofts_codeobj.pickle b/docs/source/generated/examples/tissue/plot_extended_tofts_codeobj.pickle index b503898..b58f99b 100755 Binary files a/docs/source/generated/examples/tissue/plot_extended_tofts_codeobj.pickle and b/docs/source/generated/examples/tissue/plot_extended_tofts_codeobj.pickle differ diff --git a/docs/source/generated/examples/tissue/plot_tofts.ipynb b/docs/source/generated/examples/tissue/plot_tofts.ipynb index 91cda66..1e137aa 100755 --- a/docs/source/generated/examples/tissue/plot_tofts.ipynb +++ b/docs/source/generated/examples/tissue/plot_tofts.ipynb @@ -1,132 +1,115 @@ { - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "\n# The Tofts model\n\nSimulating tissue concentrations from Tofts model with different settings.\n" - ] + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\n# The Tofts model\n\nSimulating tissue concentrations from Tofts model with different settings.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "import matplotlib.pyplot as plt" + ] + }, + { + "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 osipi" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Generate Parker AIF with default settings.\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\n# resolution of 1 sec and a total duration of 6 minutes.\nt = np.arange(0, 6 * 60, 1)\n\n# Create an AIF with default settings\nca = osipi.aif_parker(t)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Plot the tissue concentrations for an extracellular volume fraction\nof 0.2 and 3 different transfer rate constants of 0.05, 0.2 and 0.6\n/min\n\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "Ktrans = [0.05, 0.2, 0.6] # in units of 1/min\nve = 0.2 # volume fraction between 0 and 1\nct = osipi.tofts(t, ca, Ktrans=Ktrans[0], ve=ve)\nplt.plot(t, ct, \"b-\", label=f\"Ktrans = {Ktrans[0]} /min\")\nct = osipi.tofts(t, ca, Ktrans[1], ve)\nplt.plot(t, ct, \"g-\", label=f\"Ktrans = {Ktrans[1]} /min\")\nct = osipi.tofts(t, ca, Ktrans[2], ve)\nplt.plot(t, ct, \"m-\", label=f\"Ktrans = {Ktrans[2]} /min\")\nplt.xlabel(\"Time (sec)\")\nplt.ylabel(\"Tissue concentration (mM)\")\nplt.legend()\nplt.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Comparing different discretization methods for an extracellular\nvolume fraction of 0.2 and Ktrans of 0.2 /min\n\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "ct = osipi.tofts(t, ca, Ktrans=Ktrans[1], ve=ve) # Defaults to Convolution\nplt.plot(t, ct, \"b-\", label=\"Convolution\")\nct = osipi.tofts(t, ca, Ktrans=Ktrans[1], ve=ve, discretization_method=\"exp\")\nplt.plot(t, ct, \"g-\", label=\"Exponential Convolution\")\nplt.title(f\"Ktrans = {Ktrans[1]} /min\")\nplt.xlabel(\"Time (sec)\")\nplt.ylabel(\"Tissue 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.10.8" + } }, - { - "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\n", - "import matplotlib.pyplot as plt\n", - "import osipi" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Generate Parker AIF with default settings.\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 1 sec and a total duration of 6 minutes.\n", - "t = np.arange(0, 6 * 60, 1)\n", - "\n", - "# Create an AIF with default settings\n", - "ca = osipi.aif_parker(t)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "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\n\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": false - }, - "outputs": [], - "source": [ - "Ktrans = [0.05, 0.2, 0.6] # in units of 1/min\n", - "ve = 0.2 # volume fraction between 0 and 1\n", - "ct = osipi.tofts(t, ca, Ktrans=Ktrans[0], ve=ve)\n", - "plt.plot(t, ct, \"b-\", label=f\"Ktrans = {Ktrans[0]} /min\")\n", - "ct = osipi.tofts(t, ca, Ktrans[1], ve)\n", - "plt.plot(t, ct, \"g-\", label=f\"Ktrans = {Ktrans[1]} /min\")\n", - "ct = osipi.tofts(t, ca, Ktrans[2], ve)\n", - "plt.plot(t, ct, \"m-\", label=f\"Ktrans = {Ktrans[2]} /min\")\n", - "plt.xlabel(\"Time (sec)\")\n", - "plt.ylabel(\"Tissue concentration (mM)\")\n", - "plt.legend()\n", - "plt.show()" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Comparing different discretization methods for an extracellular volume fraction of 0.2 and Ktrans of 0.2 /min\n\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": false - }, - "outputs": [], - "source": [ - "ct = osipi.tofts(t, ca, Ktrans=Ktrans[1], ve=ve) # Defaults to Convolution\n", - "plt.plot(t, ct, \"b-\", label=\"Convolution\")\n", - "ct = osipi.tofts(t, ca, Ktrans=Ktrans[1], ve=ve, discretization_method=\"exp\")\n", - "plt.plot(t, ct, \"g-\", label=\"Exponential Convolution\")\n", - "plt.title(f\"Ktrans = {Ktrans[1]} /min\")\n", - "plt.xlabel(\"Time (sec)\")\n", - "plt.ylabel(\"Tissue concentration (mM)\")\n", - "plt.legend()\n", - "plt.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 + "nbformat": 4, + "nbformat_minor": 0 } diff --git a/docs/source/generated/examples/tissue/plot_tofts.py.md5 b/docs/source/generated/examples/tissue/plot_tofts.py.md5 index 10b2daf..2ef949a 100755 --- a/docs/source/generated/examples/tissue/plot_tofts.py.md5 +++ b/docs/source/generated/examples/tissue/plot_tofts.py.md5 @@ -1 +1 @@ -562f87655efc9f9b885f617d06bc5dba +00e98a230054047d6b50baaf857b22b3 diff --git a/docs/source/generated/examples/tissue/plot_tofts.rst b/docs/source/generated/examples/tissue/plot_tofts.rst index bd7378d..2b0b9e0 100755 --- a/docs/source/generated/examples/tissue/plot_tofts.rst +++ b/docs/source/generated/examples/tissue/plot_tofts.rst @@ -2,7 +2,7 @@ .. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: -.. "generated/examples/tissue/plot_tofts.py" +.. "generated\examples\tissue\plot_tofts.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html @@ -11,7 +11,7 @@ :class: sphx-glr-download-link-note :ref:`Go to the end ` - to download the full example code + to download the full example code. .. rst-class:: sphx-glr-example-title @@ -24,16 +24,29 @@ The Tofts model Simulating tissue concentrations from Tofts model with different settings. -.. GENERATED FROM PYTHON SOURCE LINES 10-11 +.. GENERATED FROM PYTHON SOURCE LINES 8-11 + +.. code-block:: Python + + + import matplotlib.pyplot as plt + + + + + + + + +.. GENERATED FROM PYTHON SOURCE LINES 12-13 Import necessary packages -.. GENERATED FROM PYTHON SOURCE LINES 11-15 +.. GENERATED FROM PYTHON SOURCE LINES 13-16 -.. code-block:: default +.. code-block:: Python import numpy as np - import matplotlib.pyplot as plt import osipi @@ -43,17 +56,18 @@ Import necessary packages -.. GENERATED FROM PYTHON SOURCE LINES 16-17 +.. GENERATED FROM PYTHON SOURCE LINES 17-18 Generate Parker AIF with default settings. -.. GENERATED FROM PYTHON SOURCE LINES 17-24 +.. GENERATED FROM PYTHON SOURCE LINES 18-26 -.. code-block:: default +.. code-block:: Python - # 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) + # 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) @@ -65,24 +79,26 @@ Generate Parker AIF with default settings. -.. GENERATED FROM PYTHON SOURCE LINES 25-26 +.. GENERATED FROM PYTHON SOURCE LINES 27-30 -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 +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 -.. GENERATED FROM PYTHON SOURCE LINES 26-39 +.. GENERATED FROM PYTHON SOURCE LINES 30-43 -.. code-block:: default +.. code-block:: Python 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') + 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') + 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.plot(t, ct, "m-", label=f"Ktrans = {Ktrans[2]} /min") + plt.xlabel("Time (sec)") + plt.ylabel("Tissue concentration (mM)") plt.legend() plt.show() @@ -98,21 +114,22 @@ Plot the tissue concentrations for an extracellular volume fraction of 0.2 and 3 -.. GENERATED FROM PYTHON SOURCE LINES 40-41 +.. GENERATED FROM PYTHON SOURCE LINES 44-46 -Comparing different discretization methods for an extracellular volume fraction of 0.2 and Ktrans of 0.2 /min +Comparing different discretization methods for an extracellular +volume fraction of 0.2 and Ktrans of 0.2 /min -.. GENERATED FROM PYTHON SOURCE LINES 41-53 +.. GENERATED FROM PYTHON SOURCE LINES 46-58 -.. code-block:: default +.. code-block:: Python - 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)') + 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() @@ -133,7 +150,7 @@ Comparing different discretization methods for an extracellular volume fraction .. rst-class:: sphx-glr-timing - **Total running time of the script:** (0 minutes 0.093 seconds) + **Total running time of the script:** (0 minutes 0.143 seconds) .. _sphx_glr_download_generated_examples_tissue_plot_tofts.py: @@ -142,17 +159,14 @@ Comparing different discretization methods for an extracellular volume fraction .. container:: sphx-glr-footer sphx-glr-footer-example + .. container:: sphx-glr-download sphx-glr-download-jupyter - + :download:`Download Jupyter notebook: plot_tofts.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_tofts.py ` - .. container:: sphx-glr-download sphx-glr-download-jupyter - - :download:`Download Jupyter notebook: plot_tofts.ipynb ` - .. only:: html diff --git a/docs/source/generated/examples/tissue/plot_tofts_codeobj.pickle b/docs/source/generated/examples/tissue/plot_tofts_codeobj.pickle index dfbf690..deefd59 100755 Binary files a/docs/source/generated/examples/tissue/plot_tofts_codeobj.pickle and b/docs/source/generated/examples/tissue/plot_tofts_codeobj.pickle differ diff --git a/docs/source/generated/examples/tissue/sg_execution_times.rst b/docs/source/generated/examples/tissue/sg_execution_times.rst index d653090..b41261a 100755 --- a/docs/source/generated/examples/tissue/sg_execution_times.rst +++ b/docs/source/generated/examples/tissue/sg_execution_times.rst @@ -6,7 +6,7 @@ Computation times ================= -**00:00.113** total execution time for 2 files **from generated/examples/tissue**: +**00:00.279** total execution time for 2 files **from generated\examples\tissue**: .. container:: @@ -32,9 +32,9 @@ Computation times * - Example - Time - Mem (MB) - * - :ref:`sphx_glr_generated_examples_tissue_plot_extended_tofts.py` (``plot_extended_tofts.py``) - - 00:00.113 - - 0.0 * - :ref:`sphx_glr_generated_examples_tissue_plot_tofts.py` (``plot_tofts.py``) - - 00:00.000 + - 00:00.143 + - 0.0 + * - :ref:`sphx_glr_generated_examples_tissue_plot_extended_tofts.py` (``plot_extended_tofts.py``) + - 00:00.136 - 0.0 diff --git a/docs/source/sg_execution_times.rst b/docs/source/sg_execution_times.rst index 2f4c88e..2effc0a 100755 --- a/docs/source/sg_execution_times.rst +++ b/docs/source/sg_execution_times.rst @@ -6,7 +6,7 @@ Computation times ================= -**00:00.113** total execution time for 4 files **from all galleries**: +**00:00.580** total execution time for 4 files **from all galleries**: .. container:: @@ -32,15 +32,15 @@ Computation times * - Example - Time - Mem (MB) - * - :ref:`sphx_glr_generated_examples_tissue_plot_extended_tofts.py` (``../examples/tissue/plot_extended_tofts.py``) - - 00:00.113 + * - :ref:`sphx_glr_generated_examples_aif_plot_aif_parker.py` (``..\examples\aif\plot_aif_parker.py``) + - 00:00.183 - 0.0 - * - :ref:`sphx_glr_generated_examples_aif_plot_aif_parker.py` (``../examples/aif/plot_aif_parker.py``) - - 00:00.000 + * - :ref:`sphx_glr_generated_examples_tissue_plot_tofts.py` (``..\examples\tissue\plot_tofts.py``) + - 00:00.143 - 0.0 - * - :ref:`sphx_glr_generated_examples_aif_plot_dummy.py` (``../examples/aif/plot_dummy.py``) - - 00:00.000 + * - :ref:`sphx_glr_generated_examples_tissue_plot_extended_tofts.py` (``..\examples\tissue\plot_extended_tofts.py``) + - 00:00.136 - 0.0 - * - :ref:`sphx_glr_generated_examples_tissue_plot_tofts.py` (``../examples/tissue/plot_tofts.py``) - - 00:00.000 + * - :ref:`sphx_glr_generated_examples_aif_plot_dummy.py` (``..\examples\aif\plot_dummy.py``) + - 00:00.118 - 0.0