Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit 3a2e91d

Browse files
author
Leanne Guy
committed
WIP
1 parent 77b126e commit 3a2e91d

1 file changed

Lines changed: 26 additions & 25 deletions

File tree

08_Interactive_Image_Visualization.ipynb

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@
538538
"metadata": {},
539539
"outputs": [],
540540
"source": [
541-
"# %%opts Scatter [tools=['hover'], toolbar='above',height=400, width=400](color='grey')\n",
541+
"%%opts Scatter [tools=['hover'], toolbar='above',height=400, width=400](color='grey')\n",
542542
"hv.Scatter(data)"
543543
]
544544
},
@@ -601,7 +601,7 @@
601601
"cell_type": "markdown",
602602
"metadata": {},
603603
"source": [
604-
"First, we will use the `astropy.visualization` library to define an asinh stretch and zscale interval and apply them to the calexp object. These are the same transformation that were applied in `03_Image_Display_and_Manipulation` notebook."
604+
"First, we will use the `astropy.visualization` library to define an asinh stretch and zscale interval and apply them to the calexp object. These are the same transformations that were applied in `03_Image_Display_and_Manipulation` notebook."
605605
]
606606
},
607607
{
@@ -619,14 +619,7 @@
619619
"cell_type": "markdown",
620620
"metadata": {},
621621
"source": [
622-
"A note on [Image Indexing, Array Views, and Bounding Boxes](https://pipelines.lsst.io/modules/lsst.afw.image/indexing-conventions.html) in the Rubin Science Pipelines and Data Products. "
623-
]
624-
},
625-
{
626-
"cell_type": "markdown",
627-
"metadata": {},
628-
"source": [
629-
"Define the (left, bottom, top, right) edges of the sensor image."
622+
"LSST’s image classes (Image, Mask, MaskedImage, and Exposure) use a pixel indexing convention that is different from both the convention used by `numpy.ndarray` objects and the convention used in FITS images. LSST typically labels the center of the lower left pixel of an image (0, 0). Consequently, we need to flip the image data array, "
630623
]
631624
},
632625
{
@@ -635,24 +628,16 @@
635628
"metadata": {},
636629
"outputs": [],
637630
"source": [
631+
"scaledImage = np.flipud(scaledImage)\n",
632+
"# bounds_img = (0, calexp.getDimensions()[1], calexp.getDimensions()[0],0)\n",
638633
"bounds_img = (0, 0, calexp.getDimensions()[0], calexp.getDimensions()[1])"
639634
]
640635
},
641636
{
642637
"cell_type": "markdown",
643638
"metadata": {},
644639
"source": [
645-
"We will use the matplotlib convention of placing the origin of an plot in the top left, we need to flip the data."
646-
]
647-
},
648-
{
649-
"cell_type": "code",
650-
"execution_count": null,
651-
"metadata": {},
652-
"outputs": [],
653-
"source": [
654-
"scaledImage = np.flipud(scaledImage)\n",
655-
"bounds_img = (0, calexp.getDimensions()[1], calexp.getDimensions()[0],0)"
640+
"Further details can be found at [Image Indexing, Array Views, and Bounding Boxes](https://pipelines.lsst.io/modules/lsst.afw.image/indexing-conventions.html) in the Rubin Science Pipelines and Data Products. "
656641
]
657642
},
658643
{
@@ -692,7 +677,7 @@
692677
"source": [
693678
"# Create the Image element.\n",
694679
"img = hv.Image(scaledImage, bounds=bounds_img,\n",
695-
" kdims=['x-axis', 'y-axis']).opts(\n",
680+
" kdims=['x', 'y']).opts(\n",
696681
" cmap = \"Greys_r\", xlabel = 'X', ylabel ='Y',\n",
697682
" title = dataIdToString(calexpId),\n",
698683
" **img_opts)"
@@ -981,8 +966,16 @@
981966
"right.x_range = Range1d(-1.5, 2.5)\n",
982967
"right.y_range = Range1d(32., 16.)\n",
983968
"right.xaxis.axis_label = 'g - r'\n",
984-
"right.yaxis.axis_label = 'g'\n",
985-
"\n",
969+
"right.yaxis.axis_label = 'g'"
970+
]
971+
},
972+
{
973+
"cell_type": "code",
974+
"execution_count": null,
975+
"metadata": {},
976+
"outputs": [],
977+
"source": [
978+
"# Display the grid of plots\n",
986979
"p = gridplot([[left, right]])\n",
987980
"show(p)"
988981
]
@@ -1103,7 +1096,15 @@
11031096
" legend_field=\"truth_type\",\n",
11041097
" color=factor_cmap('truth_type', 'Category10_3',\n",
11051098
" ['galaxy', 'star', 'SNe']))\n",
1106-
"p.add_tools(hover)\n",
1099+
"p.add_tools(hover)"
1100+
]
1101+
},
1102+
{
1103+
"cell_type": "code",
1104+
"execution_count": null,
1105+
"metadata": {},
1106+
"outputs": [],
1107+
"source": [
11071108
"show(p)"
11081109
]
11091110
},

0 commit comments

Comments
 (0)