Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-20551: Add a number of bug-fixes and requested features to display_matplotlib #11

Merged
merged 1 commit into from
Feb 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
58 changes: 46 additions & 12 deletions examples/display_matplotlib.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
}
],
"source": [
"import lsst.afw.geom as afwGeom\n",
"import lsst.geom as geom\n",
"import lsst.afw.image as afwImage\n",
"import lsst.afw.math as afwMath\n",
"\n",
Expand All @@ -56,7 +56,7 @@
"im.image[0, 0, afwImage.LOCAL] = 20\n",
"im.mask[10, 5] = im.mask.getPlaneBitMask(\"EDGE\")\n",
"im.image[-1, -1, afwImage.LOCAL] = 30\n",
"im.image[afwGeom.BoxI(afwGeom.PointI(50, 22), afwGeom.ExtentI(1, 2))] = 40\n",
"im.image[geom.BoxI(geom.PointI(50, 22), geom.ExtentI(1, 2))] = 40\n",
"im.mask[50, 22] = 0x5\n",
"\n",
"disp.scale(\"asinh\", \"zscale\", Q=8)\n",
Expand All @@ -75,7 +75,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "096f5b9e684b4737962072f3fcf31326",
"model_id": "",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -88,8 +88,7 @@
}
],
"source": [
"if True:\n",
" disp = afwDisplay.Display(reopenPlot=True)\n",
"disp = afwDisplay.Display(reopenPlot=True)\n",
"\n",
"if True:\n",
" disp.scale(\"asinh\", \"zscale\", Q=8)\n",
Expand Down Expand Up @@ -159,7 +158,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "7be077d6b5634de3a895ddedcec7e6ea",
"model_id": "832e72ed61cf47ee9859c0a6bec58518",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -227,12 +226,47 @@
"disp.interact()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Test ignoring mask planes when setting the scale\n",
"N.b. doesn't currently work with `zscale`"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 16,
"metadata": {},
"outputs": [],
"source": []
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "9518ae12903a42449f82b43e9939ab3c",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"FigureCanvasNbAgg()"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"im = afwImage.MaskedImageF(100, 50)\n",
"afwMath.randomGaussianImage(im.image, afwMath.Random())\n",
"\n",
"sim = im[geom.BoxI(geom.PointI(0, 0), geom.ExtentI(im.getWidth()//2, im.getHeight()))]\n",
"sim.image[:] = 100\n",
"sim.mask[:] = afwImage.Mask.getPlaneBitMask(\"BAD\")\n",
"\n",
"disp = afwDisplay.Display(reopenPlot=True)\n",
"\n",
"disp.scale('asinh', 'minmax', maskedPixels=\"BAD\")\n",
"disp.mtv(im)"
]
}
],
"metadata": {
Expand All @@ -245,14 +279,14 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.12"
"pygments_lexer": "ipython3",
"version": "3.6.6"
}
},
"nbformat": 4,
Expand Down