From 79751119c69fc5875264b978a01e51ec68656893 Mon Sep 17 00:00:00 2001 From: JeanBilheux Date: Wed, 18 Sep 2024 09:04:32 -0400 Subject: [PATCH 1/2] Fixed notebooks. this refs #11 --- notebooks/debugging_multi_roi_bug.ipynb | 6 +- notebooks/ipts-16259.ipynb | 186 ------------------ ...otebook_display_with_time_estimation.ipynb | 6 +- .../testing_new_auto_gamma_filtering.ipynb | 6 +- ...malization_with_fewer_ob_than_sample.ipynb | 6 +- ..._with_fewer_ob_than_sample_MAYBE_BUG.ipynb | 33 ++-- notebooks/tutorial_using_array_input.ipynb | 6 +- ...l_using_array_input_and_export_array.ipynb | 8 +- ...al_using_array_input_and_several_roi.ipynb | 6 +- notebooks/tutorial_using_folder_input.ipynb | 22 +-- 10 files changed, 54 insertions(+), 231 deletions(-) delete mode 100644 notebooks/ipts-16259.ipynb diff --git a/notebooks/debugging_multi_roi_bug.ipynb b/notebooks/debugging_multi_roi_bug.ipynb index 01b19bc..049f911 100644 --- a/notebooks/debugging_multi_roi_bug.ipynb +++ b/notebooks/debugging_multi_roi_bug.ipynb @@ -357,7 +357,7 @@ "metadata": { "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -371,7 +371,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.2" + "version": "3.12.6" }, "toc": { "colors": { @@ -394,5 +394,5 @@ } }, "nbformat": 4, - "nbformat_minor": 1 + "nbformat_minor": 4 } diff --git a/notebooks/ipts-16259.ipynb b/notebooks/ipts-16259.ipynb deleted file mode 100644 index 53d5f26..0000000 --- a/notebooks/ipts-16259.ipynb +++ /dev/null @@ -1,186 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "run_control": { - "frozen": false, - "read_only": false - } - }, - "outputs": [], - "source": [ - "root_folder = os.path.dirname(os.getcwd())\n", - "sys.path.append(root_folder)\n", - "import NeuNorm as neunorm\n", - "from NeuNorm.normalization import Normalization\n", - "from NeuNorm.roi import ROI" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# data\n", - "\n", - "file_1 = '/Volumes/my_book_thunderbolt_duo/IPTS/IPTS-16259/MS-19/20170906_MS-19(2)_0000_0440.tiff'\n", - "file_2 = '/Volumes/my_book_thunderbolt_duo/IPTS/IPTS-16259/MS-19/20170906_MS-19(2)_0000_0441.tiff'\n", - "file_3 = '/Volumes/my_book_thunderbolt_duo/IPTS/IPTS-16259/MS-19/20170906_MS-19(2)_0000_0442.tiff'\n", - "file_4 = '/Volumes/my_book_thunderbolt_duo/IPTS/IPTS-16259/MS-19/20170906_MS-19(2)_0000_0443.tiff'\n", - "file_5 = '/Volumes/my_book_thunderbolt_duo/IPTS/IPTS-16259/MS-19/20170906_MS-19(2)_0000_0444.tiff'\n", - "file_6 = '/Volumes/my_book_thunderbolt_duo/IPTS/IPTS-16259/MS-19/20170906_MS-19(2)_0000_0445.tiff'\n", - "data = [file_1, file_2, file_3, file_4, file_5, file_6]" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# ob\n", - "\n", - "ob_1 = '/Volumes/my_book_thunderbolt_duo/IPTS/IPTS-16259/OB/20170906_MS-19(2)_0000_0400.tiff'\n", - "ob_2 = '/Volumes/my_book_thunderbolt_duo/IPTS/IPTS-16259/OB/20170906_MS-19(2)_0000_0401.tiff'\n", - "ob_3 = '/Volumes/my_book_thunderbolt_duo/IPTS/IPTS-16259/OB/20170906_MS-19(2)_0000_0402.tiff'\n", - "ob = [ob_1, ob_2, ob_3]" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# df\n", - "\n", - "df_1 = '/Volumes/my_book_thunderbolt_duo/IPTS/IPTS-16259/df/20171027_DF_0000_0020.tiff'\n", - "df_2 = '/Volumes/my_book_thunderbolt_duo/IPTS/IPTS-16259/df/20171027_DF_0000_0021.tiff'\n", - "df_3 = '/Volumes/my_book_thunderbolt_duo/IPTS/IPTS-16259/df/20171027_DF_0000_0022.tiff'\n", - "df = [df_1, df_2, df_3]" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "o_norm = Normalization()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "o_norm.load(file=data)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "o_norm.load(file=ob, data_type='ob')" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "o_norm.load(file=df, data_type='df')" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "roi1 = ROI(x0=0, y0=0, x1=100, y1=100)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "o_norm.normalization(roi=roi1)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "len(o_norm.data['sample']['data'])" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "len(o_norm.data['normalized'])" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "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.6.2" - }, - "toc": { - "colors": { - "hover_highlight": "#DAA520", - "running_highlight": "#FF0000", - "selected_highlight": "#FFD700" - }, - "moveMenuLeft": true, - "nav_menu": { - "height": "12px", - "width": "252px" - }, - "navigate_menu": true, - "number_sections": true, - "sideBar": true, - "threshold": 4, - "toc_cell": false, - "toc_section_display": "block", - "toc_window_display": false - } - }, - "nbformat": 4, - "nbformat_minor": 2 -} diff --git a/notebooks/notebook_display_with_time_estimation.ipynb b/notebooks/notebook_display_with_time_estimation.ipynb index 92b6005..0dfac6f 100644 --- a/notebooks/notebook_display_with_time_estimation.ipynb +++ b/notebooks/notebook_display_with_time_estimation.ipynb @@ -169,7 +169,7 @@ "metadata": { "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -183,7 +183,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.2" + "version": "3.12.6" }, "toc": { "colors": { @@ -206,5 +206,5 @@ } }, "nbformat": 4, - "nbformat_minor": 1 + "nbformat_minor": 4 } diff --git a/notebooks/testing_new_auto_gamma_filtering.ipynb b/notebooks/testing_new_auto_gamma_filtering.ipynb index 35c9118..84679f1 100644 --- a/notebooks/testing_new_auto_gamma_filtering.ipynb +++ b/notebooks/testing_new_auto_gamma_filtering.ipynb @@ -215,7 +215,7 @@ "metadata": { "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -229,7 +229,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.3" + "version": "3.12.6" }, "toc": { "colors": { @@ -252,5 +252,5 @@ } }, "nbformat": 4, - "nbformat_minor": 1 + "nbformat_minor": 4 } diff --git a/notebooks/tutorial_normalization_with_fewer_ob_than_sample.ipynb b/notebooks/tutorial_normalization_with_fewer_ob_than_sample.ipynb index a75c083..3dce3dc 100644 --- a/notebooks/tutorial_normalization_with_fewer_ob_than_sample.ipynb +++ b/notebooks/tutorial_normalization_with_fewer_ob_than_sample.ipynb @@ -319,7 +319,7 @@ "metadata": { "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -333,7 +333,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.2" + "version": "3.12.6" }, "toc": { "colors": { @@ -356,5 +356,5 @@ } }, "nbformat": 4, - "nbformat_minor": 1 + "nbformat_minor": 4 } diff --git a/notebooks/tutorial_normalization_with_fewer_ob_than_sample_MAYBE_BUG.ipynb b/notebooks/tutorial_normalization_with_fewer_ob_than_sample_MAYBE_BUG.ipynb index fc79aa7..fd8e359 100644 --- a/notebooks/tutorial_normalization_with_fewer_ob_than_sample_MAYBE_BUG.ipynb +++ b/notebooks/tutorial_normalization_with_fewer_ob_than_sample_MAYBE_BUG.ipynb @@ -126,11 +126,11 @@ }, "outputs": [], "source": [ - "path_im = '/Volumes/my_book_thunderbolt_duo/IPTS/IPTS_19558/run_16/'\n", + "path_im = '../data/sample'\n", "assert os.path.exists(path_im)\n", - "sample1 = path_im + '/Image016_00000.fits'\n", + "sample1 = path_im + '/0002.tif'\n", "assert os.path.exists(sample1)\n", - "sample2 = path_im + '/Image016_00001.fits'\n", + "sample2 = path_im + '/0003.tif'\n", "assert os.path.exists(sample2)" ] }, @@ -157,9 +157,9 @@ }, "outputs": [], "source": [ - "path_ob = '/Volumes/my_book_thunderbolt_duo/IPTS/IPTS_19558/run_08_OB'\n", - "ob1 = path_ob + '/Image008_00000.fits'\n", - "ob2 = path_ob + '/Image008_00001.fits'\n", + "path_ob = '../data/ob'\n", + "ob1 = path_ob + '/0005.tif'\n", + "ob2 = path_ob + '/0006.tif'\n", "assert os.path.exists(ob1)\n", "assert os.path.exists(ob2)" ] @@ -188,7 +188,7 @@ "outputs": [], "source": [ "o_norm = Normalization()\n", - "o_norm.load(file=sample1, notebook=True)\n", + "o_norm.load(file=[sample1], notebook=True)\n", "o_norm.load(file=[ob1, ob2], data_type='ob', notebook=True)" ] }, @@ -234,8 +234,8 @@ "source": [ "x0 = 0\n", "y0 = 0\n", - "width = 511\n", - "height = 511\n" + "width = 10\n", + "height = 15\n" ] }, { @@ -279,6 +279,15 @@ "normalized_data = o_norm.data['normalized']" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "o_norm.data" + ] + }, { "cell_type": "code", "execution_count": null, @@ -339,7 +348,7 @@ "metadata": { "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python [default]", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -353,7 +362,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.5.3" + "version": "3.12.6" }, "toc": { "colors": { @@ -376,5 +385,5 @@ } }, "nbformat": 4, - "nbformat_minor": 1 + "nbformat_minor": 4 } diff --git a/notebooks/tutorial_using_array_input.ipynb b/notebooks/tutorial_using_array_input.ipynb index c561af2..7b5ee26 100644 --- a/notebooks/tutorial_using_array_input.ipynb +++ b/notebooks/tutorial_using_array_input.ipynb @@ -398,7 +398,7 @@ "metadata": { "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -412,7 +412,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.2" + "version": "3.12.6" }, "toc": { "colors": { @@ -435,5 +435,5 @@ } }, "nbformat": 4, - "nbformat_minor": 1 + "nbformat_minor": 4 } diff --git a/notebooks/tutorial_using_array_input_and_export_array.ipynb b/notebooks/tutorial_using_array_input_and_export_array.ipynb index 42a59e4..6b42e45 100644 --- a/notebooks/tutorial_using_array_input_and_export_array.ipynb +++ b/notebooks/tutorial_using_array_input_and_export_array.ipynb @@ -129,7 +129,7 @@ "outputs": [], "source": [ "path_im = '../data/sample'\n", - "sample_data = os.path.join(path_im, '0001.tif')\n", + "sample_data = os.path.join(path_im, '0002.tif')\n", "_sample_data = np.array(Image.open(sample_data))\n" ] }, @@ -214,7 +214,7 @@ "metadata": { "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -228,7 +228,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.2" + "version": "3.12.6" }, "toc": { "colors": { @@ -251,5 +251,5 @@ } }, "nbformat": 4, - "nbformat_minor": 1 + "nbformat_minor": 4 } diff --git a/notebooks/tutorial_using_array_input_and_several_roi.ipynb b/notebooks/tutorial_using_array_input_and_several_roi.ipynb index e2278c9..7140876 100644 --- a/notebooks/tutorial_using_array_input_and_several_roi.ipynb +++ b/notebooks/tutorial_using_array_input_and_several_roi.ipynb @@ -406,7 +406,7 @@ "metadata": { "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -420,7 +420,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.3" + "version": "3.12.6" }, "toc": { "colors": { @@ -443,5 +443,5 @@ } }, "nbformat": 4, - "nbformat_minor": 1 + "nbformat_minor": 4 } diff --git a/notebooks/tutorial_using_folder_input.ipynb b/notebooks/tutorial_using_folder_input.ipynb index ade4f55..1235ef7 100644 --- a/notebooks/tutorial_using_folder_input.ipynb +++ b/notebooks/tutorial_using_folder_input.ipynb @@ -58,7 +58,7 @@ "import matplotlib.pyplot as plt\n", "import matplotlib.patches as patches\n", "from matplotlib import gridspec\n", - "%matplotlib notebook" + "%matplotlib notebook\n" ] }, { @@ -84,7 +84,12 @@ }, "outputs": [], "source": [ - "neunorm.__version__" + "root_folder = os.path.dirname(os.getcwd())\n", + "sys.path.append(root_folder)\n", + "\n", + "import NeuNorm as neunorm\n", + "from NeuNorm.normalization import Normalization\n", + "from NeuNorm.roi import ROI" ] }, { @@ -98,12 +103,7 @@ }, "outputs": [], "source": [ - "root_folder = os.path.dirname(os.getcwd())\n", - "sys.path.append(root_folder)\n", - "\n", - "import NeuNorm as neunorm\n", - "from NeuNorm.normalization import Normalization\n", - "from NeuNorm.roi import ROI" + "neunorm.__version__" ] }, { @@ -410,7 +410,7 @@ "metadata": { "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -424,7 +424,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.3" + "version": "3.12.6" }, "toc": { "colors": { @@ -447,5 +447,5 @@ } }, "nbformat": 4, - "nbformat_minor": 1 + "nbformat_minor": 4 } From 76efcb7694e9f7a138b6ff936a37b0e57c3d4068 Mon Sep 17 00:00:00 2001 From: JeanBilheux Date: Wed, 18 Sep 2024 09:18:29 -0400 Subject: [PATCH 2/2] Fixed unit test file names. this refs #11 --- tests/NeuNorm/{cropping_test.py => test_cropping.py} | 0 tests/NeuNorm/{export_test.py => test_export.py} | 0 tests/NeuNorm/{loading_test.py => test_loading.py} | 0 tests/NeuNorm/{roi_test.py => test_roi.py} | 0 tests/NeuNorm/{utilities_test.py => test_utilities.py} | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename tests/NeuNorm/{cropping_test.py => test_cropping.py} (100%) rename tests/NeuNorm/{export_test.py => test_export.py} (100%) rename tests/NeuNorm/{loading_test.py => test_loading.py} (100%) rename tests/NeuNorm/{roi_test.py => test_roi.py} (100%) rename tests/NeuNorm/{utilities_test.py => test_utilities.py} (100%) diff --git a/tests/NeuNorm/cropping_test.py b/tests/NeuNorm/test_cropping.py similarity index 100% rename from tests/NeuNorm/cropping_test.py rename to tests/NeuNorm/test_cropping.py diff --git a/tests/NeuNorm/export_test.py b/tests/NeuNorm/test_export.py similarity index 100% rename from tests/NeuNorm/export_test.py rename to tests/NeuNorm/test_export.py diff --git a/tests/NeuNorm/loading_test.py b/tests/NeuNorm/test_loading.py similarity index 100% rename from tests/NeuNorm/loading_test.py rename to tests/NeuNorm/test_loading.py diff --git a/tests/NeuNorm/roi_test.py b/tests/NeuNorm/test_roi.py similarity index 100% rename from tests/NeuNorm/roi_test.py rename to tests/NeuNorm/test_roi.py diff --git a/tests/NeuNorm/utilities_test.py b/tests/NeuNorm/test_utilities.py similarity index 100% rename from tests/NeuNorm/utilities_test.py rename to tests/NeuNorm/test_utilities.py