|
15 | 15 | "source": [ |
16 | 16 | "# Jdaviz Imviz Demo\n", |
17 | 17 | "**Author: Clare Shanahan, Space Telescope Science Institute**<br>\n", |
18 | | - "**Last update: May 27, 2025**\n", |
| 18 | + "**Last update: Oct 30, 2025**\n", |
19 | 19 | "\n", |
20 | 20 | "## Tutorial Overview\n", |
21 | 21 | "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 | 73 | "metadata": {}, |
74 | 74 | "outputs": [], |
75 | 75 | "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", |
80 | 79 | "with imviz.batch_load(): # not necessary, but this context manager makes loading multiple files more efficient \n", |
81 | 80 | " 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" |
84 | 83 | ] |
85 | 84 | }, |
86 | 85 | { |
|
145 | 144 | "plot_options.stretch_preset = '99.5%'\n", |
146 | 145 | "\n", |
147 | 146 | "# increase vmax to a more suitable value\n", |
148 | | - "plot_options.stretch_vmax = 600" |
| 147 | + "plot_options.stretch_vmax = 6" |
149 | 148 | ] |
150 | 149 | }, |
151 | 150 | { |
|
193 | 192 | "# select Gaia catalog\n", |
194 | 193 | "catalogs_plugin.catalog.selected = 'Gaia'\n", |
195 | 194 | "\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", |
198 | 197 | "\n", |
199 | 198 | "# and run the search\n", |
200 | 199 | "catalogs_plugin.search()\n", |
|
213 | 212 | "metadata": {}, |
214 | 213 | "outputs": [], |
215 | 214 | "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", |
218 | 220 | "\n", |
219 | 221 | "# and zoom to that point\n", |
220 | 222 | "catalogs_plugin.zoom_to_selected()" |
221 | 223 | ] |
222 | 224 | }, |
| 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 | + }, |
223 | 239 | { |
224 | 240 | "cell_type": "markdown", |
225 | 241 | "id": "06025284-99ea-4cd6-bf86-a6e14ffab8f4", |
|
248 | 264 | "# just for demo sake, shift the coordinates a tiny bit from the catalog position so we\n", |
249 | 265 | "# can use the 'recenter' position. This recreates the scenario of freehand drawing a circular subset\n", |
250 | 266 | "# 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", |
252 | 269 | "subset_plugin.import_region(circular_region)" |
253 | 270 | ] |
254 | 271 | }, |
|
342 | 359 | "name": "python", |
343 | 360 | "nbconvert_exporter": "python", |
344 | 361 | "pygments_lexer": "ipython3", |
345 | | - "version": "3.12.10" |
| 362 | + "version": "3.11.14" |
346 | 363 | } |
347 | 364 | }, |
348 | 365 | "nbformat": 4, |
|
0 commit comments