From e175ca9e2a69b51045a9a5f32bc646a452c6a677 Mon Sep 17 00:00:00 2001 From: David Law Date: Wed, 27 Nov 2024 16:02:21 -0500 Subject: [PATCH] Fix offline workflow (#32) * Fix offline workflow * Fix typos --- .../MIRI/Imaging/JWPipeNB-MIRI-imaging.ipynb | 484 +++++++----------- notebooks/MIRI/MRS/JWPipeNB-MIRI-MRS.ipynb | 87 ++-- .../Imaging/JWPipeNB-nircam-imaging.ipynb | 141 ++++- .../Imaging/JWPipeNB-niriss-imaging.ipynb | 240 ++++++--- 4 files changed, 510 insertions(+), 442 deletions(-) diff --git a/notebooks/MIRI/Imaging/JWPipeNB-MIRI-imaging.ipynb b/notebooks/MIRI/Imaging/JWPipeNB-MIRI-imaging.ipynb index 5e0fa3f..52fe0b8 100644 --- a/notebooks/MIRI/Imaging/JWPipeNB-MIRI-imaging.ipynb +++ b/notebooks/MIRI/Imaging/JWPipeNB-MIRI-imaging.ipynb @@ -21,7 +21,6 @@ ] }, { - "attachments": {}, "cell_type": "markdown", "id": "6a74b566-3d8c-4985-a4f3-d654a6d39371", "metadata": {}, @@ -52,19 +51,42 @@ "https://github.com/spacetelescope/jwst-pipeline-notebooks/\n", "\n", "**Recent Changes**:
\n", - "September 25, 2024: original notebook released

\n", - "\n", + "September 25, 2024: original notebook released
\n", + "November 22, 2024: Updates to workflow when skipping pipeline modules

" + ] + }, + { + "cell_type": "markdown", + "id": "fecaabc8", + "metadata": {}, + "source": [ + "
" + ] + }, + { + "cell_type": "markdown", + "id": "231ccda6", + "metadata": {}, + "source": [ "## Table of Contents\n", "1. [Configuration](#1.-Configuration)\n", "2. [Package Imports](#2.-Package-Imports)\n", "3. [Demo Mode Setup (ignore if not using demo data)](#3.-Demo-Mode-Setup-(ignore-if-not-using-demo-data))\n", "4. [Directory Setup](#4.-Directory-Setup)\n", - "3. [Detector 1 Pipelineg](#5.-Detector1-Pipeline)\n", + "3. [Detector 1 Pipeline](#5.-Detector1-Pipeline)\n", "4. [Image2 Pipeline](#6.-Image2-Pipeline)\n", "5. [Image3 Pipeline](#7.-Image3-Pipeline)\n", "6. [Visualize the data](#8.-Visualize-the-drizzle-combined-image)" ] }, + { + "cell_type": "markdown", + "id": "3d5f7ab9", + "metadata": {}, + "source": [ + "
" + ] + }, { "cell_type": "markdown", "id": "43bd07d7", @@ -72,7 +94,7 @@ "source": [ "## 1. Configuration\n", "------------------\n", - "Set basic configuration for runing notebook." + "Set basic configuration for running notebook." ] }, { @@ -109,7 +131,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "06ea414c", "metadata": {}, "outputs": [], @@ -141,18 +163,10 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "323f87d0", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Running in demonstration mode using online example data!\n" - ] - } - ], + "outputs": [], "source": [ "# Set parameters for demo_mode and processing steps.\n", "\n", @@ -183,7 +197,8 @@ "# Science processing\n", "dodet1 = True # calwebb_detector1\n", "doimage2 = True # calwebb_image2\n", - "doimage3 = True # calwebb_image3" + "doimage3 = True # calwebb_image3\n", + "doviz = True # Visualize calwebb_image3 results" ] }, { @@ -206,18 +221,7 @@ "execution_count": null, "id": "baf7070d", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "env: CRDS_CONTEXT=jwst_1295.pmap\n", - "CRDS local filepath: /Users/rdiaz/crds_cache\n", - "CRDS file server: https://jwst-crds.stsci.edu\n", - "CRDS CONTEXT: jwst_1295.pmap\n" - ] - } - ], + "outputs": [], "source": [ "# ------------------------Set CRDS context and paths----------------------\n", "# Each version of the calibration pipeline is associated with a specific CRDS\n", @@ -243,6 +247,14 @@ "print(f\"CRDS file server: {os.environ['CRDS_SERVER_URL']}\")" ] }, + { + "cell_type": "markdown", + "id": "be716575", + "metadata": {}, + "source": [ + "
" + ] + }, { "cell_type": "markdown", "id": "575588c8", @@ -253,23 +265,10 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "4415f6d9", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "# Use the entire available screen width for this notebook\n", "from IPython.display import display, HTML\n", @@ -278,19 +277,10 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "fb9f7f54-ff98-428b-9fa9-b39c50210c3a", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "JWST Calibration Pipeline Version: 1.15.1\n", - "Using CRDS Context: jwst_1295.pmap\n" - ] - } - ], + "outputs": [], "source": [ "# Basic system utilities for interacting with files\n", "# ----------------------General Imports------------------------------------\n", @@ -346,6 +336,14 @@ "time0 = time.perf_counter()" ] }, + { + "cell_type": "markdown", + "id": "3ae973c7", + "metadata": {}, + "source": [ + "
" + ] + }, { "cell_type": "markdown", "id": "7ef8050f", @@ -371,18 +369,10 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "8d595f1e-2590-4f01-bb92-13bb43a22b3c", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Running in demonstration mode and will download example data from MAST!\n" - ] - } - ], + "outputs": [], "source": [ "# Set up the program information and paths for demo program\n", "if demo_mode:\n", @@ -492,6 +482,14 @@ " local_path=os.path.join(uncal_dir, Path(filename).name))" ] }, + { + "cell_type": "markdown", + "id": "f46eeea8", + "metadata": {}, + "source": [ + "
" + ] + }, { "cell_type": "markdown", "id": "a6c51254-6295-4f98-bc25-d07300e0d8f4", @@ -504,7 +502,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "bffbedc3-fbe3-4c56-ad18-85b5d0c7d880", "metadata": {}, "outputs": [], @@ -536,26 +534,10 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "f767a7fa-50cb-4411-8aef-a32b7fde8917", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "./mir_im_demo_data/Obs001/uncal/jw01040001005_03103_00001_mirimage_uncal.fits\n", - "Instrument: MIRI\n", - "Filter: F770W\n", - "Number of integrations: 1\n", - "Number of groups: 6\n", - "Readout pattern: FASTR1\n", - "Dither position number: 1\n", - "\n", - "\n" - ] - } - ], + "outputs": [], "source": [ "uncal_files = sorted(glob.glob(os.path.join(uncal_dir, '*_uncal.fits')))\n", "\n", @@ -604,6 +586,14 @@ "print(f\"Runtime so far: {time1 - time0:0.0f} seconds\")" ] }, + { + "cell_type": "markdown", + "id": "55c14d80", + "metadata": {}, + "source": [ + "
" + ] + }, { "cell_type": "markdown", "id": "267e28e0-a63f-4790-b8a0-3ad4bff5a167", @@ -747,67 +737,31 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "1c122766-a545-4042-93e8-f68c18f62fdf", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'charge_migration': 'SKIPPED',\n", - " 'dark_sub': 'COMPLETE',\n", - " 'dq_init': 'COMPLETE',\n", - " 'emicorr': 'COMPLETE',\n", - " 'firstframe': 'COMPLETE',\n", - " 'gain_scale': 'SKIPPED',\n", - " 'group_scale': 'SKIPPED',\n", - " 'ipc': 'SKIPPED',\n", - " 'jump': 'COMPLETE',\n", - " 'lastframe': 'COMPLETE',\n", - " 'linearity': 'COMPLETE',\n", - " 'ramp_fit': 'COMPLETE',\n", - " 'refpix': 'SKIPPED',\n", - " 'reset': 'COMPLETE',\n", - " 'rscd': 'COMPLETE',\n", - " 'saturation': 'COMPLETE'}" - ] - }, - "execution_count": 11, - "metadata": {}, - "output_type": "execute_result" - }, - { - "data": { - "text/plain": [ - "{'crds': {'context_used': 'jwst_1295.pmap', 'sw_version': '11.18.1'},\n", - " 'dark': {'name': 'crds://jwst_miri_dark_0103.fits'},\n", - " 'emicorr': {'name': 'crds://jwst_miri_emicorr_0002.asdf'},\n", - " 'gain': {'name': 'crds://jwst_miri_gain_0034.fits'},\n", - " 'linearity': {'name': 'crds://jwst_miri_linearity_0032.fits'},\n", - " 'mask': {'name': 'crds://jwst_miri_mask_0036.fits'},\n", - " 'readnoise': {'name': 'crds://jwst_miri_readnoise_0085.fits'},\n", - " 'reset': {'name': 'crds://jwst_miri_reset_0077.fits'},\n", - " 'rscd': {'name': 'crds://jwst_miri_rscd_0017.fits'},\n", - " 'saturation': {'name': 'crds://jwst_miri_saturation_0034.fits'}}" - ] - }, - "execution_count": 11, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "# find rate files\n", - "rate_files = sorted(glob.glob(os.path.join(det1_dir, '*_rate.fits')))\n", - "\n", - "# Read in file as datamodel\n", - "rate_f = datamodels.open(rate_files[0])\n", - "\n", - "# Check which steps were run\n", - "rate_f.meta.cal_step.instance\n", - "\n", - "# Check which reference files were used to calibrate the dataset:\n", - "rate_f.meta.ref_file.instance" + "outputs": [], + "source": [ + "if dodet1:\n", + " # find rate files\n", + " rate_files = sorted(glob.glob(os.path.join(det1_dir, '*_rate.fits')))\n", + "\n", + " # Read in file as datamodel\n", + " rate_f = datamodels.open(rate_files[0])\n", + "\n", + " # Check which steps were run\n", + " rate_f.meta.cal_step.instance\n", + "\n", + " # Check which reference files were used to calibrate the dataset:\n", + " rate_f.meta.ref_file.instance" + ] + }, + { + "cell_type": "markdown", + "id": "30e4ff98", + "metadata": {}, + "source": [ + "
" ] }, { @@ -949,16 +903,25 @@ "metadata": {}, "outputs": [], "source": [ - "# Identify *_cal.fits files\n", - "cal_files = sorted(glob.glob(os.path.join(image2_dir, '*_cal.fits')))\n", + "if doimage2:\n", + " # Identify *_cal.fits files\n", + " cal_files = sorted(glob.glob(os.path.join(image2_dir, '*_cal.fits')))\n", "\n", - "cal_f = datamodels.open(cal_files[0])\n", + " cal_f = datamodels.open(cal_files[0])\n", "\n", - "# Check which steps were run:\n", - "cal_f.meta.cal_step.instance\n", + " # Check which steps were run:\n", + " cal_f.meta.cal_step.instance\n", "\n", - "# Check which reference files were used to calibrate the dataset:\n", - "cal_f.meta.ref_file.instance" + " # Check which reference files were used to calibrate the dataset:\n", + " cal_f.meta.ref_file.instance" + ] + }, + { + "cell_type": "markdown", + "id": "fe5b9a4d", + "metadata": {}, + "source": [ + "
" ] }, { @@ -1093,6 +1056,7 @@ " product_name='image3_association')\n", "\n", " associations.data['asn_type'] = 'image3'\n", + " program = datamodels.open(cal_files[0]).meta.observation.program_number\n", " associations.data['program'] = program\n", "\n", " # Format association as .json file\n", @@ -1158,114 +1122,39 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "c754530a-d4e2-493b-bf8b-bf8d1ad08770", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'assign_wcs': 'COMPLETE',\n", - " 'charge_migration': 'SKIPPED',\n", - " 'dark_sub': 'COMPLETE',\n", - " 'dq_init': 'COMPLETE',\n", - " 'emicorr': 'COMPLETE',\n", - " 'firstframe': 'COMPLETE',\n", - " 'flat_field': 'COMPLETE',\n", - " 'gain_scale': 'SKIPPED',\n", - " 'group_scale': 'SKIPPED',\n", - " 'ipc': 'SKIPPED',\n", - " 'jump': 'COMPLETE',\n", - " 'lastframe': 'COMPLETE',\n", - " 'linearity': 'COMPLETE',\n", - " 'outlier_detection': 'COMPLETE',\n", - " 'photom': 'COMPLETE',\n", - " 'ramp_fit': 'COMPLETE',\n", - " 'refpix': 'SKIPPED',\n", - " 'resample': 'COMPLETE',\n", - " 'reset': 'COMPLETE',\n", - " 'rscd': 'COMPLETE',\n", - " 'saturation': 'COMPLETE',\n", - " 'skymatch': 'COMPLETE',\n", - " 'tweakreg': 'COMPLETE'}" - ] - }, - "execution_count": 13, - "metadata": {}, - "output_type": "execute_result" - }, - { - "data": { - "text/plain": [ - "{'area': {'name': 'crds://jwst_miri_area_0006.fits'},\n", - " 'camera': {'name': 'N/A'},\n", - " 'collimator': {'name': 'N/A'},\n", - " 'crds': {'context_used': 'jwst_1295.pmap', 'sw_version': '11.18.1'},\n", - " 'dark': {'name': 'crds://jwst_miri_dark_0103.fits'},\n", - " 'dflat': {'name': 'N/A'},\n", - " 'disperser': {'name': 'N/A'},\n", - " 'distortion': {'name': 'crds://jwst_miri_distortion_0047.asdf'},\n", - " 'emicorr': {'name': 'crds://jwst_miri_emicorr_0002.asdf'},\n", - " 'fflat': {'name': 'N/A'},\n", - " 'filteroffset': {'name': 'crds://jwst_miri_filteroffset_0008.asdf'},\n", - " 'flat': {'name': 'crds://jwst_miri_flat_0785.fits'},\n", - " 'fore': {'name': 'N/A'},\n", - " 'fpa': {'name': 'N/A'},\n", - " 'gain': {'name': 'crds://jwst_miri_gain_0034.fits'},\n", - " 'ifufore': {'name': 'N/A'},\n", - " 'ifupost': {'name': 'N/A'},\n", - " 'ifuslicer': {'name': 'N/A'},\n", - " 'linearity': {'name': 'crds://jwst_miri_linearity_0032.fits'},\n", - " 'mask': {'name': 'crds://jwst_miri_mask_0036.fits'},\n", - " 'msa': {'name': 'N/A'},\n", - " 'ote': {'name': 'N/A'},\n", - " 'photom': {'name': 'crds://jwst_miri_photom_0218.fits'},\n", - " 'readnoise': {'name': 'crds://jwst_miri_readnoise_0085.fits'},\n", - " 'regions': {'name': 'N/A'},\n", - " 'reset': {'name': 'crds://jwst_miri_reset_0077.fits'},\n", - " 'rscd': {'name': 'crds://jwst_miri_rscd_0017.fits'},\n", - " 'saturation': {'name': 'crds://jwst_miri_saturation_0034.fits'},\n", - " 'sflat': {'name': 'N/A'},\n", - " 'specwcs': {'name': 'N/A'},\n", - " 'wavelengthrange': {'name': 'N/A'}}" - ] - }, - "execution_count": 13, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "# Identify *_i2d file and open as datamodel\n", - "i2d = glob.glob(os.path.join(image3_dir, \"*_i2d.fits\"))[0]\n", - "i2d_f = datamodels.open(i2d)\n", - "\n", - "# Check which steps were run\n", - "i2d_f.meta.cal_step.instance\n", - "\n", - "# Check which reference files were used to calibrate the dataset\n", - "i2d_f.meta.ref_file.instance" + "outputs": [], + "source": [ + "if doimage3:\n", + " # Identify *_i2d file and open as datamodel\n", + " i2d = glob.glob(os.path.join(image3_dir, \"*_i2d.fits\"))[0]\n", + " i2d_f = datamodels.open(i2d)\n", + "\n", + " # Check which steps were run\n", + " i2d_f.meta.cal_step.instance\n", + "\n", + " # Check which reference files were used to calibrate the dataset\n", + " i2d_f.meta.ref_file.instance" ] }, { "cell_type": "markdown", - "id": "46be5421-7fc8-4d96-b2cd-2484f294e082", + "id": "947f990e", "metadata": {}, "source": [ - "## 8. Visualize the drizzle-combined image\n", - "\n", - "We will use matplotlib routines for visualizing the data. Display the combined i2d image." + "
" ] }, { - "cell_type": "code", - "execution_count": null, - "id": "96f67f31-1764-4d20-bb52-49cb1021b86a", + "cell_type": "markdown", + "id": "46be5421-7fc8-4d96-b2cd-2484f294e082", "metadata": {}, - "outputs": [], "source": [ - "# Use a single definition of vmin and vmax to use in the image displays, so all mosaics will be plotted with the same color scale\n", - "display_vals = [4.0, 7.0]" + "## 8. Visualize the drizzle-combined image\n", + "\n", + "We will use matplotlib routines for visualizing the data. Display the combined i2d image." ] }, { @@ -1275,30 +1164,35 @@ "metadata": {}, "outputs": [], "source": [ - "# Look at the final i2d image (combined mosaic)\n", - "sstring = os.path.join(image3_dir, '*i2d.fits')\n", - "miri_mosaic_file = glob.glob(sstring)\n", - "print(miri_mosaic_file)\n", + "if doviz:\n", + " # Use a single definition of vmin and vmax to use in the image displays, \n", + " # so all mosaics will be plotted with the same color scale\n", + " display_vals = [4.0, 7.0]\n", + " \n", + " # Look at the final i2d image (combined mosaic)\n", + " sstring = os.path.join(image3_dir, '*i2d.fits')\n", + " miri_mosaic_file = glob.glob(sstring)\n", + " print(miri_mosaic_file)\n", "\n", - "# Read your mosaic image into an ImageModel datamodel\n", - "miri_mosaic = ImageModel(miri_mosaic_file[0])\n", + " # Read your mosaic image into an ImageModel datamodel\n", + " miri_mosaic = ImageModel(miri_mosaic_file[0])\n", "\n", - "plt.figure(figsize=(8, 8))\n", + " plt.figure(figsize=(8, 8))\n", "\n", - "fig, ax = plt.subplots(figsize=(8, 8))\n", + " fig, ax = plt.subplots(figsize=(8, 8))\n", "\n", - "# Set up image\n", - "cax = ax.imshow(miri_mosaic.data, cmap='Greys', origin='lower', vmin=display_vals[0], vmax=display_vals[1])\n", + " # Set up image\n", + " cax = ax.imshow(miri_mosaic.data, cmap='Greys', origin='lower', vmin=display_vals[0], vmax=display_vals[1])\n", "\n", - "# Set up colorbar\n", - "cb = fig.colorbar(cax, fraction=0.046)\n", - "cb.ax.set_ylabel('MJy/str', fontsize=14)\n", + " # Set up colorbar\n", + " cb = fig.colorbar(cax, fraction=0.046)\n", + " cb.ax.set_ylabel('MJy/str', fontsize=14)\n", "\n", - "# Set labels \n", - "ax.set_xlabel('X', fontsize=16)\n", - "ax.set_ylabel('Y', fontsize=16)\n", - "ax.set_title('Final MIRI mosaic', fontsize=16)\n", - "plt.tight_layout()" + " # Set labels \n", + " ax.set_xlabel('X', fontsize=16)\n", + " ax.set_ylabel('Y', fontsize=16)\n", + " ax.set_title('Final MIRI mosaic', fontsize=16)\n", + " plt.tight_layout()" ] }, { @@ -1328,22 +1222,23 @@ "metadata": {}, "outputs": [], "source": [ - "catalog_file = glob.glob(os.path.join(image3_dir, \"*_cat.ecsv\"))[0]\n", - "catalog = Table.read(catalog_file)\n", + "if doviz:\n", + " catalog_file = glob.glob(os.path.join(image3_dir, \"*_cat.ecsv\"))[0]\n", + " catalog = Table.read(catalog_file)\n", "\n", - "# find where sources are considered extended or point sources\n", - "pt_src, = np.where(~catalog['is_extended'])\n", - "ext_src, = np.where(catalog['is_extended'])\n", + " # find where sources are considered extended or point sources\n", + " pt_src, = np.where(~catalog['is_extended'])\n", + " ext_src, = np.where(catalog['is_extended'])\n", "\n", - "# Get x and y coordinates of the objects found \n", - "miri_x = catalog['xcentroid'][pt_src]\n", - "miri_y = catalog['ycentroid'][pt_src]\n", + " # Get x and y coordinates of the objects found \n", + " miri_x = catalog['xcentroid'][pt_src]\n", + " miri_y = catalog['ycentroid'][pt_src]\n", "\n", - "ext_x = catalog['xcentroid'][ext_src]\n", - "ext_y = catalog['ycentroid'][ext_src]\n", + " ext_x = catalog['xcentroid'][ext_src]\n", + " ext_y = catalog['ycentroid'][ext_src]\n", "\n", - "# Show catalog\n", - "catalog" + " # Show catalog\n", + " catalog" ] }, { @@ -1363,23 +1258,32 @@ "metadata": {}, "outputs": [], "source": [ - "# Look at mosaic data and sources found with source_catalog\n", - "fig, ax = plt.subplots(figsize=(8, 8))\n", + "if doviz:\n", + " # Look at mosaic data and sources found with source_catalog\n", + " fig, ax = plt.subplots(figsize=(8, 8))\n", "\n", - "# Set up image\n", - "cax = ax.imshow(miri_mosaic.data, cmap='Greys', origin='lower', vmin=display_vals[0], vmax=display_vals[1])\n", - "ax.scatter(miri_x, miri_y, lw=1, s=10, color='red') # overplot point source positions\n", - "ax.scatter(ext_x, ext_y, lw=1, s=20, color='blue', marker='v') # overplot extended source positions\n", + " # Set up image\n", + " cax = ax.imshow(miri_mosaic.data, cmap='Greys', origin='lower', vmin=display_vals[0], vmax=display_vals[1])\n", + " ax.scatter(miri_x, miri_y, lw=1, s=10, color='red') # overplot point source positions\n", + " ax.scatter(ext_x, ext_y, lw=1, s=20, color='blue', marker='v') # overplot extended source positions\n", "\n", - "# Set up colorbar\n", - "cb = fig.colorbar(cax, fraction=0.046)\n", - "cb.ax.set_ylabel('MJy/str', fontsize=14)\n", + " # Set up colorbar\n", + " cb = fig.colorbar(cax, fraction=0.046)\n", + " cb.ax.set_ylabel('MJy/str', fontsize=14)\n", "\n", - "# Set labels\n", - "ax.set_xlabel('X', fontsize=16)\n", - "ax.set_ylabel('Y', fontsize=16)\n", - "ax.set_title('Final MIRI mosaic', fontsize=16)\n", - "plt.tight_layout()" + " # Set labels\n", + " ax.set_xlabel('X', fontsize=16)\n", + " ax.set_ylabel('Y', fontsize=16)\n", + " ax.set_title('Final MIRI mosaic', fontsize=16)\n", + " plt.tight_layout()" + ] + }, + { + "cell_type": "markdown", + "id": "f59557af", + "metadata": {}, + "source": [ + "
" ] }, { @@ -1407,7 +1311,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.3" + "version": "3.11.10" } }, "nbformat": 4, diff --git a/notebooks/MIRI/MRS/JWPipeNB-MIRI-MRS.ipynb b/notebooks/MIRI/MRS/JWPipeNB-MIRI-MRS.ipynb index 1eab9b8..c38e17a 100644 --- a/notebooks/MIRI/MRS/JWPipeNB-MIRI-MRS.ipynb +++ b/notebooks/MIRI/MRS/JWPipeNB-MIRI-MRS.ipynb @@ -221,6 +221,7 @@ "dodet1 = True # calwebb_detector1\n", "dospec2 = True # calwebb_spec2\n", "dospec3 = True # calwebb_spec3\n", + "doviz = True # Visualize calwebb_spec3 results\n", "\n", "# Background processing\n", "dodet1bg = True # calwebb_detector1\n", @@ -1399,12 +1400,13 @@ "metadata": {}, "outputs": [], "source": [ - "# Find and sort all of the input files\n", + "if doviz:\n", + " # Find and sort all of the input files\n", "\n", - "# Science Files\n", - "# Use the final extracted spectra (x1d.fits)\n", - "sstring = sorted(glob.glob(os.path.join(spec3_dir, '*x1d.fits')))\n", - "x1dfiles = np.array(sorted(sstring))" + " # Science Files\n", + " # Use the final extracted spectra (x1d.fits)\n", + " sstring = sorted(glob.glob(os.path.join(spec3_dir, '*x1d.fits')))\n", + " x1dfiles = np.array(sorted(sstring))" ] }, { @@ -1414,45 +1416,46 @@ "metadata": {}, "outputs": [], "source": [ - "# Make normal plots\n", - "%matplotlib inline\n", - "# Interactive plots\n", - "#%matplotlib notebook\n", + "if doviz:\n", + " # Make normal plots\n", + " %matplotlib inline\n", + " # Interactive plots\n", + " #%matplotlib notebook\n", "\n", - "rc('axes', linewidth=2)\n", - "fig, ax = plt.subplots(1, 1, figsize=(10, 3), dpi=150)\n", + " rc('axes', linewidth=2)\n", + " fig, ax = plt.subplots(1, 1, figsize=(10, 3), dpi=150)\n", "\n", - "if (len(x1dfiles) > 0):\n", - " hdu = fits.open(x1dfiles[0])\n", - " objname = hdu[0].header['TARGPROP']\n", - " hdu.close()\n", - "else:\n", - " objname = 'Unknown'\n", - "\n", - "ymin, ymax = np.nan, np.nan\n", - "for file in x1dfiles:\n", - " x1d = fits.open(file)\n", - " x1ddata = x1d[1].data\n", - " wave = x1ddata['WAVELENGTH']\n", - " flux = x1ddata['FLUX']\n", - " ymin = np.nanmin([ymin, np.nanpercentile(flux, 2)])\n", - " ymax = np.nanmax([ymax, np.nanpercentile(flux, 99.5)])\n", - "\n", - " # labels\n", - " label = x1d[0].header['CHANNEL'] + x1d[0].header['BAND']\n", - "\n", - " plt.plot(wave, flux, label=label)\n", - "\n", - " x1d.close()\n", - "\n", - "plt.xlabel(r'Wavelength ($\\mu$m)')\n", - "plt.ylabel('Flux (Jy)')\n", - "plt.title(objname)\n", - "plt.ylim(ymin, ymax)\n", - "plt.legend(fontsize=8, loc='center left', bbox_to_anchor=(1, 0.5))\n", - "plt.grid()\n", - "plt.tight_layout()\n", - "plt.savefig('mrs_example_plot.png')" + " if (len(x1dfiles) > 0):\n", + " hdu = fits.open(x1dfiles[0])\n", + " objname = hdu[0].header['TARGPROP']\n", + " hdu.close()\n", + " else:\n", + " objname = 'Unknown'\n", + "\n", + " ymin, ymax = np.nan, np.nan\n", + " for file in x1dfiles:\n", + " x1d = fits.open(file)\n", + " x1ddata = x1d[1].data\n", + " wave = x1ddata['WAVELENGTH']\n", + " flux = x1ddata['FLUX']\n", + " ymin = np.nanmin([ymin, np.nanpercentile(flux, 2)])\n", + " ymax = np.nanmax([ymax, np.nanpercentile(flux, 99.5)])\n", + "\n", + " # labels\n", + " label = x1d[0].header['CHANNEL'] + x1d[0].header['BAND']\n", + "\n", + " plt.plot(wave, flux, label=label)\n", + "\n", + " x1d.close()\n", + "\n", + " plt.xlabel(r'Wavelength ($\\mu$m)')\n", + " plt.ylabel('Flux (Jy)')\n", + " plt.title(objname)\n", + " plt.ylim(ymin, ymax)\n", + " plt.legend(fontsize=8, loc='center left', bbox_to_anchor=(1, 0.5))\n", + " plt.grid()\n", + " plt.tight_layout()\n", + " plt.savefig('mrs_example_plot.png')" ] }, { diff --git a/notebooks/NIRCAM/Imaging/JWPipeNB-nircam-imaging.ipynb b/notebooks/NIRCAM/Imaging/JWPipeNB-nircam-imaging.ipynb index 5f39c2e..0e443eb 100644 --- a/notebooks/NIRCAM/Imaging/JWPipeNB-nircam-imaging.ipynb +++ b/notebooks/NIRCAM/Imaging/JWPipeNB-nircam-imaging.ipynb @@ -60,7 +60,16 @@ "**Recent Changes**:
\n", "Sept 5, 2024: original notebook created
\n", "Nov 11, 2024: Comment out line to set the context
\n", - "Nov 18, 2024: Do not require both SW and LW user-provided data
" + "Nov 18, 2024: Do not require both SW and LW user-provided data
\n", + "November 22, 2024: Updates to workflow when skipping pipeline modules

" + ] + }, + { + "cell_type": "markdown", + "id": "13e92341", + "metadata": {}, + "source": [ + "
" ] }, { @@ -82,6 +91,14 @@ "10. [Notes](#10.-Notes)" ] }, + { + "cell_type": "markdown", + "id": "139a63d0", + "metadata": {}, + "source": [ + "
" + ] + }, { "cell_type": "markdown", "id": "43bd07d7", @@ -250,6 +267,14 @@ " print(f\"CRDS CONTEXT: {os.environ['CRDS_CONTEXT']}\")" ] }, + { + "cell_type": "markdown", + "id": "bdd10c54", + "metadata": {}, + "source": [ + "
" + ] + }, { "cell_type": "markdown", "id": "575588c8", @@ -334,14 +359,11 @@ ] }, { - "cell_type": "code", - "execution_count": null, - "id": "705182ef-902f-41b8-8e59-2807c6177305", + "cell_type": "markdown", + "id": "ea709b51", "metadata": {}, - "outputs": [], "source": [ - "# Placeholder for the program number\n", - "program = None" + "
" ] }, { @@ -612,6 +634,14 @@ " local_path=os.path.join(uncal_dir, Path(filename).name))" ] }, + { + "cell_type": "markdown", + "id": "112a7c4f", + "metadata": {}, + "source": [ + "
" + ] + }, { "cell_type": "markdown", "id": "a6c51254-6295-4f98-bc25-d07300e0d8f4", @@ -688,8 +718,6 @@ " sw_examine.meta.exposure.ngroups, sw_examine.meta.exposure.readpatt,\n", " sw_examine.meta.dither.position_number]\n", " meta_check.add_row(sw_row)\n", - " if program is None:\n", - " program = sw_examine.meta.observation.program_number\n", "\n", "if len(lw_uncal_files) > 0:\n", " lw_examine = datamodels.open(lw_uncal_files[0])\n", @@ -698,8 +726,6 @@ " lw_examine.meta.exposure.ngroups, lw_examine.meta.exposure.readpatt,\n", " lw_examine.meta.dither.position_number]\n", " meta_check.add_row(lw_row)\n", - " if program is None:\n", - " program = lw_examine.meta.observation.program_number\n", "\n", "# Print out exposure info\n", "meta_check" @@ -735,6 +761,14 @@ "print(f\"Runtime so far: {time_det1 - time0:0.0f} seconds\")" ] }, + { + "cell_type": "markdown", + "id": "4fac2959", + "metadata": {}, + "source": [ + "
" + ] + }, { "cell_type": "markdown", "id": "267e28e0-a63f-4790-b8a0-3ad4bff5a167", @@ -884,14 +918,15 @@ "metadata": {}, "outputs": [], "source": [ - "# find rate files\n", - "rate_files = sorted(glob.glob(os.path.join(det1_dir, '*_rate.fits')))\n", + "if dodet1:\n", + " # find rate files\n", + " rate_files = sorted(glob.glob(os.path.join(det1_dir, '*_rate.fits')))\n", "\n", - "# Read in file as datamodel\n", - "rate_f = datamodels.open(rate_files[0])\n", + " # Read in file as datamodel\n", + " rate_f = datamodels.open(rate_files[0])\n", "\n", - "# Check which steps were run\n", - "rate_f.meta.cal_step.instance" + " # Check which steps were run\n", + " rate_f.meta.cal_step.instance" ] }, { @@ -909,7 +944,16 @@ "metadata": {}, "outputs": [], "source": [ - "rate_f.meta.ref_file.instance" + "if dodet1:\n", + " rate_f.meta.ref_file.instance" + ] + }, + { + "cell_type": "markdown", + "id": "bf557837", + "metadata": {}, + "source": [ + "
" ] }, { @@ -1076,14 +1120,15 @@ "metadata": {}, "outputs": [], "source": [ - "# Identify *_cal.fits file products\n", - "cal_files = sorted(glob.glob(os.path.join(image2_dir, '*_cal.fits')))\n", + "if doimage2:\n", + " # Identify *_cal.fits file products\n", + " cal_files = sorted(glob.glob(os.path.join(image2_dir, '*_cal.fits')))\n", "\n", - "# Select first file to gather information\n", - "cal_f = datamodels.open(cal_files[0])\n", + " # Select first file to gather information\n", + " cal_f = datamodels.open(cal_files[0])\n", "\n", - "# Check which steps were run:\n", - "cal_f.meta.cal_step.instance" + " # Check which steps were run:\n", + " cal_f.meta.cal_step.instance" ] }, { @@ -1101,7 +1146,16 @@ "metadata": {}, "outputs": [], "source": [ - "cal_f.meta.ref_file.instance" + "if doimage2:\n", + " cal_f.meta.ref_file.instance" + ] + }, + { + "cell_type": "markdown", + "id": "7159a021", + "metadata": {}, + "source": [ + "
" ] }, { @@ -1244,6 +1298,7 @@ " product_name=sw_product_name)\n", " \n", " sw_association.data['asn_type'] = 'image3'\n", + " program = datamodels.open(sw_cal_files[0]).meta.observation.program_number\n", " sw_association.data['program'] = program\n", " \n", " # Format association as .json file\n", @@ -1274,6 +1329,7 @@ " product_name=lw_product_name)\n", " \n", " lw_association.data['asn_type'] = 'image3'\n", + " program = datamodels.open(lw_cal_files[0]).meta.observation.program_number\n", " lw_association.data['program'] = program\n", " \n", " # Format association as .json file\n", @@ -1459,7 +1515,16 @@ "metadata": {}, "outputs": [], "source": [ - "step_check_model.meta.ref_file.instance" + "if doimage3:\n", + " step_check_model.meta.ref_file.instance" + ] + }, + { + "cell_type": "markdown", + "id": "ade57bb3", + "metadata": {}, + "source": [ + "
" ] }, { @@ -1655,6 +1720,14 @@ " imviz_color.show()" ] }, + { + "cell_type": "markdown", + "id": "fca90333", + "metadata": {}, + "source": [ + "
" + ] + }, { "cell_type": "markdown", "id": "018733eb-07ec-44a4-a5a7-d6d2f27d193a", @@ -1825,6 +1898,14 @@ " viewer_lw_cat.add_markers(lw_ext_coord, use_skycoord=True, marker_name='extended_sources')" ] }, + { + "cell_type": "markdown", + "id": "a2e3c58e", + "metadata": {}, + "source": [ + "
" + ] + }, { "cell_type": "markdown", "id": "85105f12-83ac-4c19-8f52-3ed2a5e08e27", @@ -1843,6 +1924,14 @@ "- If you notice poor alignment across tiles within a single i2d image, or between i2d images that you expect to be aligned, try adjusting the parameters in the `tweakreg` step. With these, you can customize which sources `tweakreg` identifies and uses for the alignment." ] }, + { + "cell_type": "markdown", + "id": "1f9a45cd", + "metadata": {}, + "source": [ + "
" + ] + }, { "cell_type": "markdown", "id": "cde191a9-cc88-4584-8524-780d245b469f", diff --git a/notebooks/NIRISS/Imaging/JWPipeNB-niriss-imaging.ipynb b/notebooks/NIRISS/Imaging/JWPipeNB-niriss-imaging.ipynb index 96fc36b..c9d6cf3 100755 --- a/notebooks/NIRISS/Imaging/JWPipeNB-niriss-imaging.ipynb +++ b/notebooks/NIRISS/Imaging/JWPipeNB-niriss-imaging.ipynb @@ -64,7 +64,16 @@ "January 24, 2024: original notebook released
\n", "Septemer 3, 2024: Updated text to highlight that `IRAFStarFinder` is the default\n", "centroiding algorithm used in the `Image3` tweakreg step of the pipeline for NIRISS imaging, as of \n", - "pipeline version 1.14.0 (build 10.2).
" + "pipeline version 1.14.0 (build 10.2).
\n", + "November 22, 2024: Updates to workflow when skipping pipeline modules

