diff --git a/notebooks/cross_instrument/rgb_imviz/imviz_rgb_carina.ipynb b/notebooks/cross_instrument/rgb_imviz/imviz_rgb_carina.ipynb index 8ebba5dea..e7cfc865a 100644 --- a/notebooks/cross_instrument/rgb_imviz/imviz_rgb_carina.ipynb +++ b/notebooks/cross_instrument/rgb_imviz/imviz_rgb_carina.ipynb @@ -5,12 +5,12 @@ "id": "035a23fd", "metadata": {}, "source": [ - "# RGB images with Imviz\n", + "# RGB images with Jdaviz\n", "\n", - "**Use case**: create RGB images using Imviz programmatically.
\n", + "**Use case**: create RGB images using Jdaviz programmatically.
\n", "**Data**: Carina Nebula, NIRCam observations
\n", "**Tools**: jdaviz
\n", - "**Cross-intrument**: Any imager
\n", + "**Cross-instrument**: Any imager
\n", "**Documentation**: This notebook is part of a STScI's larger [post-pipeline Data Analysis Tools Ecosystem](https://jwst-docs.stsci.edu/jwst-post-pipeline-data-analysis).
\n", "\n", "For additional resources, please review our provided full example notebooks maintained in the Jdaviz repository: https://github.com/spacetelescope/jdaviz/tree/main/notebooks" @@ -33,9 +33,11 @@ "source": [ "import warnings\n", "\n", + "from time import sleep\n", + "\n", "from astroquery.mast import Observations\n", "\n", - "from jdaviz import Imviz\n", + "import jdaviz as jd\n", "\n", "from IPython.display import Image" ] @@ -45,19 +47,7 @@ "id": "aaf960cd", "metadata": {}, "source": [ - "## Download images and load Imviz\n", - "\n", - "We create an Imviz instance and grab the default viewer instance as well:" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "409eedc4", - "metadata": {}, - "outputs": [], - "source": [ - "imviz = Imviz()" + "## Download images and load data into the Jdaviz App\n" ] }, { @@ -73,7 +63,6 @@ "execution_count": null, "id": "7bddbc18", "metadata": { - "scrolled": true, "tags": [ "scroll-output" ] @@ -96,7 +85,7 @@ "id": "e6108b52", "metadata": {}, "source": [ - "And load into Imviz." + "And load into Jdaviz." ] }, { @@ -108,9 +97,9 @@ "source": [ "with warnings.catch_warnings():\n", " warnings.simplefilter('ignore')\n", - " with imviz.batch_load():\n", + " with jd.batch_load():\n", " for fn in files:\n", - " imviz.load(f'{data_dir}/{fn}', data_label=fn[31:36])" + " jd.load(f'{data_dir}/{fn}', format='Image', data_label=fn[31:36])" ] }, { @@ -118,7 +107,7 @@ "id": "8a4b2e1a", "metadata": {}, "source": [ - "Now, we can display Imviz." + "Now, we can display Jdaviz." ] }, { @@ -128,7 +117,7 @@ "metadata": {}, "outputs": [], "source": [ - "imviz.show()" + "jd.show()" ] }, { @@ -137,7 +126,7 @@ "metadata": {}, "source": [ "## Align by WCS\n", - "https://jdaviz.readthedocs.io/en/latest/imviz/plugins.html#orientation\n", + "https://jdaviz.readthedocs.io/en/latest/plugins/orientation.html\n", "\n", "The first thing you will probably notice is that the image doesn't take up the entire viewer area. If you press the \"b\" key to blink to the next image, you will see that this image is zoomed correctly by default. The odd default zoom on the other is because the images are linked by pixel when loaded. We can instead link by WCS (world coordinates) so that the images will be properly aligned." ] @@ -147,7 +136,7 @@ "id": "341145e7-e595-4a58-aab8-0e1e24c19c3d", "metadata": {}, "source": [ - "There are two ways to link in Imviz. Firstly, you can do it from within the UI through the Orientation plugin by selecting \"WCS\". Either open the plugin tray to the right and search for \"Orientation\", or execute the following cell to open it automatically:" + "There are two ways to link in Jdaviz. Firstly, you can do it from within the UI through the Orientation plugin by selecting \"WCS\". Either open the plugin tray to the left and search for \"Orientation\", or execute the following cell to open it automatically:" ] }, { @@ -155,7 +144,7 @@ "id": "19216180-6a20-44cd-a384-981431eb6a3f", "metadata": {}, "source": [ - "imviz.plugins['Orientation'].open_in_tray()" + "jd.plugins['Orientation'].open_in_tray()" ] }, { @@ -163,7 +152,7 @@ "id": "75367551", "metadata": {}, "source": [ - "You can also set the link type from the API using the Imviz Helper:" + "You can also set the link type from the API using the Jdaviz Helper:" ] }, { @@ -173,8 +162,13 @@ "metadata": {}, "outputs": [], "source": [ + "\n", + "# If running cells in rapid succession, this cell may fail.\n", + "# We add a slight pause before aligning the images to avoid this.\n", + "sleep(1)\n", + "\n", "# Link images by WCS (without affine approximation).\n", - "imviz.plugins['Orientation'].align_by = 'WCS'" + "jd.plugins['Orientation'].align_by = 'WCS'" ] }, { @@ -209,7 +203,7 @@ "metadata": {}, "outputs": [], "source": [ - "plot_options = imviz.plugins['Plot Options']" + "plot_options = jd.plugins['Plot Options']" ] }, { @@ -274,11 +268,13 @@ "cell_type": "code", "execution_count": null, "id": "e0b15d1a-7e12-4338-bf9f-c9ba0095e0a3", - "metadata": {}, + "metadata": { + "scrolled": true + }, "outputs": [], "source": [ - "exporting = imviz.plugins['Export']\n", - "exporting.viewer = 'imviz-0'\n", + "exporting = jd.plugins['Export']\n", + "exporting.viewer = 'Image'\n", "exporting.filename = 'carina_preset.png'\n", "exporting.export()" ] @@ -318,8 +314,17 @@ "id": "c08db0ba", "metadata": {}, "source": [ - "Notebook created by Kyle Conroy and adapted by Duy Nguyen and Camilla Pacifici." + "Notebook created by Kyle Conroy and adapted by Duy Nguyen and Camilla Pacifici.\n", + "last updated: 2026-05-05" ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ee3921eb-596f-4382-87ce-ef7cefa4aa41", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { @@ -338,7 +343,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.12" + "version": "3.11.15" } }, "nbformat": 4,