From eee56a35fd46856bf8e71097b1f43e1c2c9f422e Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 11 Oct 2023 17:02:18 -0400 Subject: [PATCH] PEP8 and format changes --- notebooks/STIPS Advanced II - PSFs.ipynb | 1789 ++++++++++++---------- notebooks/STIPS Basic Tutorial.ipynb | 612 +------- stips-2.0.0 | 1 + stips/instruments/instrument.py | 6 +- stips/instruments/wfi.py | 54 +- stips/utilities/__init__.py | 28 +- stips/utilities/tests/test_makePSF.py | 347 +++-- 7 files changed, 1194 insertions(+), 1643 deletions(-) create mode 160000 stips-2.0.0 diff --git a/notebooks/STIPS Advanced II - PSFs.ipynb b/notebooks/STIPS Advanced II - PSFs.ipynb index 8b35578..3d88e4a 100644 --- a/notebooks/STIPS Advanced II - PSFs.ipynb +++ b/notebooks/STIPS Advanced II - PSFs.ipynb @@ -29,30 +29,38 @@ "id": "775c25da", "metadata": {}, "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "**WARNING**: LOCAL JWST PRD VERSION PRDOPSSOC-062 CANNOT BE CHECKED AGAINST ONLINE VERSION\n" + ] + }, { "name": "stdout", "output_type": "stream", "text": [ - "STIPS Version 2.0.0 with Data Version 1.0.9 at /Users/halkowsi/STScI-STIPS/ref_data/stips_data.\n", + "STIPS Version 2.0.0 with Data Version 1.0.9 at /Users/sebastian/Documents/STIPS/stips_data.\n", "\tSTIPS Grid Generated with 1.0.8\n", - "Pandeia Version 1.7 with Data Version 1.7 at /Users/halkowsi/STScI-STIPS/ref_data/pandeia_data-1.7_roman.\n", - "Webbpsf Version 1.0.0 with Data Version 1.0.0 at /Users/halkowsi/STScI-STIPS/ref_data/webbpsf-data.\n", + "Pandeia Version 3.0 with Data Version 3.0 at /Users/sebastian/Documents/STIPS/pandeia_data-3.0_roman.\n", + "Webbpsf Version 1.1.1 with Data Version 1.1.1 at /Users/sebastian/Documents/STIPS/webbpsf-data.\n", "\n" ] } ], "source": [ - "import numpy as np\n", - "from glob import glob\n", "%matplotlib inline\n", "%config InlineBackend.figure_format = 'svg'\n", + "\n", + "from astropy.io import fits\n", + "from glob import glob\n", + "import numpy as np\n", "import matplotlib\n", "from matplotlib import style\n", + "import matplotlib.pyplot as plt\n", + "import matplotlib.ticker as ticker\n", "matplotlib.rcParams['axes.grid'] = False\n", "matplotlib.rcParams['image.origin'] = 'lower'\n", - "import matplotlib.pyplot as plt\n", - "from astropy.io import fits\n", - "\n", "import stips\n", "\n", "print(stips.__env__report__)" @@ -68,7 +76,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "['notebook_example_stars_000_01_conv_F129_observed_SCA01.fits', 'notebook_example_gals_000_01_conv_F129.fits', 'notebook_example_stars_000_01_conv_F129.fits', 'notebook_example_1_0.fits', 'notebook_example_gals_000.fits', 'notebook_example_gals_000_01_conv_F129_observed_SCA01.fits', 'notebook_example_basic_scene.jpeg', 'notebook_example_stars_000.fits']\n" + "['notebook_example_1_0.fits']\n" ] } ], @@ -89,7 +97,7 @@ }, { "cell_type": "code", - "execution_count": 83, + "execution_count": 3, "id": "07fa1b96", "metadata": {}, "outputs": [ @@ -131,14 +139,14 @@ }, { "cell_type": "code", - "execution_count": 84, + "execution_count": 4, "id": "ff1669b8", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "
" + "
" ] }, "metadata": {}, @@ -150,16 +158,16 @@ "\n", "\n", - "\n", + "\n", " \n", " \n", " \n", " \n", - " 2022-11-03T18:09:03.508961\n", + " 2023-10-11T11:43:35.613407\n", " image/svg+xml\n", " \n", " \n", - " Matplotlib v3.5.2, https://matplotlib.org/\n", + " Matplotlib v3.7.3, https://matplotlib.org/\n", " \n", " \n", " \n", @@ -170,52 +178,51 @@ " \n", " \n", " \n", - " \n", + "\" style=\"fill: #ffffff\"/>\n", " \n", " \n", " \n", - " \n", " \n", - " \n", + " \n", " \n", + "iVBORw0KGgoAAAANSUhEUgAAAXQAAAF0CAYAAAAzY8JTAAALJElEQVR4nO3dz24rdx3G4e84OX/TqkAXldgC4o/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HCCHoACEEHSCEoAOEEHSAEIIOEELQAUIIOkAIQQcIIegAIQQdIISgA4QQdIAQgg4QQtABQgg6QAhBBwgh6AAhBB0ghKADhBB0gBCCDhBC0AFCCDpACEEHCCHoACEEHSCEoAOEEHSAEIIOEELQAUIIOkAIQQcIIegAIQQdIISgA4QQdIAQgg4QQtABQgg6QAhBBwgh6AAhBB0ghKADhBB0gBCCDhBC0AFCCDpACEEHCCHoACEEHSCEoAOEEHSAEIIOEELQAUIIOkAIQQcIIegAIQQdIISgA4QQdIAQgg4QQtABQgg6QAhBBwgh6AAhBB0ghKADhBB0gBCCDhBC0AFCCDpACEEHCCHoACEEHSCEoAOEEHSAEIIOEELQAUIIOkAIQQcIIegAIQQdIISgA4QQdIAQgg4QQtABQgg6QAhBBwgh6AAhBB0ghKADhBB0gBCCDhBC0AFCCDpACEEHCCHoACEEHSCEoAOEEHSAEP8D1RNBwa8W1foAAAAASUVORK5CYII=\" id=\"image34d15097b1\" transform=\"scale(1 -1) translate(0 -267.84)\" x=\"33.2875\" y=\"-23.878125\" width=\"267.84\" height=\"267.84\"/>\n", " \n", " \n", " \n", " \n", " \n", - " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", @@ -498,17 +505,17 @@ " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", @@ -518,17 +525,17 @@ " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", @@ -540,17 +547,17 @@ " \n", " \n", " \n", - " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", @@ -558,12 +565,12 @@ " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", @@ -572,12 +579,12 @@ " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", @@ -586,12 +593,12 @@ " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", @@ -600,12 +607,12 @@ " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", @@ -614,12 +621,12 @@ " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", @@ -629,12 +636,12 @@ " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", @@ -644,12 +651,12 @@ " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", @@ -659,12 +666,12 @@ " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", @@ -673,41 +680,39 @@ " \n", " \n", " \n", - " \n", " \n", " \n", - " \n", " \n", " \n", - " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", "\n" ], "text/plain": [ - "
" + "
" ] }, - "metadata": { - "needs_background": "light" - }, + "metadata": {}, "output_type": "display_data" } ], @@ -742,7 +747,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 5, "id": "5420ad47", "metadata": {}, "outputs": [ @@ -752,7 +757,7 @@ "-3.867468290857751" ] }, - "execution_count": 9, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -774,17 +779,17 @@ }, { "cell_type": "code", - "execution_count": 85, + "execution_count": 4, "id": "75f9153d", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "" + "" ] }, - "execution_count": 85, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" }, @@ -794,16 +799,16 @@ "\n", "\n", - "\n", + "\n", " \n", " \n", " \n", " \n", - " 2022-11-03T18:09:29.076126\n", + " 2023-10-11T11:47:20.978117\n", " image/svg+xml\n", " \n", " \n", - " Matplotlib v3.5.2, https://matplotlib.org/\n", + " Matplotlib v3.7.3, https://matplotlib.org/\n", " \n", " \n", " \n", @@ -814,274 +819,307 @@ " \n", " \n", " \n", - " \n", + "\" style=\"fill: #ffffff\"/>\n", " \n", " \n", " \n", - " \n", " \n", - " \n", + " \n", " \n", + "iVBORw0KGgoAAAANSUhEUgAAATQAAAE0CAYAAACigc+fAAAKXUlEQVR4nO3dzW5kRwEF4NttexJ7mISIRdijsImExAqx5ucJ8oBIPAELngGBxA4hECxRREQCiYJn4vHYlwWwSZ2Obk//uH3m+5Z3bv+4xzou1emqWv109dE8ARRYP/QbANgXgQbUEGhADYEG1BBoQA2BBtQQaEANgQbUEGhADYEG1BBoQA2BBtQQaEANgQbUEGhADYEG1BBoQA2BBtQQaEANgQbUEGhADYEG1BBoQA2BBtQQaEANgQbUEGhADYEG1B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g==\" id=\"imagece71c6e050\" transform=\"scale(1 -1) translate(0 -221.76)\" x=\"33.2875\" y=\"-7.2\" width=\"221.76\" height=\"221.76\"/>\n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", " \n", - " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", - " \n", + " \n", " \n", - " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", - " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", - " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", - " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", " \n", @@ -1090,139 +1128,156 @@ " \n", " \n", " \n", - " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", + " \n", " \n", " \n", " \n", " \n", " \n", - " \n", " \n", " \n", - " \n", " \n", " \n", - " \n", " \n", " \n", - " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", "\n" ], "text/plain": [ - "
" + "
" ] }, - "metadata": { - "needs_background": "light" - }, + "metadata": {}, "output_type": "display_data" } ], "source": [ - "fig1_1, ax1_1 = plt.subplots()\n", - "ax1_1.imshow(test_psf[58:118, 58:118])\n", + "# Plot parameters\n", + "x_mid = 88\n", + "y_mid = 88\n", + "half = 30\n", + "\n", + "# create custom formatter for cutout region axes (run once)\n", + "ticks_x = ticker.FuncFormatter(lambda x, pos: f\"{x + x_mid - half:.0f}\")\n", + "ticks_y = ticker.FuncFormatter(lambda y, pos: f\"{y + y_mid - half:.0f}\")\n", + "\n", + "# to plot cutout region:\n", + "fig0, ax0 = plt.subplots(figsize=(4,4))\n", + "ax0.imshow(test_psf[x_mid - half:x_mid + half,\n", + " y_mid - half:y_mid + half])\n", + "\n", + "# replace default tick labels with cutout pixel indices\n", + "# (run in every cell that shows a plot of the cutout region)\n", + "ax0.set_xticks([x for x in ax0.get_xticks() if 0 <= x < half*2])\n", + "ax0.xaxis.set_major_formatter(ticks_x)\n", + "ax0.yaxis.set_major_formatter(ticks_y)\n", "\n", "#Coordinates of circle adjusted for crop.\n", "circ_bicubic = plt.Circle((27, 27), 3, color='r', fill=False)\n", "\n", - "ax1_1.add_patch(circ_bicubic)" + "ax0.add_patch(circ_bicubic)" ] }, { @@ -1246,7 +1301,7 @@ }, { "cell_type": "code", - "execution_count": 78, + "execution_count": 7, "id": "c80b7c91", "metadata": {}, "outputs": [ @@ -1256,7 +1311,7 @@ "0.00044947279766548826" ] }, - "execution_count": 78, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -1285,17 +1340,17 @@ }, { "cell_type": "code", - "execution_count": 79, + "execution_count": 5, "id": "52038cc3", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "" + "" ] }, - "execution_count": 79, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" }, @@ -1305,16 +1360,16 @@ "\n", "\n", - "\n", + "\n", " \n", " \n", " \n", " \n", - " 2022-11-03T18:00:05.949169\n", + " 2023-10-11T11:48:28.996100\n", " image/svg+xml\n", " \n", " \n", - " Matplotlib v3.5.2, https://matplotlib.org/\n", + " Matplotlib v3.7.3, https://matplotlib.org/\n", " \n", " \n", " \n", @@ -1325,274 +1380,307 @@ " \n", " \n", " \n", - " \n", + "\" style=\"fill: #ffffff\"/>\n", " \n", " \n", " \n", - " \n", " \n", - " \n", + " \n", " \n", + "iVBORw0KGgoAAAANSUhEUgAAATQAAAE0CAYAAACigc+fAAAKXUlEQVR4nO3dzW5kRwEF4NttexJ7mISIRdijsImExAqx5ucJ8oBIPAELngGBxA4hECxRREQCiYJn4vHYlwWwSZ2Obk//uH3m+5Z3bv+4xzou1emqWv109dE8ARRYP/QbANgXgQbUEGhADYEG1BBoQA2BBtQQaEANgQbUEGhADYEG1BBoQA2BBtQQaEANgQbUEGhADYEG1BBoQA2BBtQQaEANgQbUEGhADYEG1BBoQA2BBtQQaEANgQbUEGhADYEG1BBoQA2BBtQQaEANgQbUEGhADYEG1BBoQA2BBtQQaEANgQbUEGhADYEG1BBoQA2BBtQQaEANgQbUEGhADYEG1BBoQA2BBtQQaEANgQbUEGhADYEG1BBoQA2BBtQQaEANgQbUEGhADYEG1BBoQA2BBtQQaEANgQbUEGhADYEG1BBoQA2BBtQ4f+g3wB6sVvt9vnne7/PBkR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mhATUEGlBDoAE1BBpQQylwKpauKgj3pW/wT+FQ8VWY9J7TSoG0zdCm97PU0i18lk70T1P+tv/Cx8fPbJeJ+V0+G/bG/wJQQ6ABNQQaUEOgATWUAqcsFQD34QyAKUyEp2+9p0n0tCpg0/74G1YQvLa4hU9aPbBhpcDC8wPiZ+Gb+ZWM0IAaAg2oIdCAGgINqKEUeB3pG+6HOGg2vvbCoiCcRzCnufVN38JP0pkEu9hxsn7vk/1L9+uPe/0foGRwfsDWjNCAGgINqCHQgBoCDaihFGiwsCiYwoqCePjwJnHHnSNMXJ/ahPshSiEFwF4YoQE1BBpQQ6ABNQQaUEMpsC+7fMv8EBaeUXCQSf1T25rnGBPuJvVPghEaUEOgATUEGlBDoAE1BBpQQ8t5bMdqw461ZxecECM0oIZAA2oINKCGQANqKAVa7VI+HGt51iFYgvRGM0IDagg0oIZAA2oINKCGUoDRNhPrD1kgKAD4GiM0oIZAA2oINKCGQANqKAXYzSFOEYfXZIQG1BBoQA2BBtQQaEANpQD7t+9T5K0IYCEjNKCGQANqCDSghkADaigFeDgm+9kzIzSghkADagg0oIZAA2oINKCGQANqCDSghkADagg0oIZAA2oINKCGQANqCDSghkADagg0oIZAA2oINKCGQANqCDSghkADagg0oIZAA2oINKCGQANqCDSghkADagg0oIZAA2oINKCGQANqCDSghkADagg0oIZAA2oINKCGQANqCDSghkADagg0oIZAA2oINKCGQANqCDSghkADagg0oIZAA2oINKCGQANqCDSghkADagg0oIZAA2oINKCGQANqCDSghkADagg0oIZAA2oINKCGQANqCDSghkADagg0oIZAA2oINKCGQANq/AfgCRS+oDen6gAAAABJRU5ErkJggg==\" id=\"imageef1fe169ac\" transform=\"scale(1 -1) translate(0 -221.76)\" x=\"33.2875\" y=\"-7.2\" width=\"221.76\" height=\"221.76\"/>\n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", " \n", - " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", - " \n", + " \n", " \n", - " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", - " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", - " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", - " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", - " \n", + " \n", " \n", - " \n", + " \n", " \n", + " \n", " \n", " \n", " \n", @@ -1601,134 +1689,142 @@ " \n", " \n", " \n", - " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", + " \n", " \n", " \n", " \n", " \n", " \n", - " \n", " \n", " \n", - " \n", " \n", " \n", - " \n", " \n", " \n", - " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", "\n" ], "text/plain": [ - "
" + "
" ] }, - "metadata": { - "needs_background": "light" - }, + "metadata": {}, "output_type": "display_data" } ], "source": [ - "fig1_2, ax1_2 = plt.subplots()\n", - "ax1_2.imshow(test_psf[58:118, 58:118])\n", + "# to plot cutout region:\n", + "fig1_2, ax1_2 = plt.subplots(figsize=(4,4))\n", + "ax1_2.imshow(test_psf[x_mid - half:x_mid + half,\n", + " y_mid - half:y_mid + half])\n", + "\n", + "# replace default tick labels with cutout pixel indices\n", + "# (run in every cell that shows a plot of the cutout region)\n", + "ax1_2.set_xticks([x for x in ax1_2.get_xticks() if 0 <= x < half*2])\n", + "ax1_2.xaxis.set_major_formatter(ticks_x)\n", + "ax1_2.yaxis.set_major_formatter(ticks_y)\n", "\n", "#Coordinates of circle adjusted for crop.\n", "circ_real_psf = plt.Circle((35, 35), 3, color='r', fill=False)\n", @@ -1769,17 +1865,17 @@ }, { "cell_type": "code", - "execution_count": 86, + "execution_count": 7, "id": "3088442d", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "" + "" ] }, - "execution_count": 86, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" }, @@ -1789,16 +1885,16 @@ "\n", "\n", - "\n", + "\n", " \n", " \n", " \n", " \n", - " 2022-11-03T18:11:29.988739\n", + " 2023-10-11T11:50:06.555272\n", " image/svg+xml\n", " \n", " \n", - " Matplotlib v3.5.2, https://matplotlib.org/\n", + " Matplotlib v3.7.3, https://matplotlib.org/\n", " \n", " \n", " \n", @@ -1809,56 +1905,55 @@ " \n", " \n", " \n", - " \n", + "\" style=\"fill: #ffffff\"/>\n", " \n", " \n", " \n", - " \n", " \n", - " \n", + " \n", " \n", + "iVBORw0KGgoAAAANSUhEUgAAAXIAAAFyCAYAAADoJFEJAAAIhElEQVR4nO3dzW5cZx3AYR87ttskIhGwAgkkyhruAZU7qGDL7XATLLkBWHINiE2RkBALRIP4Em3d1nHsmWGB5Jn3uB1iEn/8PM+zOsfvODmdqj+9/fvM8fT+9MFqD4Cs/bu+AADejJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8QJOUCckAPECTlAnJADxAk5QJyQA8Q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zueu03rtNh+N//tOj8Xx5+nLj5O4f1Xpvbb6n++P7vVrM3rfNfx9XHof7//+Mwo4cIE7IAeKEHCDOjBx2yMHTJ+uT4+NhbTo+Gs8PTi6PFycnw5p7ztc25+L7jx+Pa8++NpyvNt7HxaefjX/Qajk7dx85wM4QcoA4oxV4SLbcbri3tzeMUz7+0XvD0r9+MH7vez//8K1eWtb/eE83xynTN78+rJ19Zzw//vM6udPm7Z17e3urV6+2/71bRi125ABxQg4QJ+QAcWbk8JDM56jzJ6xu3OL27MOPh6UnL94dX7r58fJdvt1w9s8+HYxv6vR4/b69+tbzYe03v/zFcP7jn/zs8vjgo79u/Xuuw44cIE7IAeKEHCBuen/6YIeHX/DAze5Fnh4dro+PDsfXzma0y5dnGydbHsf6Jd/7oO0fDKcHmx/D/8bzYe3su+N95O/8/qPL48U//jmsXXnkrY/oA+wOIQeIc/shPGSz/z1fna8/Br66OL/W97722kM3e0rh4pNPL4/3z86GtaO/jeOTxca46upvD5rtq1ev/1uZ7MgB4oQcIE7IAeLMyGFXXfk4//zz/Hyp+fu2Mctenp6+lT/nuuzIAeKEHCBOyAHizMiB/9rle8Pfljv6uYMdOUCckAPECTlAnBk5wE25pZ872JEDxAk5QJyQA8QJOUCckAPECTlA3H8A9OkGHskpFbkAAAAASUVORK5CYII=\" id=\"imagec57d72a27d\" transform=\"scale(1 -1) translate(0 -266.4)\" x=\"26.925\" y=\"-6.912\" width=\"266.4\" height=\"266.4\"/>\n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", " \n", - " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", @@ -2085,12 +2180,12 @@ " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", @@ -2099,12 +2194,12 @@ " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", @@ -2113,12 +2208,12 @@ " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", @@ -2127,12 +2222,12 @@ " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", @@ -2140,41 +2235,39 @@ " \n", " \n", " \n", - " \n", " \n", " \n", - " \n", " \n", " \n", - " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", "\n" ], "text/plain": [ - "
" + "
" ] }, - "metadata": { - "needs_background": "light" - }, + "metadata": {}, "output_type": "display_data" } ], @@ -2202,7 +2295,7 @@ }, { "cell_type": "code", - "execution_count": 87, + "execution_count": 8, "id": "80546ce0", "metadata": {}, "outputs": [], @@ -2228,17 +2321,17 @@ }, { "cell_type": "code", - "execution_count": 88, + "execution_count": 9, "id": "4d2f93fd", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "" + "" ] }, - "execution_count": 88, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" }, @@ -2248,16 +2341,16 @@ "\n", "\n", - "\n", + "\n", " \n", " \n", " \n", " \n", - " 2022-11-03T18:11:53.430014\n", + " 2023-10-11T11:50:10.620046\n", " image/svg+xml\n", " \n", " \n", - " Matplotlib v3.5.2, https://matplotlib.org/\n", + " Matplotlib v3.7.3, https://matplotlib.org/\n", " \n", " \n", " \n", @@ -2268,256 +2361,275 @@ " \n", " \n", " \n", - " \n", + "\" style=\"fill: #ffffff\"/>\n", " \n", " \n", " \n", - " \n", " \n", - " \n", + " \n", " \n", + "iVBORw0KGgoAAAANSUhEUgAAATQAAAE0CAYAAACigc+fAAAG5klEQVR4nO3dy24caRmA4bQ7eEgiNMMoQggh2HAnwIY1EisWiPtiyR0gseA22HDYMQEEghlycA7uLjajqr9NLBL3wZnXz7P63XbbpZb86v+6qrtXP1r9dLoHEHB22wcAcCiCBmQIGpAhaECGoAEZggZkCBqQIWhAhqABGYIGZAgakCFoQIagARmCBmQIGpAhaECGoAEZggZkCBqQIWhAhqABGYIGZAgakCFoQIagARmCBmQIGpAhaECGoAEZggZkCBqQIWhAhqABGYIGZAgakCFoQIagARmCBmQIGpAhaECGoAEZggZkCBqQIWhAhqABGYIGZAgakCFoQIagARmCBmQIGpAhaECGoAEZggZkCBqQIWhAhqABGYIGZAgakCFoQIagARmCBmQIGpAhaECGoAEZggZkCBqQIWhAhqABGYIGZAgakCFoQIagARmCBmQIGpAhaECGoAEZggZkCBqQIWhAhqABGYIGZAgakCFoQIagARmCBmQIGpAhaECGoAEZggZkCBqQIWhAhqABGYIGZAgakCFoQIagARmCBmQIGpAhaECGoAEZggZkCBqQIWhAhqABGYIGZAgakCFoQIagARmCBmQIGpAhaECGoAEZggZkCBqQIWhAhqABGYIGZAgakCFoQIagARmCBmQIGpAhaECGoAEZggZkCBqQIWhAhqABGYIGZAgakCFoQIagARmCBmQIGpAhaECGoAEZggZkCBqQIWhAhqABGfdv+wCIWa3+/89M0/GPgzvJDg3IEDQgw8jJ/sYxc3U2LJfbp+04Zm6XpfGTA7JDAzIEDcgwcnJQ45h59vDhcvs3P57X07+/mNebZ8+XO09GUfZjhwZkCBqQYeRkf+OZzQcPlvXjT+f1q+8t64/Ohp+/eDmvp8th5IQbsEMDMgQNyDBysrfVej2vzx4tZzZff+eTef27X/9qXv/4Z7+Y1+snf1t+kTOb7MkODcgQNCDDyMnNDK/fnDabZX15Oa+/9o9n8/qHP//lvP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c+G2qEBGYIGZBg54cCmL/4zr1cXF/N6uz3OxaQfnPEC2nHkfPhgXv/zJz/Yucvj3/xh+WJ4zN6XHRqQIWhAhqABGZ5Dgz1Nl292vt48u+ZF6HflxenjpRbDJRjTxct5/fi3f965y/bps4P8aTs0IEPQgAwjJ+zr6tXs0x0ZLd/BzovOx8tWhvHzy28O65tf3mKHBmQIGpBh5ARO4wRnee3QgAxBAzIEDcgQNCBD0IAMQQMyBA3IEDQgQ9CADEEDMgQNyPgvw7Lo9mSVGJ4AAAAASUVORK5CYII=\" id=\"imaged7f5f5ab96\" transform=\"scale(1 -1) translate(0 -221.76)\" x=\"33.2875\" y=\"-7.2\" width=\"221.76\" height=\"221.76\"/>\n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", " \n", " \n", - " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", - " \n", + " \n", " \n", - " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", - " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", - " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", - " \n", " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", - " \n", " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", " \n", @@ -2526,121 +2638,136 @@ " \n", " \n", " \n", - " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", - " \n", " \n", " \n", - " \n", " \n", " \n", - " \n", " \n", " \n", - " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", "\n" ], "text/plain": [ - "
" + "
" ] }, - "metadata": { - "needs_background": "light" - }, + "metadata": {}, "output_type": "display_data" } ], "source": [ - "fig2_1, ax2_1 = plt.subplots()\n", - "ax2_1.imshow(result_data[1950:2050, 1950:2050])\n", + "# Plot parameters\n", + "x_mid2 = 2000\n", + "y_mid2 = 2000\n", + "half2 = 50\n", + "\n", + "# to plot cutout region:\n", + "fig2_1, ax2_1 = plt.subplots(figsize=(4,4))\n", + "ax2_1.imshow(result_data[x_mid2 - half2:x_mid2 + half2,\n", + " y_mid2 - half2:y_mid2 + half2])\n", "\n", + "# replace default tick labels with cutout pixel indices\n", + "# (run in every cell that shows a plot of the cutout region)\n", + "ax2_1.set_xticks([x for x in ax2_1.get_xticks() if 0 <= x < half2*2])\n", + "ax2_1.xaxis.set_major_formatter(ticks_x)\n", + "ax2_1.yaxis.set_major_formatter(ticks_y)\n", + "\n", + "#Coordinates of circle adjusted for crop.\n", "circ_source = plt.Circle((50, 50), 3, color='r', fill=False)\n", "\n", "ax2_1.add_patch(circ_source)" @@ -2673,7 +2800,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.5" + "version": "3.11.5" } }, "nbformat": 4, diff --git a/notebooks/STIPS Basic Tutorial.ipynb b/notebooks/STIPS Basic Tutorial.ipynb index 804b139..8666d40 100644 --- a/notebooks/STIPS Basic Tutorial.ipynb +++ b/notebooks/STIPS Basic Tutorial.ipynb @@ -28,21 +28,9 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "STIPS Version 2.0.0 with Data Version 1.0.9 at /Users/halkowsi/STScI-STIPS/ref_data/stips_data.\n", - "\tSTIPS Grid Generated with 1.0.8\n", - "Pandeia Version 1.7 with Data Version 1.7 at /Users/halkowsi/STScI-STIPS/ref_data/pandeia_data-1.7_roman.\n", - "Webbpsf Version 1.0.0 with Data Version 1.0.0 at /Users/halkowsi/STScI-STIPS/ref_data/webbpsf-data.\n", - "\n" - ] - } - ], + "outputs": [], "source": [ "import stips\n", "\n", @@ -60,7 +48,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -295,595 +283,9 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "
" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "image/svg+xml": [ - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " 2022-11-01T15:26:14.542740\n", - " image/svg+xml\n", - " \n", - " \n", - " Matplotlib v3.5.2, https://matplotlib.org/\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n" - ], - "text/plain": [ - "
" - ] - }, - "metadata": { - "needs_background": "light" - }, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "%matplotlib inline\n", "%config InlineBackend.figure_format = 'svg'\n", @@ -1328,7 +730,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -1342,7 +744,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.4" + "version": "3.11.5" } }, "nbformat": 4, diff --git a/stips-2.0.0 b/stips-2.0.0 new file mode 160000 index 0000000..8e4fa3b --- /dev/null +++ b/stips-2.0.0 @@ -0,0 +1 @@ +Subproject commit 8e4fa3bcb009da4dc78e334357df2066a89d42f7 diff --git a/stips/instruments/instrument.py b/stips/instruments/instrument.py index 8cf8ae4..3641499 100755 --- a/stips/instruments/instrument.py +++ b/stips/instruments/instrument.py @@ -18,11 +18,7 @@ # Local Modules from ..stellar_module import StarGenerator from ..astro_image import AstroImage -from ..utilities import GetStipsData -from ..utilities import OffsetPosition -from ..utilities import SelectParameter -from ..utilities import get_pandeia_background -from ..utilities import StipsDataTable +from ..utilities import GetStipsData, OffsetPosition, SelectParameter, get_pandeia_background, StipsDataTable from ..utilities.makePSF import PSF_GRID_SIZE class Instrument(object): diff --git a/stips/instruments/wfi.py b/stips/instruments/wfi.py index 529f19a..f44712e 100755 --- a/stips/instruments/wfi.py +++ b/stips/instruments/wfi.py @@ -1,13 +1,12 @@ __filetype__ = "detector" # Local Modules -from .roman_instrument import RomanInstrument -from astropy.constants import c from astropy import units as u +from astropy.coordinates import SkyCoord, ICRS +from .roman_instrument import RomanInstrument from soc_roman_tools.siaf import siaf import numpy as np -from astropy.coordinates import SkyCoord, ICRS -import astropy.units as u + class WFI(RomanInstrument): __classtype__ = "detector" @@ -34,10 +33,10 @@ def __init__(self, **kwargs): self.SCALE = [0.11, 0.11] # Assume for now self.FILTERS = ('F062', 'F087', 'F106', 'F129', 'F158', 'F184', 'F146') self.DEFAULT_FILTER = 'F184' # Assume for now - self.SCA_ROTATION = -60 # Rotation of SCA with respect to SIAF + self.SCA_ROTATION = -60 # Rotation of SCA with respect to SIAF # Get RA and DEC that will be used for detector offset calculations - RA = kwargs.get('ra', 0) + # RA = kwargs.get('ra', 0) DEC = kwargs.get('dec', 0) # Calculate the detector offsets based on the Roman SIAF file from soc_roman_tools @@ -48,9 +47,10 @@ def __init__(self, **kwargs): rsiaf = siaf.RomanSiaf() # Make array of SCA's - self.SCA_NAMES = ["WFI01_FULL", "WFI02_FULL", "WFI03_FULL", "WFI04_FULL", "WFI05_FULL", "WFI06_FULL", - "WFI07_FULL", "WFI08_FULL", "WFI09_FULL", "WFI10_FULL", "WFI11_FULL", "WFI12_FULL", - "WFI13_FULL", "WFI14_FULL", "WFI15_FULL", "WFI16_FULL", "WFI17_FULL", "WFI18_FULL"] + self.SCA_NAMES = ["WFI01_FULL", "WFI02_FULL", "WFI03_FULL", "WFI04_FULL", "WFI05_FULL", + "WFI06_FULL", "WFI07_FULL", "WFI08_FULL", "WFI09_FULL", "WFI10_FULL", + "WFI11_FULL", "WFI12_FULL", "WFI13_FULL", "WFI14_FULL", "WFI15_FULL", + "WFI16_FULL", "WFI17_FULL", "WFI18_FULL"] # Default detector offsets in (arcseconds_ra,arcseconds_dec,degrees_angle) self.DETECTOR_OFFSETS = [# SCA01 SCA02 SCA03 @@ -68,7 +68,8 @@ def __init__(self, **kwargs): # Reference point s01 = rsiaf['WFI01_FULL'].sci_to_tel(self.DETECTOR_SIZE[0] / 2, self.DETECTOR_SIZE[1] / 2) - center = SkyCoord(s01[0] * u.arcsec, s01[1] * u.arcsec).skyoffset_frame(self.SCA_ROTATION * u.deg) + center = SkyCoord(s01[0] * u.arcsec, + s01[1] * u.arcsec).skyoffset_frame(self.SCA_ROTATION * u.deg) for i, sca in enumerate(self.SCA_NAMES): # Get V2, V3 coordinate pair in the telescope frame at the center of the SCA @@ -84,12 +85,15 @@ def __init__(self, **kwargs): self.OFFSET_NAMES = ("SCA01", "SCA02", "SCA03", "SCA04", "SCA05", "SCA06", "SCA07", "SCA08", "SCA09", "SCA10", "SCA11", "SCA12", "SCA13", "SCA14", "SCA15", "SCA16", "SCA17", "SCA18") - self.N_OFFSET = {1: self.DETECTOR_OFFSETS[ 0], 2: self.DETECTOR_OFFSETS[ 1], 3: self.DETECTOR_OFFSETS[ 2], - 4: self.DETECTOR_OFFSETS[ 3], 5: self.DETECTOR_OFFSETS[ 4], 6: self.DETECTOR_OFFSETS[ 5], - 7: self.DETECTOR_OFFSETS[ 6], 8: self.DETECTOR_OFFSETS[ 7], 9: self.DETECTOR_OFFSETS[ 8], - 10: self.DETECTOR_OFFSETS[ 9], 11: self.DETECTOR_OFFSETS[10], 12: self.DETECTOR_OFFSETS[11], - 13: self.DETECTOR_OFFSETS[12], 14: self.DETECTOR_OFFSETS[13], 15: self.DETECTOR_OFFSETS[14], - 16: self.DETECTOR_OFFSETS[15], 17: self.DETECTOR_OFFSETS[16], 18: self.DETECTOR_OFFSETS[17]} + self.N_OFFSET = {1: self.DETECTOR_OFFSETS[0], 2: self.DETECTOR_OFFSETS[1], + 3: self.DETECTOR_OFFSETS[2], 4: self.DETECTOR_OFFSETS[3], + 5: self.DETECTOR_OFFSETS[4], 6: self.DETECTOR_OFFSETS[5], + 7: self.DETECTOR_OFFSETS[6], 8: self.DETECTOR_OFFSETS[7], + 9: self.DETECTOR_OFFSETS[8], 10: self.DETECTOR_OFFSETS[9], + 11: self.DETECTOR_OFFSETS[10], 12: self.DETECTOR_OFFSETS[11], + 13: self.DETECTOR_OFFSETS[12], 14: self.DETECTOR_OFFSETS[13], + 15: self.DETECTOR_OFFSETS[14], 16: self.DETECTOR_OFFSETS[15], + 17: self.DETECTOR_OFFSETS[16], 18: self.DETECTOR_OFFSETS[17]} # This is a set of offsets derived from "WFIRST-STSCI-TR1506A" # Further, it assumes no rotation or imperfection (see ASCII diagrams). @@ -126,20 +130,25 @@ def __init__(self, **kwargs): self.DARKFILE = 'err_rdrk_wfi.fits' # IREF, IHB (use for the moment) # Background Values - self.BACKGROUND = {'none': {'F062': 0., 'F087': 0., 'F106': 0., 'F129': 0., 'F158': 0., 'F184': 0., 'F146': 0.}, + self.BACKGROUND = {'none': {'F062': 0., 'F087': 0., 'F106': 0., + 'F129': 0., 'F158': 0., 'F184': 0., 'F146': 0.}, 'avg': {'F062': 1.401E+00, 'F087': 1.401E+00, 'F106': 1.401E+00, 'F129': 7.000E-01, 'F158': 7.521E-01, 'F184': 8.500E-01, 'F146': 7.000E-01}} self.BACKGROUNDS_V = ['none', 'avg', 'med', 'max', 'min'] - self.BACKGROUNDS = ['None', 'Average zodiacal background', 'Median zodiacal background', 'Maximum zodiacal background', 'Minimum zodiacal background'] + self.BACKGROUNDS = ['None', 'Average zodiacal background', 'Median zodiacal background', + 'Maximum zodiacal background', 'Minimum zodiacal background'] self.BGTEXT = {'none': 'None', 'avg': 'Average zodiacal background', 'med': 'Median zodiacal background', 'max': 'Maximum zodiacal background', - 'min': 'Minimum zodiacal background', 'custom': 'Custom thermal background rate', 'pandeia': 'Pandeia background rate'} + 'min': 'Minimum zodiacal background', 'custom': 'Custom thermal background rate', + 'pandeia': 'Pandeia background rate'} # PHOTFNU has units of Jy # For now, just assuming similar PHOTFNU to WFC3IR. # For now, just put them in the middle - self.PHOTPLAM = {'F062': 0.620, 'F087': 0.869, 'F106': 1.060, 'F129': 1.293, 'F158': 1.577, 'F184': 1.842, 'F146': 1.464} + self.PHOTPLAM = {'F062': 0.620, 'F087': 0.869, 'F106': 1.060, 'F129': 1.293, + 'F158': 1.577, 'F184': 1.842, 'F146': 1.464} - self.ZEROPOINTS_AB = {'F062': 26.73, 'F087': 26.39, 'F106': 26.41, 'F129': 26.43, 'F158': 26.47, 'F184': 26.08, 'F146': 27.66} + self.ZEROPOINTS_AB = {'F062': 26.73, 'F087': 26.39, 'F106': 26.41, 'F129': 26.43, + 'F158': 26.47, 'F184': 26.08, 'F146': 27.66} self.PHOTFNU = {} for i in self.ZEROPOINTS_AB: self.PHOTFNU[i] = 10 ** (0.4 * (8.9 - self.ZEROPOINTS_AB[i])) @@ -161,7 +170,8 @@ def __init__(self, **kwargs): "BLOB": ["NONE", "LINE", "LINE-3PT", "BOX-MIN"] } self.DITHER_OFFSETS = { - "BOX-UVIS": [(-11.071, -17.744), (11.947, -17.457), (11.071, 17.744), (-11.947, 17.457)], + "BOX-UVIS": [(-11.071, -17.744), (11.947, -17.457), + (11.071, 17.744), (-11.947, 17.457)], "BLOB": [(-1.930, -1.729), (1.930, 1.729)], "SUBPIXEL": { "NONE": [(0.000, 0.000)], diff --git a/stips/utilities/__init__.py b/stips/utilities/__init__.py index ee23978..c6c3d0f 100755 --- a/stips/utilities/__init__.py +++ b/stips/utilities/__init__.py @@ -1,17 +1,17 @@ __all__ = ['utilities'] # Local Definitions -from .utilities import StipsEnvironment -from .utilities import SetupDataPaths -from .utilities import DownloadReferenceData -from .utilities import GetStipsDataDir -from .utilities import GetStipsData -from .utilities import SelectParameter -from .utilities import OffsetPosition -from .utilities import InstrumentList -from .utilities import read_metadata -from .utilities import read_table -from .utilities import rind -from .utilities import sersic_lum -from .utilities import get_pandeia_background -from .DataTable import StipsDataTable +from .utilities import (StipsEnvironment, + SetupDataPaths, + DownloadReferenceData, + GetStipsDataDir, + GetStipsData, + SelectParameter, + OffsetPosition, + InstrumentList, + read_metadata, + read_table, + rind, + sersic_lum, + get_pandeia_background, + StipsDataTable) diff --git a/stips/utilities/tests/test_makePSF.py b/stips/utilities/tests/test_makePSF.py index 971d087..26c71ae 100755 --- a/stips/utilities/tests/test_makePSF.py +++ b/stips/utilities/tests/test_makePSF.py @@ -1,25 +1,24 @@ -import os, pytest -import numpy as np -from scipy import ndimage from astropy.io import fits -from astropy import table +from scipy import ndimage from stips.utilities import makePSF - from stips.utilities.utilities import StipsEnvironment +import numpy as np +import os +import pytest stips_version = StipsEnvironment.__stips__version__ -#Basic carryover constants from the original makePSF file -#This will save time in later calculations +# Basic carryover constants from the original makePSF file +# This will save time in later calculations -IPC = np.array([[ 0.21, 1.62, 0.2 ], - [ 1.88, 91.59, 1.87], - [ 0.21, 1.66, 0.22]]) / 100.0 +IPC = np.array([[0.21, 1.62, 0.2], + [1.88, 91.59, 1.87], + [0.21, 1.66, 0.22]]) / 100.0 -EPSF4 = np.array([[0.25, 0.5 , 0.5 , 0.5 , 0.25], - [0.5 , 1. , 1. , 1. , 0.5 ], - [0.5 , 1. , 1. , 1. , 0.5 ], - [0.5 , 1. , 1. , 1. , 0.5 ], - [0.25, 0.5 , 0.5 , 0.5 , 0.25]]) +EPSF4 = np.array([[0.25, 0.5, 0.5, 0.5, 0.25], + [0.5, 1., 1., 1., 0.5], + [0.5, 1., 1., 1., 0.5], + [0.5, 1., 1., 1., 0.5], + [0.25, 0.5, 0.5, 0.5, 0.25]]) PSF_UPSCALE = 4 @@ -29,179 +28,187 @@ PSF_GRID_SIZE = 3 -#Rounding (just a modification to stop potential future issues) -rind = lambda x : np.round(x).astype(int) +# Rounding (just a modification to stop potential future issues) +def rind(x): + return np.round(x).astype(int) + -#Import the .fits PSF file, which will be the test PSF against which we can run all comparative tests -#Select the part of the data we'll use to construct the test PSF +# Import the .fits PSF file, which will be the test PSF against which we can run all +# comparative tests and select the part of the data we'll use to construct the test PSF file_dir = os.path.dirname(os.path.abspath(__file__)) data_dir = os.path.join(file_dir, "..", "..", "data", "psf_WFI_2.0.0_F129_sca01.fits") file = fits.open(data_dir) file_in = file[0].data[0] -#Generate the test PSF using the make_epsf function from makePSF -#We can now use this basic PSF as a comparative standard against which to check the makePSF code +# Generate the test PSF using the make_epsf function from makePSF +# We can now use this basic PSF as a comparative standard against which to check the makePSF code test_psf = makePSF.make_epsf(file[0].data[0]) -#Set a few basic variables for use in testing the bicubic function of makePSF +# Set a few basic variables for use in testing the bicubic function of makePSF ix = 1 iy = 2 fx = 0.25 fy = 0.75 -#Generate both a bicubic interpolation (to see fractional light output) from the bicubic function, -#and a fractional light output from the real_psf function -#These will both be used in later tests –– it's more efficent to generate them here +# Generate both a bicubic interpolation (to see fractional light output) from the bicubic function, +# and a fractional light output from the real_psf function +# These will both be used in later tests –– it's more efficent to generate them here test_phot = makePSF.bicubic(test_psf, iy, ix, fx, fy) -test_rpsf_phot = makePSF.real_psf(10, 15, test_psf, psf_center=88, boxsize=PSF_EXTRA_BRIGHT_BOXSIZE) +test_rpsf_phot = makePSF.real_psf(10, 15, test_psf, + psf_center=88, boxsize=PSF_EXTRA_BRIGHT_BOXSIZE) -#First, testing the basic calculations of the make_epsf function def test_make_epsf_calcs(): - #Running the individual steps of make_epsf, starting with setting the shape of the array. - #Empty the array to fill later - + # Running the individual steps of make_epsf, starting with setting the shape of the array. + # Empty the array to fill later psf_test_mid = np.zeros_like(file_in) - #Assuming the PSF is square - + # Assuming the PSF is square size_test = file_in.shape[0] - #Convolce the input file with the EPSF4 array - + # Convolve the input file with the EPSF4 array psf_test_mid = ndimage.convolve(file_in, EPSF4, mode='constant', cval=0.0) - #Rather than indvidually checking each calculation against the value generated by make_epsf, - #we nstead run a check on a randomly selected set of the values generated. - #This way, we can test a sample set of the calculations, without overburdening the test by checking all of them. + # Rather than indvidually checking each calculation against the value generated by make_epsf, + # we nstead run a check on a randomly selected set of the values generated. + # This way, we can test a sample set of the calculations, + # without overburdening the test by checking all of them. - #First, apply the correct scaling to the rows and columns + # First, apply the correct scaling to the rows and columns - psf_test_mid[0:size_test,0] = file_in[0:size_test,0]*16.0 + psf_test_mid[0:size_test, 0] = file_in[0:size_test, 0]*16.0 - psf_test_mid[0:size_test,size_test-2]=file_in[0:size_test,size_test-2]*16. + psf_test_mid[0:size_test, size_test - 2] = file_in[0:size_test, size_test - 2] * 16. - psf_test_mid[1,3:(size_test-PSF_UPSCALE)+1]=file_in[1,3:(size_test-PSF_UPSCALE)+1]*16.0 + psf_test_mid[1, 3:(size_test - PSF_UPSCALE) + 1] = \ + file_in[1, 3:(size_test - PSF_UPSCALE) + 1] * 16.0 - psf_test_mid[size_test-2,3:(size_test-PSF_UPSCALE)+1]=file_in[size_test-2,3:(size_test-PSF_UPSCALE)+1]*16.0 + psf_test_mid[size_test - 2, 3:(size_test - PSF_UPSCALE) + 1] = \ + file_in[size_test - 2, 3:(size_test - PSF_UPSCALE) + 1] * 16.0 - #Empty the array + # Empty the array psf_test_out = np.zeros_like(file_in) - #Run the final calculations for the pixels in the PSF image + # Run the final calculations for the pixels in the PSF image x_range = range(PSF_UPSCALE, size_test-PSF_UPSCALE-1) y_range = range(PSF_UPSCALE, size_test-PSF_UPSCALE-1) - #Add the IPC to the output PSF + # Add the IPC to the output PSF for idx in x_range: for idy in y_range: pcen = psf_test_mid[idy, idx] - psf_test_out[idy-PSF_UPSCALE,idx-PSF_UPSCALE] += pcen*IPC[0,0] - psf_test_out[idy-PSF_UPSCALE, idx] += pcen*IPC[0,1] - psf_test_out[idy-PSF_UPSCALE,idx+PSF_UPSCALE] += pcen*IPC[0,2] + psf_test_out[idy-PSF_UPSCALE, idx-PSF_UPSCALE] += pcen*IPC[0, 0] + psf_test_out[idy-PSF_UPSCALE, idx] += pcen*IPC[0, 1] + psf_test_out[idy-PSF_UPSCALE, idx+PSF_UPSCALE] += pcen*IPC[0, 2] - psf_test_out[idy ,idx-PSF_UPSCALE] += pcen*IPC[1,0] - psf_test_out[idy , idx] += pcen*IPC[1,1] - psf_test_out[idy ,idx+PSF_UPSCALE] += pcen*IPC[1,2] + psf_test_out[idy, idx-PSF_UPSCALE] += pcen*IPC[1, 0] + psf_test_out[idy, idx] += pcen*IPC[1, 1] + psf_test_out[idy, idx+PSF_UPSCALE] += pcen*IPC[1, 2] - psf_test_out[idy+PSF_UPSCALE,idx-PSF_UPSCALE] += pcen*IPC[2,0] - psf_test_out[idy+PSF_UPSCALE, idx] += pcen*IPC[2,1] - psf_test_out[idy+PSF_UPSCALE,idx+PSF_UPSCALE] += pcen*IPC[2,2] + psf_test_out[idy+PSF_UPSCALE, idx-PSF_UPSCALE] += pcen*IPC[2, 0] + psf_test_out[idy+PSF_UPSCALE, idx] += pcen*IPC[2, 1] + psf_test_out[idy+PSF_UPSCALE, idx+PSF_UPSCALE] += pcen*IPC[2, 2] + # Check the generated values at the selected points against the values in the test psf, + # generate previously via make_epsf. - #Check the generated values at the selected points against the values in the test psf, generate previously via make_epsf. + np.testing.assert_allclose(test_psf[0:size_test, 0], psf_test_out[0:size_test, 0]) - np.testing.assert_allclose(test_psf[0:size_test, 0], psf_test_out[0:size_test, 0]) + np.testing.assert_allclose(test_psf[0:size_test, size_test-2], + psf_test_out[0:size_test, size_test-2]) - np.testing.assert_allclose(test_psf[0:size_test,size_test-2], psf_test_out[0:size_test,size_test-2]) + np.testing.assert_allclose(test_psf[1, 3:(size_test-PSF_UPSCALE)+1], + psf_test_out[1, 3:(size_test-PSF_UPSCALE)+1]) - np.testing.assert_allclose(test_psf[1 ,3:(size_test-PSF_UPSCALE)+1], psf_test_out[1 ,3:(size_test-PSF_UPSCALE)+1]) + np.testing.assert_allclose(test_psf[size_test-2, 3:(size_test-PSF_UPSCALE)+1], + psf_test_out[size_test-2, 3:(size_test-PSF_UPSCALE)+1]) - np.testing.assert_allclose(test_psf[size_test-2,3:(size_test-PSF_UPSCALE)+1], psf_test_out[size_test-2,3:(size_test-PSF_UPSCALE)+1]) def test_bicubic(): - #Run the calculations of the bicubic function "manually". + # Run the calculations of the bicubic function "manually". - A1 = test_psf[2,1] - B1 = (test_psf[2,2]-test_psf[2,0])/2 - C1 = (test_psf[3,1]-test_psf[1,1])/2 - D1 = (test_psf[2,2]+test_psf[2,0]-2*A1)/2 - E1 = (test_psf[3,2]-A1) - F1 = (test_psf[3,1]+test_psf[1,1]-2*A1)/2 + A1 = test_psf[2, 1] + B1 = (test_psf[2, 2]-test_psf[2, 0])/2 + C1 = (test_psf[3, 1]-test_psf[1, 1])/2 + D1 = (test_psf[2, 2]+test_psf[2, 0]-2*A1)/2 + E1 = (test_psf[3, 2]-A1) + F1 = (test_psf[3, 1]+test_psf[1, 1]-2*A1)/2 V1 = (A1 - + B1*(fx) - + C1*(fy) - + D1*(fx)**2 - + E1*(fx)*(fy) - + F1*(fy)**2) + + B1*(fx) + + C1*(fy) + + D1*(fx)**2 + + E1*(fx)*(fy) + + F1*(fy)**2) # Lower Right Value - A2 = test_psf[2,2] - B2 = (test_psf[2,3]-test_psf[2,1])/2 - C2 = (test_psf[3,2]-test_psf[1,2])/2 - D2 = (test_psf[2,3]+test_psf[2,1]-2*A2)/2 - E2 =-(test_psf[3,1]-A2) - F2 = (test_psf[3,2]+test_psf[1,2]-2*A2)/2 + A2 = test_psf[2, 2] + B2 = (test_psf[2, 3]-test_psf[2, 1])/2 + C2 = (test_psf[3, 2]-test_psf[1, 2])/2 + D2 = (test_psf[2, 3]+test_psf[2, 1]-2*A2)/2 + E2 = -(test_psf[3, 1]-A2) + F2 = (test_psf[3, 2]+test_psf[1, 2]-2*A2)/2 V2 = (A2 - + B2*(fx-1) - + C2*(fy) - + D2*(fx-1)**2 - + E2*(fx-1)*(fy) - + F2*(fy)**2) + + B2*(fx-1) + + C2*(fy) + + D2*(fx-1)**2 + + E2*(fx-1)*(fy) + + F2*(fy)**2) # Upper Left Value - A3 = test_psf[3,1] - B3 = (test_psf[3,2]-test_psf[3,0])/2 - C3 = (test_psf[4,1]-test_psf[2,1])/2 - D3 = (test_psf[3,2]+test_psf[3,0]-2*A3)/2 - E3 =-(test_psf[2,2]-A3) - F3 = (test_psf[4,1]+test_psf[2,1]-2*A3)/2 + A3 = test_psf[3, 1] + B3 = (test_psf[3, 2]-test_psf[3, 0])/2 + C3 = (test_psf[4, 1]-test_psf[2, 1])/2 + D3 = (test_psf[3, 2]+test_psf[3, 0]-2*A3)/2 + E3 = -(test_psf[2, 2]-A3) + F3 = (test_psf[4, 1]+test_psf[2, 1]-2*A3)/2 V3 = (A3 - + B3*(fx) - + C3*(fy-1) - + D3*(fx)**2 - + E3*(fx)*(fy-1) - + F3*(fy-1)**2) + + B3*(fx) + + C3*(fy-1) + + D3*(fx)**2 + + E3*(fx)*(fy-1) + + F3*(fy-1)**2) # Upper Right Value - A4 = test_psf[3,2] - B4 = (test_psf[3,3]-test_psf[3,1])/2 - C4 = (test_psf[4,2]-test_psf[2,2])/2 - D4 = (test_psf[3,3]+test_psf[3,1]-2*A4)/2 - E4 = (test_psf[2,1]-A4) - F4 = (test_psf[4,2]+test_psf[2,2]-2*A4)/2 + A4 = test_psf[3, 2] + B4 = (test_psf[3, 3]-test_psf[3, 1])/2 + C4 = (test_psf[4, 2]-test_psf[2, 2])/2 + D4 = (test_psf[3, 3]+test_psf[3, 1]-2*A4)/2 + E4 = (test_psf[2, 1]-A4) + F4 = (test_psf[4, 2]+test_psf[2, 2]-2*A4)/2 V4 = (A4 - + B4*(fx-1) - + C4*(fy-1) - + D4*(fx-1)**2 - + E4*(fx-1)*(fy-1) - + F4*(fy-1)**2) + + B4*(fx-1) + + C4*(fy-1) + + D4*(fx-1)**2 + + E4*(fx-1)*(fy-1) + + F4*(fy-1)**2) check_phot = ((1-fx)*(1-fy)*V1 - + (fx)*(1-fy)*V2 - + (1-fx)*(fy)*V3 - + (fx)*(fy)*V4) + + (fx)*(1-fy)*V2 + + (1-fx)*(fy)*V3 + + (fx)*(fy)*V4) - #Check this calculated value against the value generated previously by the bicubic function. + # Check this calculated value against the value generated previously by the bicubic function. np.testing.assert_allclose(test_phot, check_phot) + def test_real_psf(): - #"Manually" run the calculations for the real_psf function, using some preset variables to check against - #These same variables (dx = 10 and dy = 15) were used to generate the test value from real_psf previously. + # "Manually" run the calculations for the real_psf function, using some preset + # variables to check against these same variables (dx = 10 and dy = 15) were used + # to generate the test value from real_psf previously. dx = 10 dy = 15 @@ -210,128 +217,136 @@ def test_real_psf(): ry = 88 + 15*4 ix_rpsf = int(rx) iy_rpsf = int(ry) - fx_rpsf = rx-ix_rpsf # Pixel Phase - fy_rpsf = ry-iy_rpsf # Pixel Phase + fx_rpsf = rx-ix_rpsf # Pixel Phase + fy_rpsf = ry-iy_rpsf # Pixel Phase dd = np.sqrt(dx**2+dy**2) - check_rpsf_phot = ((1-fx_rpsf)*(1-fy_rpsf)*test_psf[iy_rpsf,ix_rpsf] - + (fx_rpsf)*(1-fy_rpsf)*test_psf[iy_rpsf,ix_rpsf+1] - + (1-fx_rpsf)*(fy_rpsf)*test_psf[iy_rpsf+1,ix_rpsf] - + (fx_rpsf)*(fy_rpsf)*test_psf[iy_rpsf+1,ix_rpsf+1]) + check_rpsf_phot = ((1-fx_rpsf)*(1-fy_rpsf)*test_psf[iy_rpsf, ix_rpsf] + + (fx_rpsf)*(1-fy_rpsf)*test_psf[iy_rpsf, ix_rpsf+1] + + (1-fx_rpsf)*(fy_rpsf)*test_psf[iy_rpsf+1, ix_rpsf] + + (fx_rpsf)*(fy_rpsf)*test_psf[iy_rpsf+1, ix_rpsf+1]) - #Check the "manually" calculated value against the value generated by real_psf. + # Check the "manually" calculated value against the value generated by real_psf. np.testing.assert_allclose(test_rpsf_phot, check_rpsf_phot) + def test_place_source(): - #Place a test source in a blank image, to ensure that this doesn't throw any exceptions. - #Just a check to make sure the function runs with no issues. + # Place a test source in a blank image, to ensure that this doesn't throw any exceptions. + # Just a check to make sure the function runs with no issues. - image = np.zeros(shape=[512,512, 3], dtype=np.float64) + image = np.zeros(shape=[512, 512, 3], dtype=np.float64) psf_middle = rind((test_psf[0].shape[0]-1)/2) PSF_BOXSIZE = np.floor(psf_middle)/PSF_UPSCALE - test_placement = makePSF.place_source(250, 250, 15, image, test_psf, boxsize=PSF_BOXSIZE, psf_center=psf_middle) + test_placement = makePSF.place_source(250, 250, 15, image, test_psf, + boxsize=PSF_BOXSIZE, psf_center=psf_middle) + def test_interpolate(): - #This test is designed to test interpolations of input ePSFs in each quadrant - #to ensure the calculations for each quadrant run correctly. + # This test is designed to test interpolations of input ePSFs in each quadrant + # to ensure the calculations for each quadrant run correctly. - #Get image size read in from test_psf + # Get image size read in from test_psf image_size = file_in.shape[0] half_image = round(image_size/2) - #Generate a psf_array –– for simplicity, we set the array as test_psf three times + # Generate a psf_array –– for simplicity, we set the array as test_psf three times test_psf_array = [test_psf, test_psf, test_psf] - #Lower Left Quadrant + # Lower Left Quadrant - #Set location to the lower left quadrant + # Set location to the lower left quadrant xpix_ll = 68 ypix_ll = 68 - #Run interpolate_epsf using the test psf array, the set image size, and the specified coordinates for this quadrant. + # Run interpolate_epsf using the test psf array, the set image size, and the + # specified coordinates for this quadrant. interp_epsf_ll = makePSF.interpolate_epsf(xpix_ll, ypix_ll, test_psf_array, image_size) - #"Manually" run the calculations of the interpolate_epsf function. + # "Manually" run the calculations of the interpolate_epsf function. - xf_ll =((xpix_ll+4)/(half_image+4)) - yf_ll =((ypix_ll+4)/(half_image+4)) - check_interp_ll=(xf_ll*yf_ll*test_psf_array[1][1]+ - (1-xf_ll)*(1-yf_ll)*test_psf_array[0][0]+ - (xf_ll)*(1-yf_ll)*test_psf_array[1][0]+ - (1-xf_ll)*(yf_ll)*test_psf_array[0][1]) + xf_ll = ((xpix_ll + 4) / (half_image + 4)) + yf_ll = ((ypix_ll + 4) / (half_image + 4)) + check_interp_ll = (xf_ll * yf_ll * test_psf_array[1][1] + + (1 - xf_ll) * (1 - yf_ll) * test_psf_array[0][0] + + (xf_ll) * (1 - yf_ll) * test_psf_array[1][0] + + (1 - xf_ll) * (yf_ll) * test_psf_array[0][1]) - #Upper Left Quadrant + # Upper Left Quadrant - #Set location to upper left quadrant + # Set location to upper left quadrant xpix_ul = 68 ypix_ul = 108 - #Run interpolate_epsf using the test psf array, the set image size, and the specified coordinates for this quadrant. + # Run interpolate_epsf using the test psf array, the set image size, and the + # specified coordinates for this quadrant. interp_epsf_ul = makePSF.interpolate_epsf(xpix_ul, ypix_ul, test_psf_array, image_size) - #"Manually" run the calculations of the interpolate_epsf function. + # "Manually" run the calculations of the interpolate_epsf function. - xf_ul =((xpix_ul+4)/(half_image+4)) - yf_ul =((ypix_ul+4-(half_image+4))/(half_image+4)) - check_interp_ul=(xf_ul*yf_ul*test_psf_array[1][2]+ - (1-xf_ul)*(1-yf_ul)*test_psf_array[0][1]+ - (xf_ul)*(1-yf_ul)*test_psf_array[1][1]+ - (1-xf_ul)*(yf_ul)*test_psf_array[0][2]) + xf_ul = ((xpix_ul + 4) / (half_image + 4)) + yf_ul = ((ypix_ul + 4 - (half_image + 4)) / (half_image + 4)) + check_interp_ul = (xf_ul * yf_ul * test_psf_array[1][2] + + (1 - xf_ul) * (1 - yf_ul) * test_psf_array[0][1] + + (xf_ul) * (1 - yf_ul) * test_psf_array[1][1] + + (1 - xf_ul) * (yf_ul) * test_psf_array[0][2]) - #Lower Right Quadrant + # Lower Right Quadrant - #Set location to lower right quadrant + # Set location to lower right quadrant xpix_lr = 108 ypix_lr = 68 - #Run interpolate_epsf using the test psf array, the set image size, and the specified coordinates for this quadrant. + # Run interpolate_epsf using the test psf array, the set image size, + # and the specified coordinates for this quadrant. interp_epsf_lr = makePSF.interpolate_epsf(xpix_lr, ypix_lr, test_psf_array, image_size) - #"Manually" run the calculations of the interpolate_epsf function. + # "Manually" run the calculations of the interpolate_epsf function. - xf_lr =((xpix_lr+4-(half_image+4))/(half_image+4)) - yf_lr =((ypix_lr+4)/(half_image+4)) - check_interp_lr=(xf_lr*yf_lr*test_psf_array[2][1]+ - (1-xf_lr)*(1-yf_lr)*test_psf_array[1][0]+ - (xf_lr)*(1-yf_lr)*test_psf_array[2][0]+ - (1-xf_lr)*(yf_lr)*test_psf_array[1][1]) + xf_lr = ((xpix_lr + 4 - (half_image + 4)) / (half_image + 4)) + yf_lr = ((ypix_lr + 4) / (half_image + 4)) + check_interp_lr = (xf_lr * yf_lr * test_psf_array[2][1] + + (1-xf_lr) * (1-yf_lr) * test_psf_array[1][0] + + (xf_lr) * (1-yf_lr) * test_psf_array[2][0] + + (1-xf_lr) * (yf_lr) * test_psf_array[1][1]) - #Upper Right Quadrant + # Upper Right Quadrant - #Set location to upper right quadrant. + # Set location to upper right quadrant. xpix_ur = 108 ypix_ur = 108 - #Run interpolate_epsf using the test psf array, the set image size, and the specified coordinates for this quadrant. + # Run interpolate_epsf using the test psf array, the set image size, + # and the specified coordinates for this quadrant. interp_epsf_ur = makePSF.interpolate_epsf(xpix_ur, ypix_ur, test_psf_array, image_size) - #"Manually" run the calculations of the interpolate_epsf function. + # "Manually" run the calculations of the interpolate_epsf function. - xf_ur =((xpix_ur+4-(half_image+4))/(half_image+4)) - yf_ur =((ypix_ur+4-(half_image+4))/(half_image+4)) - check_interp_ur=(xf_ur*yf_ur *test_psf_array[2][2]+ - (1-xf_ur)*(1-yf_ur)*test_psf_array[1][1]+ - (xf_ur)*(1-yf_ur)*test_psf_array[2][1]+ - (1-xf_ur)*(yf_ur)*test_psf_array[1][2]) + xf_ur = ((xpix_ur + 4 - (half_image + 4)) / (half_image + 4)) + yf_ur = ((ypix_ur + 4 - (half_image + 4)) / (half_image + 4)) + check_interp_ur = (xf_ur * yf_ur * test_psf_array[2][2] + + (1-xf_ur) * (1-yf_ur) * test_psf_array[1][1] + + (xf_ur) * (1-yf_ur) * test_psf_array[2][1] + + (1-xf_ur)*(yf_ur)*test_psf_array[1][2]) - #Check that each interpolation in each qudrant generated by interpolate_epsf matches the check value. + # Check that each interpolation in each qudrant generated by + # interpolate_epsf matches the check value. np.testing.assert_allclose(interp_epsf_ll, check_interp_ll, atol=0.001)