" + ] + }, + { + "cell_type": "markdown", + "id": "453945c7", + "metadata": {}, + "source": [ + "
" ] }, { @@ -78,12 +87,20 @@ "2. [Package Imports](#2.-Package-Imports)\n", "3. [Demo Mode Setup (ignore if not using demo data)](#3.-Demo-Mode-Setup-(ignore-if-not-using-demo-data))\n", "4. [Directory Setup](#4.-Directory-Setup)\n", - "3. [Detector 1 Pipelineg](#5.-Detector1-Pipeline)\n", + "3. [Detector 1 Pipeline](#5.-Detector1-Pipeline)\n", "4. [Image2 Pipeline](#6.-Image2-Pipeline)\n", "5. [Image3 Pipeline](#7.-Image3-Pipeline)\n", "6. [Visualize the data](#8.-Visualize-the-drizzle-combined-image)" ] }, + { + "cell_type": "markdown", + "id": "e5a88584", + "metadata": {}, + "source": [ + "
" + ] + }, { "cell_type": "markdown", "id": "43bd07d7", @@ -91,7 +108,7 @@ "source": [ "## 1. Configuration\n", "------------------\n", - "Set basic configuration for runing notebook." + "Set basic configuration for running notebook." ] }, { @@ -194,7 +211,8 @@ "# Science processing\n", "dodet1 = True # calwebb_detector1\n", "doimage2 = True # calwebb_image2\n", - "doimage3 = True # calwebb_image3" + "doimage3 = True # calwebb_image3\n", + "doviz = True # Visualize calwebb_image3 output" ] }, { @@ -238,6 +256,14 @@ "print(f\"CRDS file server: {os.environ['CRDS_SERVER_URL']}\")" ] }, + { + "cell_type": "markdown", + "id": "165cb98d", + "metadata": {}, + "source": [ + "
" + ] + }, { "cell_type": "markdown", "id": "575588c8", @@ -315,6 +341,14 @@ "time0 = time.perf_counter()" ] }, + { + "cell_type": "markdown", + "id": "987d3f75", + "metadata": {}, + "source": [ + "
" + ] + }, { "cell_type": "markdown", "id": "7ef8050f", @@ -450,6 +484,14 @@ " local_path=os.path.join(uncal_dir, Path(filename).name))" ] }, + { + "cell_type": "markdown", + "id": "5b14864b", + "metadata": {}, + "source": [ + "
" + ] + }, { "cell_type": "markdown", "id": "a6c51254-6295-4f98-bc25-d07300e0d8f4", @@ -548,6 +590,14 @@ "print(f\"Runtime so far: {time1 - time0:0.0f} seconds\")" ] }, + { + "cell_type": "markdown", + "id": "97528f9b", + "metadata": {}, + "source": [ + "
" + ] + }, { "cell_type": "markdown", "id": "267e28e0-a63f-4790-b8a0-3ad4bff5a167", @@ -702,14 +752,15 @@ "metadata": {}, "outputs": [], "source": [ - "# find rate files\n", - "rate_files = sorted(glob.glob(os.path.join(det1_dir, '*_rate.fits')))\n", + "if dodet1:\n", + " # find rate files\n", + " rate_files = sorted(glob.glob(os.path.join(det1_dir, '*_rate.fits')))\n", "\n", - "# Read in file as datamodel\n", - "rate_f = datamodels.open(rate_files[0])\n", + " # Read in file as datamodel\n", + " rate_f = datamodels.open(rate_files[0])\n", "\n", - "# Check which steps were run\n", - "rate_f.meta.cal_step.instance" + " # Check which steps were run\n", + " rate_f.meta.cal_step.instance" ] }, { @@ -727,7 +778,16 @@ "metadata": {}, "outputs": [], "source": [ - "rate_f.meta.ref_file.instance" + "if dodet1:\n", + " rate_f.meta.ref_file.instance" + ] + }, + { + "cell_type": "markdown", + "id": "b06450da", + "metadata": {}, + "source": [ + "
" ] }, { @@ -869,13 +929,14 @@ "metadata": {}, "outputs": [], "source": [ - "# Identify *_cal.fits files\n", - "cal_files = sorted(glob.glob(os.path.join(image2_dir, '*_cal.fits')))\n", + "if doimage2:\n", + " # Identify *_cal.fits files\n", + " cal_files = sorted(glob.glob(os.path.join(image2_dir, '*_cal.fits')))\n", "\n", - "cal_f = datamodels.open(cal_files[0])\n", + " cal_f = datamodels.open(cal_files[0])\n", "\n", - "# Check which steps were run:\n", - "cal_f.meta.cal_step.instance" + " # Check which steps were run:\n", + " cal_f.meta.cal_step.instance" ] }, { @@ -893,7 +954,16 @@ "metadata": {}, "outputs": [], "source": [ - "cal_f.meta.ref_file.instance" + "if doimage2:\n", + " cal_f.meta.ref_file.instance" + ] + }, + { + "cell_type": "markdown", + "id": "3ef9155e", + "metadata": {}, + "source": [ + "
" ] }, { @@ -1009,6 +1079,7 @@ " product_name='image3_association')\n", " \n", " associations.data['asn_type'] = 'image3'\n", + " program = datamodels.open(cal_files[0]).meta.observation.program_number\n", " associations.data['program'] = program\n", " \n", " # Format association as .json file\n", @@ -1079,12 +1150,13 @@ "metadata": {}, "outputs": [], "source": [ - "# Identify *_i2d file and open as datamodel\n", - "i2d = glob.glob(os.path.join(image3_dir, \"*_i2d.fits\"))[0]\n", - "i2d_f = datamodels.open(i2d)\n", + "if doimage3:\n", + " # Identify *_i2d file and open as datamodel\n", + " i2d = glob.glob(os.path.join(image3_dir, \"*_i2d.fits\"))[0]\n", + " i2d_f = datamodels.open(i2d)\n", "\n", - "# Check which steps were run\n", - "i2d_f.meta.cal_step.instance" + " # Check which steps were run\n", + " i2d_f.meta.cal_step.instance" ] }, { @@ -1102,7 +1174,16 @@ "metadata": {}, "outputs": [], "source": [ - "i2d_f.meta.ref_file.instance" + "if doimage3:\n", + " i2d_f.meta.ref_file.instance" + ] + }, + { + "cell_type": "markdown", + "id": "80362ba8", + "metadata": {}, + "source": [ + "
" ] }, { @@ -1123,30 +1204,27 @@ "metadata": {}, "outputs": [], "source": [ - "# Create an Imviz instance and set up default viewer\n", - "imviz_i2d = Imviz()\n", - "viewer_i2d = imviz_i2d.default_viewer\n", + "if doviz:\n", + " # Identify *_i2d file and open as datamodel\n", + " i2d = glob.glob(os.path.join(image3_dir, \"*_i2d.fits\"))[0]\n", + " i2d_f = datamodels.open(i2d)\n", + " \n", + " # Create an Imviz instance and set up default viewer\n", + " imviz_i2d = Imviz()\n", + " viewer_i2d = imviz_i2d.default_viewer\n", "\n", - "# Read in the science array for our visualization dataset:\n", - "i2d_science = i2d_f.data\n", + " # Read in the science array for our visualization dataset:\n", + " i2d_science = i2d_f.data\n", "\n", - "# Load the dataset into Imviz\n", - "imviz_i2d.load_data(i2d_science)\n", + " # Load the dataset into Imviz\n", + " imviz_i2d.load_data(i2d_science)\n", "\n", - "# Visualize the dataset:\n", - "imviz_i2d.show()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "8d22a117-e4cf-4d2f-9fec-f52545c8aa5a", - "metadata": {}, - "outputs": [], - "source": [ - "viewer_i2d.stretch = 'sqrt'\n", - "viewer_i2d.set_colormap('Viridis')\n", - "viewer_i2d.cuts = '95%'" + " # Visualize the dataset:\n", + " imviz_i2d.show()\n", + " \n", + " viewer_i2d.stretch = 'sqrt'\n", + " viewer_i2d.set_colormap('Viridis')\n", + " viewer_i2d.cuts = '95%'" ] }, { @@ -1178,18 +1256,19 @@ "metadata": {}, "outputs": [], "source": [ - "catalog_file = glob.glob(os.path.join(image3_dir, \"*_cat.ecsv\"))[0]\n", - "catalog = Table.read(catalog_file)\n", + "if doviz:\n", + " catalog_file = glob.glob(os.path.join(image3_dir, \"*_cat.ecsv\"))[0]\n", + " catalog = Table.read(catalog_file)\n", "\n", - "# To identify point/extended sources, use the 'is_extended' column in the source catalog\n", - "pt_src, = np.where(~catalog['is_extended'])\n", - "ext_src, = np.where(catalog['is_extended'])\n", + " # To identify point/extended sources, use the 'is_extended' column in the source catalog\n", + " pt_src, = np.where(~catalog['is_extended'])\n", + " ext_src, = np.where(catalog['is_extended'])\n", "\n", - "# Define coordinates of point and extended sources\n", - "pt_coord = Table({'coord': [SkyCoord(ra=catalog['sky_centroid'][pt_src].ra,\n", - " dec=catalog['sky_centroid'][pt_src].dec)]})\n", - "ext_coord = Table({'coord': [SkyCoord(ra=catalog['sky_centroid'][ext_src].ra,\n", - " dec=catalog['sky_centroid'][ext_src].dec)]})" + " # Define coordinates of point and extended sources\n", + " pt_coord = Table({'coord': [SkyCoord(ra=catalog['sky_centroid'][pt_src].ra,\n", + " dec=catalog['sky_centroid'][pt_src].dec)]})\n", + " ext_coord = Table({'coord': [SkyCoord(ra=catalog['sky_centroid'][ext_src].ra,\n", + " dec=catalog['sky_centroid'][ext_src].dec)]})" ] }, { @@ -1199,7 +1278,7 @@ "source": [ "### Mark the extended and point sources on the image\n", "\n", - "Display combined image:" + "Display combined image; point sources will be marked by small pink circles and extended sources will be marked by larger white circles." ] }, { @@ -1209,42 +1288,35 @@ "metadata": {}, "outputs": [], "source": [ - "# Read in i2d file to Imviz\n", - "imviz_cat = Imviz()\n", - "viewer_cat = imviz_cat.default_viewer\n", - "imviz_cat.load_data(i2d)\n", + "if doviz:\n", + " # Read in i2d file to Imviz\n", + " imviz_cat = Imviz()\n", + " viewer_cat = imviz_cat.default_viewer\n", + " imviz_cat.load_data(i2d)\n", + "\n", + " # Adjust settings for viewer\n", + " viewer_cat.stretch = 'sqrt'\n", + " viewer_cat.set_colormap('Viridis')\n", + " viewer_cat.cuts = '95%'\n", "\n", - "# Adjust settings for viewer\n", - "viewer_cat.stretch = 'sqrt'\n", - "viewer_cat.set_colormap('Viridis')\n", - "viewer_cat.cuts = '95%'\n", + " # Show the plot\n", + " imviz_cat.show()\n", + " \n", + " # Add marker for point sources:\n", + " viewer_cat.marker = {'color': 'pink', 'markersize': 50, 'fill': False}\n", + " viewer_cat.add_markers(pt_coord, use_skycoord=True, marker_name='point_sources')\n", "\n", - "# Show the plot\n", - "imviz_cat.show()" + " # Add marker for extended sources:\n", + " viewer_cat.marker = {'color': 'white', 'markersize': 100, 'fill': False}\n", + " viewer_cat.add_markers(ext_coord, use_skycoord=True, marker_name='extended_sources')" ] }, { "cell_type": "markdown", - "id": "bb9dc081-7a24-442c-bf86-ed2faa6cf342", - "metadata": {}, - "source": [ - "Point sources will be marked by small pink circles and extended sources will be marked by larger white circles." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "fcb8f619-3807-44d1-a8d9-fbf41abb5522", + "id": "89ee8944", "metadata": {}, - "outputs": [], "source": [ - "# Add marker for point sources:\n", - "viewer_cat.marker = {'color': 'pink', 'markersize': 50, 'fill': False}\n", - "viewer_cat.add_markers(pt_coord, use_skycoord=True, marker_name='point_sources')\n", - "\n", - "# Add marker for extended sources:\n", - "viewer_cat.marker = {'color': 'white', 'markersize': 100, 'fill': False}\n", - "viewer_cat.add_markers(ext_coord, use_skycoord=True, marker_name='extended_sources')" + "
" ] }, { @@ -1272,7 +1344,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.4" + "version": "3.11.10" } }, "nbformat": 4,