Skip to content

Commit

Permalink
Delete annotation-based interact documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
jasongrout committed Apr 17, 2017
1 parent 26358e5 commit 6804023
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 778 deletions.
63 changes: 0 additions & 63 deletions docs/source/examples/Image Processing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -345,69 +345,6 @@
"interact(edit_image, image=fixed(img), sigma=(0.0, 10.0, 0.1), \n",
" R=lims, G=lims, B=lims);"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"## Python 3 only: Function annotations and unicode identifiers"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"In Python 3, we can use the new function annotation syntax to describe widgets for interact, as well as unicode names for variables such as sigma. Note how this syntax also lets us define default values for each control in a convenient (if slightly awkward looking) form: `var:descriptor=default`."
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/scorlay/dev/ipython/traitlets/traitlets/traitlets.py:565: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.\n",
" silent = bool(old_value == new_value)\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "dd1f614410fd4c6b816ede23dda7cd70"
}
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"lims = (0.0, 1.0, 0.01)\n",
"\n",
"@interact\n",
"def edit_image(image: fixed(img), σ:(0.0, 10.0, 0.1)=0, \n",
" R:lims=1.0, G:lims=1.0, B:lims=1.0):\n",
" new_image = filters.gaussian_filter(image, sigma=σ, multichannel=True)\n",
" if new_image.ndim == 3:\n",
" new_image[:,:,0] = R*new_image[:,:,0]\n",
" new_image[:,:,1] = G*new_image[:,:,1]\n",
" new_image[:,:,2] = B*new_image[:,:,2]\n",
" else:\n",
" new_image = G*new_image\n",
" return arr2img(new_image)"
]
}
],
"metadata": {
Expand Down
Loading

0 comments on commit 6804023

Please sign in to comment.