From 5e857122e062d942b8df2fdaa62eb4fcd422a66b Mon Sep 17 00:00:00 2001 From: ojustino Date: Mon, 5 Dec 2022 10:14:39 -0500 Subject: [PATCH] Update image handling in notebooks --- CHANGES.rst | 4 ++-- .../jwst_boxcar/boxcar_extraction.ipynb | 19 ++++++------------- notebook_sandbox/tracing_options.ipynb | 13 +++---------- 3 files changed, 11 insertions(+), 25 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 8f7923a4..377c6983 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -19,10 +19,10 @@ API Changes - All operations now accept Spectrum1D and Quantity-type images. All accepted image types are now processed internally as Spectrum1D objects - [#144] + [#144, #154] - All operations' ``image`` attributes are now coerced Spectrum1D - objects [#144] + objects [#144, #154] Bug Fixes ^^^^^^^^^ diff --git a/notebook_sandbox/jwst_boxcar/boxcar_extraction.ipynb b/notebook_sandbox/jwst_boxcar/boxcar_extraction.ipynb index 35d9a806..0eed7855 100644 --- a/notebook_sandbox/jwst_boxcar/boxcar_extraction.ipynb +++ b/notebook_sandbox/jwst_boxcar/boxcar_extraction.ipynb @@ -90,7 +90,7 @@ "source": [ "# use a jwst datamodel to provide a good interface to the data and wcs info\n", "s2d = datamodels.open(s2dfile)\n", - "image = s2d.slits[0].data" + "image = np.array(s2d.slits[0].data)" ] }, { @@ -361,7 +361,7 @@ ], "source": [ "plt.figure(figsize=(15, 15))\n", - "plt.imshow(bg.bkg_wimage[::,0:100], origin=\"lower\")\n", + "plt.imshow(bg.bkg_wimage[::,0:100].data, origin=\"lower\")\n", "plt.title(\"slit[0] slice\")" ] }, @@ -395,7 +395,7 @@ ], "source": [ "plt.figure(figsize=(15, 15))\n", - "plt.imshow(bg.bkg_image(image)[::,0:100], norm=norm_data, origin=\"lower\")\n", + "plt.imshow(bg.bkg_image(image)[::,0:100].data, norm=norm_data, origin=\"lower\")\n", "plt.title(\"slit[0] slice\")" ] }, @@ -429,7 +429,7 @@ ], "source": [ "plt.figure(figsize=(15, 15))\n", - "plt.imshow(bg.sub_image(image)[::,0:100], norm=norm_data, origin=\"lower\")\n", + "plt.imshow(bg.sub_image(image)[::,0:100].data, norm=norm_data, origin=\"lower\")\n", "plt.title(\"slit[0] slice\")" ] }, @@ -471,7 +471,7 @@ "source": [ "bg_med = Background.two_sided(image, ext_center, bkg_sep, width=bkg_width, statistic='median')\n", "plt.figure(figsize=(15, 15))\n", - "plt.imshow(bg_med.bkg_wimage[::,0:100], origin=\"lower\")\n", + "plt.imshow(bg_med.bkg_wimage[::,0:100].data, origin=\"lower\")\n", "plt.title(\"slit[0] slice\")" ] }, @@ -548,7 +548,7 @@ "## About this notebook\n", "\n", "**Author:** Ivo Busko, JWST\n", - "**Updated On:** 2022-11-11" + "**Updated On:** 2022-12-05" ] }, { @@ -565,13 +565,6 @@ "[Top of Page](#top)\n", "\"Space " ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { diff --git a/notebook_sandbox/tracing_options.ipynb b/notebook_sandbox/tracing_options.ipynb index 9da87301..d119312a 100644 --- a/notebook_sandbox/tracing_options.ipynb +++ b/notebook_sandbox/tracing_options.ipynb @@ -71,7 +71,7 @@ "source": [ "# use a jwst datamodel to provide a good interface to the data and wcs info\n", "s2d = datamodels.open(s2dfile)\n", - "image = s2d.slits[0].data\n", + "image = np.array(s2d.slits[0].data)\n", "norm_data = simple_norm(image, \"sqrt\")" ] }, @@ -154,7 +154,7 @@ ], "source": [ "plt.figure(figsize=(15, 15))\n", - "plt.imshow(bg.sub_image(image), norm=norm_data, aspect=5, origin=\"lower\")\n", + "plt.imshow(bg.sub_image(image).data, norm=norm_data, aspect=5, origin=\"lower\")\n", "plt.plot(auto_trace_gauss.trace, color='r')\n", "plt.title(\"slit[0] slice\")" ] @@ -338,7 +338,7 @@ "## About this notebook\n", "\n", "**Author:** Kyle Conroy, JWST\n", - "**Updated On:** 2022-11-16" + "**Updated On:** 2022-12-05" ] }, { @@ -348,13 +348,6 @@ "[Top of Page](#top)\n", "\"Space " ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": {