Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 92 additions & 25 deletions examples/display_matplotlib.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {
"collapsed": false
},
Expand All @@ -13,7 +13,7 @@
"\n",
"#%matplotlib osx\n",
"\n",
"%matplotlib notebook\n",
"%matplotlib ipympl\n",
"#%config InlineBackend.figure_format = 'retina'\n",
"\n",
"import lsst.afw.display as afwDisplay\n",
Expand All @@ -22,26 +22,41 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {
"collapsed": false,
"scrolled": false
},
"outputs": [],
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"FigureCanvasNbAgg()"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import lsst.afw.geom as afwGeom\n",
"import lsst.afw.image as afwImage\n",
"import lsst.afw.math as afwMath\n",
"\n",
"disp = afwDisplay.Display()\n",
"disp = afwDisplay.Display(0)\n",
"\n",
"im = afwImage.MaskedImageF(100, 50)\n",
"afwMath.randomGaussianImage(im.image, afwMath.Random())\n",
"im.setXY0(10, 5)\n",
"im[0, 0] = 20\n",
"im.mask[0, 0] = im.mask.getPlaneBitMask(\"EDGE\")\n",
"im[-1, -1] = 30\n",
"im.image[50, 22:24] = 40\n",
"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.mask[50, 22] = 0x5\n",
"\n",
"disp.scale(\"asinh\", \"zscale\", Q=8)\n",
Expand All @@ -52,14 +67,29 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [],
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "096f5b9e684b4737962072f3fcf31326",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"FigureCanvasNbAgg()"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"if True:\n",
" disp = afwDisplay.Display()\n",
" disp = afwDisplay.Display(reopenPlot=True)\n",
"\n",
"if True:\n",
" disp.scale(\"asinh\", \"zscale\", Q=8)\n",
Expand All @@ -70,7 +100,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"metadata": {
"collapsed": false,
"scrolled": false
Expand All @@ -84,7 +114,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {
"collapsed": false,
"scrolled": false
Expand All @@ -99,7 +129,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {
"collapsed": false
},
Expand All @@ -110,7 +140,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"metadata": {
"collapsed": false
},
Expand All @@ -121,18 +151,33 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 9,
"metadata": {
"collapsed": false
},
"outputs": [],
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "7be077d6b5634de3a895ddedcec7e6ea",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"FigureCanvasNbAgg()"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"disp2 = afwDisplay.Display(2)"
"disp2 = afwDisplay.Display(2, reopenPlot=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 10,
"metadata": {
"collapsed": true
},
Expand All @@ -144,11 +189,26 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 11,
"metadata": {
"collapsed": false
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Interacting with display 0; hit q to quit; 1, 2, 4, 8, 9 to zoom\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"The module://ipympl.backend_nbagg matplotlib backend doesn't support display._getEvent()\n"
]
}
],
"source": [
"def pan(k, x, y):\n",
" disp.pan(x, y)\n",
Expand All @@ -166,14 +226,21 @@
"print(\"Interacting with display 0; hit q to quit; 1, 2, 4, 8, 9 to zoom\")\n",
"disp.interact()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python [default]",
"display_name": "LSST",
"language": "python",
"name": "python2"
"name": "lsst"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -189,5 +256,5 @@
}
},
"nbformat": 4,
"nbformat_minor": 1
"nbformat_minor": 2
}
Loading