Skip to content

Commit c2060a1

Browse files
authored
Merge pull request #315 from bhilbert4/imviz-demo-new-data
Imviz demo notebook: Use new data to replace data deleted from MAST
2 parents 7997443 + 059d6b0 commit c2060a1

File tree

1 file changed

+31
-14
lines changed

1 file changed

+31
-14
lines changed

notebooks/jdaviz_demo/notebooks/Imviz.ipynb

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"source": [
1616
"# Jdaviz Imviz Demo\n",
1717
"**Author: Clare Shanahan, Space Telescope Science Institute**<br>\n",
18-
"**Last update: May 27, 2025**\n",
18+
"**Last update: Oct 30, 2025**\n",
1919
"\n",
2020
"## Tutorial Overview\n",
2121
"This tutorial will demonstrate an example workflow to show of some key features of [Imviz](https://jdaviz.readthedocs.io/en/latest/imviz/index.html). We will be looking at some basic functionality (starting the app in a notebook, loading data, pan/zoom, subsets/regions of interest) as well as some of the higher level plugin tools including catalog search and aperture photometry.\n",
@@ -73,14 +73,13 @@
7373
"metadata": {},
7474
"outputs": [],
7575
"source": [
76-
"filenames = ['jw01227-c1002_t005_nircam_clear-f335m_i2d.fits',\n",
77-
" 'jw01227-c1002_t005_nircam_clear-f277w_i2d.fits',\n",
78-
" 'jw01227-c1002_t005_nircam_clear-f444w_i2d.fits']\n",
79-
"\n",
76+
"filenames = ['jw01227025001_04101_00001_nrcalong_i2d.fits', # F277W\n",
77+
" 'jw01227025001_02101_00001_nrcalong_i2d.fits', # F335M\n",
78+
" 'jw01227025001_06101_00001_nrcalong_i2d.fits'] # F444W\n",
8079
"with imviz.batch_load(): # not necessary, but this context manager makes loading multiple files more efficient \n",
8180
" for filename in filenames:\n",
82-
" imviz.load_data(f'mast:JWST/product/{filename}', cache=True) # to re-download from MAST (or use cached files)\n",
83-
" # imviz.load_data(f'./data/{filename}', cache=True) # pre-downloaded data"
81+
" imviz.load(f'mast:JWST/product/{filename}', cache=True) # to re-download from MAST (or use cached files)\n",
82+
" # imviz.load(f'./data/{filename}', cache=True) # pre-downloaded data"
8483
]
8584
},
8685
{
@@ -145,7 +144,7 @@
145144
"plot_options.stretch_preset = '99.5%'\n",
146145
"\n",
147146
"# increase vmax to a more suitable value\n",
148-
"plot_options.stretch_vmax = 600"
147+
"plot_options.stretch_vmax = 6"
149148
]
150149
},
151150
{
@@ -193,8 +192,8 @@
193192
"# select Gaia catalog\n",
194193
"catalogs_plugin.catalog.selected = 'Gaia'\n",
195194
"\n",
196-
"# request only 10 sources\n",
197-
"catalogs_plugin.max_sources = 10\n",
195+
"# Set an upper limit on the number of sources\n",
196+
"catalogs_plugin.max_sources = 500\n",
198197
"\n",
199198
"# and run the search\n",
200199
"catalogs_plugin.search()\n",
@@ -213,13 +212,30 @@
213212
"metadata": {},
214213
"outputs": [],
215214
"source": [
216-
"# now select just the first point\n",
217-
"catalogs_plugin.table.selected_rows = catalogs_plugin.table.items[0:1]\n",
215+
"# Pick out one source as an example- we will use the source at index 455\n",
216+
"idx = 455\n",
217+
"\n",
218+
"# now select just the matching source\n",
219+
"catalogs_plugin.table.selected_rows = catalogs_plugin.table.items[idx: idx+1]\n",
218220
"\n",
219221
"# and zoom to that point\n",
220222
"catalogs_plugin.zoom_to_selected()"
221223
]
222224
},
225+
{
226+
"cell_type": "code",
227+
"execution_count": null,
228+
"id": "338e9544-f480-4ab7-8751-69316ae8763d",
229+
"metadata": {},
230+
"outputs": [],
231+
"source": [
232+
"# Get the RA and Dec of the selected source\n",
233+
"ra = float(catalogs_plugin.table.items[idx]['Right Ascension (degrees)'])\n",
234+
"dec = float(catalogs_plugin.table.items[idx]['Declination (degrees)'])\n",
235+
"print(f\"RA: {ra}\")\n",
236+
"print(f\"Dec: {dec}\")"
237+
]
238+
},
223239
{
224240
"cell_type": "markdown",
225241
"id": "06025284-99ea-4cd6-bf86-a6e14ffab8f4",
@@ -248,7 +264,8 @@
248264
"# just for demo sake, shift the coordinates a tiny bit from the catalog position so we\n",
249265
"# can use the 'recenter' position. This recreates the scenario of freehand drawing a circular subset\n",
250266
"# rather than placing it at an exact location\n",
251-
"circular_region = CircleSkyRegion(center=SkyCoord(14.77039, -72.16949, unit='degree'), radius=0.0001*u.deg)\n",
267+
"shift = 3. * 0.062 / 3600. # shift by 3 pixels\n",
268+
"circular_region = CircleSkyRegion(center=SkyCoord(ra + shift, dec, unit='degree'), radius=0.0001*u.deg)\n",
252269
"subset_plugin.import_region(circular_region)"
253270
]
254271
},
@@ -342,7 +359,7 @@
342359
"name": "python",
343360
"nbconvert_exporter": "python",
344361
"pygments_lexer": "ipython3",
345-
"version": "3.12.10"
362+
"version": "3.11.14"
346363
}
347364
},
348365
"nbformat": 4,

0 commit comments

Comments
 (0)