Skip to content

Commit

Permalink
Merge pull request #154 from ojustino/notebook-img-parsing
Browse files Browse the repository at this point in the history
Update image handling in notebooks
  • Loading branch information
ojustino authored Dec 5, 2022
2 parents 6b2ffb0 + 5e85712 commit d33d892
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 25 deletions.
4 changes: 2 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
^^^^^^^^^
Expand Down
19 changes: 6 additions & 13 deletions notebook_sandbox/jwst_boxcar/boxcar_extraction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
]
},
{
Expand Down Expand Up @@ -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\")"
]
},
Expand Down Expand Up @@ -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\")"
]
},
Expand Down Expand Up @@ -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\")"
]
},
Expand Down Expand Up @@ -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\")"
]
},
Expand Down Expand Up @@ -548,7 +548,7 @@
"## About this notebook\n",
"\n",
"**Author:** Ivo Busko, JWST\n",
"**Updated On:** 2022-11-11"
"**Updated On:** 2022-12-05"
]
},
{
Expand All @@ -565,13 +565,6 @@
"[Top of Page](#top)\n",
"<img style=\"float: right;\" src=\"https://raw.githubusercontent.com/spacetelescope/notebooks/master/assets/stsci_pri_combo_mark_horizonal_white_bkgd.png\" alt=\"Space Telescope Logo\" width=\"200px\"/> "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
13 changes: 3 additions & 10 deletions notebook_sandbox/tracing_options.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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\")"
]
},
Expand Down Expand Up @@ -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\")"
]
Expand Down Expand Up @@ -338,7 +338,7 @@
"## About this notebook\n",
"\n",
"**Author:** Kyle Conroy, JWST\n",
"**Updated On:** 2022-11-16"
"**Updated On:** 2022-12-05"
]
},
{
Expand All @@ -348,13 +348,6 @@
"[Top of Page](#top)\n",
"<img style=\"float: right;\" src=\"https://raw.githubusercontent.com/spacetelescope/notebooks/master/assets/stsci_pri_combo_mark_horizonal_white_bkgd.png\" alt=\"Space Telescope Logo\" width=\"200px\"/> "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down

0 comments on commit d33d892

Please sign in to comment.