From 9331578938e8a57a95d718fad66685e1aedc0518 Mon Sep 17 00:00:00 2001 From: Richard Brown <33289025+rijobro@users.noreply.github.com> Date: Thu, 4 Jun 2020 10:53:30 +0100 Subject: [PATCH 1/5] No need for numba fixes https://github.com/SyneRBI/SIRF-Exercises/issues/45 --- notebooks/Synergistic/BrainWeb-single_slice_motion.ipynb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/notebooks/Synergistic/BrainWeb-single_slice_motion.ipynb b/notebooks/Synergistic/BrainWeb-single_slice_motion.ipynb index a9126fe8..c9ee8fd6 100644 --- a/notebooks/Synergistic/BrainWeb-single_slice_motion.ipynb +++ b/notebooks/Synergistic/BrainWeb-single_slice_motion.ipynb @@ -60,8 +60,7 @@ "# Make sure everything is installed that we need\n", "import os\n", "sirf_python_executable = os.environ.get('SIRF_PYTHON_EXECUTABLE')\n", - "!{sirf_python_executable} -m pip install brainweb nibabel numba --user\n", - "# !pip install brainweb nibabel numba --user" + "!{sirf_python_executable} -m pip install brainweb nibabel --user\n", ] }, { From a45e419e0f60dca15f41cacb8d4b51fcbf722cc1 Mon Sep 17 00:00:00 2001 From: richard Date: Thu, 4 Jun 2020 11:01:52 +0100 Subject: [PATCH 2/5] no numba in brainweb either --- notebooks/Synergistic/BrainWeb.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebooks/Synergistic/BrainWeb.ipynb b/notebooks/Synergistic/BrainWeb.ipynb index 11703511..5d8a82d2 100644 --- a/notebooks/Synergistic/BrainWeb.ipynb +++ b/notebooks/Synergistic/BrainWeb.ipynb @@ -58,7 +58,7 @@ "outputs": [], "source": [ "# Make sure everything is installed that we need\n", - "!pip install brainweb nibabel numba --user" + "!pip install brainweb nibabel --user" ] }, { From 7c66536d660dd2d7f9ef71db66c3ab10ef52a4cb Mon Sep 17 00:00:00 2001 From: Richard Date: Thu, 4 Jun 2020 10:29:14 +0000 Subject: [PATCH 3/5] comma --- notebooks/Synergistic/BrainWeb-single_slice_motion.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebooks/Synergistic/BrainWeb-single_slice_motion.ipynb b/notebooks/Synergistic/BrainWeb-single_slice_motion.ipynb index c9ee8fd6..bbf1a09d 100644 --- a/notebooks/Synergistic/BrainWeb-single_slice_motion.ipynb +++ b/notebooks/Synergistic/BrainWeb-single_slice_motion.ipynb @@ -60,7 +60,7 @@ "# Make sure everything is installed that we need\n", "import os\n", "sirf_python_executable = os.environ.get('SIRF_PYTHON_EXECUTABLE')\n", - "!{sirf_python_executable} -m pip install brainweb nibabel --user\n", + "!{sirf_python_executable} -m pip install brainweb nibabel --user\n" ] }, { From c31f7cd5a8fa5e6e5c532c7dc360c9e256439729 Mon Sep 17 00:00:00 2001 From: richard Date: Thu, 4 Jun 2020 12:23:20 +0100 Subject: [PATCH 4/5] comment out jit --- .../Solutions/Dual_PET_Answer-noMotion.ipynb | 8 +++++--- .../Solutions/Dual_PET_Answer-wMotion.ipynb | 8 +++++--- notebooks/Synergistic/de_Pierro_MAPEM.ipynb | 16 +++++++++++++--- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/notebooks/Synergistic/Solutions/Dual_PET_Answer-noMotion.ipynb b/notebooks/Synergistic/Solutions/Dual_PET_Answer-noMotion.ipynb index 74f4f68a..8946b31b 100644 --- a/notebooks/Synergistic/Solutions/Dual_PET_Answer-noMotion.ipynb +++ b/notebooks/Synergistic/Solutions/Dual_PET_Answer-noMotion.ipynb @@ -93,7 +93,6 @@ "import sys\n", "import shutil\n", "from tqdm.auto import tqdm, trange\n", - "from numba import jit\n", "import time\n", "import sirf.STIR as pet\n", "from sirf.Utilities import examples_data_path\n", @@ -484,12 +483,15 @@ }, "language_info": { "codemirror_mode": { - "name": "ipython" + "name": "ipython", + "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", - "nbconvert_exporter": "python" + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.7" } }, "nbformat": 4, diff --git a/notebooks/Synergistic/Solutions/Dual_PET_Answer-wMotion.ipynb b/notebooks/Synergistic/Solutions/Dual_PET_Answer-wMotion.ipynb index 350e08f9..e0e0171c 100644 --- a/notebooks/Synergistic/Solutions/Dual_PET_Answer-wMotion.ipynb +++ b/notebooks/Synergistic/Solutions/Dual_PET_Answer-wMotion.ipynb @@ -92,7 +92,6 @@ "import os\n", "import sys\n", "import shutil\n", - "from numba import jit\n", "import time\n", "import sirf.STIR as pet\n", "from sirf.Utilities import examples_data_path\n", @@ -518,12 +517,15 @@ }, "language_info": { "codemirror_mode": { - "name": "ipython" + "name": "ipython", + "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", - "nbconvert_exporter": "python" + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.7" } }, "nbformat": 4, diff --git a/notebooks/Synergistic/de_Pierro_MAPEM.ipynb b/notebooks/Synergistic/de_Pierro_MAPEM.ipynb index 25b64e37..61b21a0e 100644 --- a/notebooks/Synergistic/de_Pierro_MAPEM.ipynb +++ b/notebooks/Synergistic/de_Pierro_MAPEM.ipynb @@ -47,6 +47,17 @@ "# All the normal imports and handy functions" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# If you have python3, you can uncomment this\n", + "# and all subsequent mentions of \"@jit\".\n", + "# from numba import jit" + ] + }, { "cell_type": "code", "execution_count": null, @@ -60,7 +71,6 @@ "import sys\n", "import shutil\n", "from tqdm.auto import tqdm, trange\n", - "from numba import jit\n", "import time\n", "from scipy.ndimage.filters import gaussian_filter\n", "import sirf.STIR as pet\n", @@ -180,7 +190,7 @@ "\n", "# Define function for xreg. \n", "# Using jit gets computation time from 90 secs to 2!\n", - "@jit\n", + "#@jit\n", "def compute_xreg(image_array):\n", " sizes=image_array.shape\n", " image_reg= image_array*0 # make a copy first. Will then change values\n", @@ -193,7 +203,7 @@ " return image_reg\n", "\n", "# define a function that computes the MAP-EM update\n", - "@jit\n", + "#@jit\n", "def compute_MAPEM_update(xEM,xreg, beta):\n", " return (2*xEM)/(numpy.sqrt((1 - beta*xreg)**2 + 4*beta*xEM) + (1 - beta*xreg) + 0.00001)" ] From 3c4dd5e08510622530667a412dc0fa9724eca40a Mon Sep 17 00:00:00 2001 From: richard Date: Thu, 4 Jun 2020 14:28:31 +0100 Subject: [PATCH 5/5] undo python3 changes --- .../Synergistic/Solutions/Dual_PET_Answer-noMotion.ipynb | 7 ++----- .../Synergistic/Solutions/Dual_PET_Answer-wMotion.ipynb | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/notebooks/Synergistic/Solutions/Dual_PET_Answer-noMotion.ipynb b/notebooks/Synergistic/Solutions/Dual_PET_Answer-noMotion.ipynb index 8946b31b..2ff0a2b3 100644 --- a/notebooks/Synergistic/Solutions/Dual_PET_Answer-noMotion.ipynb +++ b/notebooks/Synergistic/Solutions/Dual_PET_Answer-noMotion.ipynb @@ -483,15 +483,12 @@ }, "language_info": { "codemirror_mode": { - "name": "ipython", - "version": 3 + "name": "ipython" }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.7" + "nbconvert_exporter": "python" } }, "nbformat": 4, diff --git a/notebooks/Synergistic/Solutions/Dual_PET_Answer-wMotion.ipynb b/notebooks/Synergistic/Solutions/Dual_PET_Answer-wMotion.ipynb index e0e0171c..771aac3a 100644 --- a/notebooks/Synergistic/Solutions/Dual_PET_Answer-wMotion.ipynb +++ b/notebooks/Synergistic/Solutions/Dual_PET_Answer-wMotion.ipynb @@ -517,15 +517,12 @@ }, "language_info": { "codemirror_mode": { - "name": "ipython", - "version": 3 + "name": "ipython" }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.7" + "nbconvert_exporter": "python" } }, "nbformat": 4,