From f200c8d614974f8ff9efbb4ea3e57383c8949a59 Mon Sep 17 00:00:00 2001 From: "Brett M. Morris" Date: Fri, 25 Aug 2023 09:23:43 -0400 Subject: [PATCH] link to latest demo L1 file --- CHANGES.rst | 2 + jdaviz/configs/cubeviz/plugins/slice/slice.py | 4 +- notebooks/concepts/cubeviz-roman-ramp.ipynb | 90 +++++++++++++++++++ 3 files changed, 94 insertions(+), 2 deletions(-) create mode 100644 notebooks/concepts/cubeviz-roman-ramp.ipynb diff --git a/CHANGES.rst b/CHANGES.rst index ba3cd98f7c..d82c09c2f1 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -680,6 +680,8 @@ Cubeviz - Add Spectral Extraction plugin for Cubeviz, which converts spectral cubes to 1D spectra with propagated uncertainties [#2039] +- Support for loading Roman WFI Level 1 (ramp) files [#2376] + Imviz ^^^^^ diff --git a/jdaviz/configs/cubeviz/plugins/slice/slice.py b/jdaviz/configs/cubeviz/plugins/slice/slice.py index e2a98483d9..6dd3581726 100644 --- a/jdaviz/configs/cubeviz/plugins/slice/slice.py +++ b/jdaviz/configs/cubeviz/plugins/slice/slice.py @@ -172,7 +172,7 @@ def _watch_viewer(self, viewer, watch=True): # conversion can be done efficiently self._update_data(viewer_data[0].spectral_axis) else: - sample_index = np.arange(1, 1 + viewer_data[0].shape[-1]) * u.one + sample_index = np.arange(viewer_data[0].shape[-1]) * u.one self._update_data(sample_index) if viewer not in self._indicator_viewers: @@ -196,7 +196,7 @@ def _update_reference_data(self, reference_data): return # pragma: no cover if reference_data.meta.get(cubeviz_ramp_meta_flag, False): - sample_index = np.arange(1, 1 + reference_data['flux'].shape[-1]) * u.one + sample_index = np.arange(reference_data['flux'].shape[-1]) * u.one self._update_data(sample_index) else: self._update_data(reference_data.get_object(cls=Spectrum1D).spectral_axis) diff --git a/notebooks/concepts/cubeviz-roman-ramp.ipynb b/notebooks/concepts/cubeviz-roman-ramp.ipynb new file mode 100644 index 0000000000..bcab516b73 --- /dev/null +++ b/notebooks/concepts/cubeviz-roman-ramp.ipynb @@ -0,0 +1,90 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "b3e22694-d8ee-4c14-8931-8f8db1d7485d", + "metadata": { + "tags": [] + }, + "source": [ + "## PoC: Visualize a Roman L1 ramp file in Cubeviz\n", + "\n", + "First download a synthetic Roman L1 file:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e80524dd-bcc5-4312-879a-33780e297006", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "import os\n", + "from urllib.request import urlretrieve\n", + "\n", + "from jdaviz import Cubeviz\n", + "\n", + "force_download = False\n", + "\n", + "url_L1 = \"https://stsci.box.com/shared/static/80vahj27t3y02itfohc22p999snkcocw.asdf\"\n", + "local_path = \"L1.asdf\"\n", + "\n", + "if not os.path.exists(local_path) or force_download:\n", + " urlretrieve(url_L1, local_path)" + ] + }, + { + "cell_type": "markdown", + "id": "0f94fbf1-6f4c-4118-917d-de824af57fe6", + "metadata": {}, + "source": [ + "Open the ramp in Cubeviz:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "863ce611-bf38-4a97-bd1d-c0ff79d36073", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "cubeviz = Cubeviz()\n", + "cubeviz.load_data(local_path, data_label='Roman L1')\n", + "cubeviz.show(height=1000)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4312b177-e0d5-45da-95ba-81c910ffff4f", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "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.11.5" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}