|
| 1 | +--- |
| 2 | +jupyter: |
| 3 | + jupytext: |
| 4 | + text_representation: |
| 5 | + extension: .md |
| 6 | + format_name: markdown |
| 7 | + format_version: '1.3' |
| 8 | + jupytext_version: 1.13.7 |
| 9 | + kernelspec: |
| 10 | + display_name: Python 3 |
| 11 | + language: python |
| 12 | + name: python3 |
| 13 | +--- |
| 14 | + |
| 15 | +<!-- #region slideshow={"slide_type": "slide"} --> |
| 16 | +## Sharing scientific tools: script to desktop application |
| 17 | + |
| 18 | +**Jonathan Rocher, Siddhant Wahal, Jason Chambless, Corran Webster, Prabhu Ramachandran** |
| 19 | + |
| 20 | +**SciPy 2022** |
| 21 | + |
| 22 | +<!-- #endregion --> |
| 23 | + |
| 24 | +<!-- #region slideshow={"slide_type": "slide"} --> |
| 25 | +## Preliminaries |
| 26 | + |
| 27 | +If you haven't already: |
| 28 | +- Clone the repository: https://github.com/jonathanrocher/ets_tutorial |
| 29 | +- Install packages: |
| 30 | + - Using Enthought Deployment Manager (recommended) |
| 31 | + (https://www.enthought.com/edm): |
| 32 | + |
| 33 | + ```bash |
| 34 | + edm envs create bootstrap |
| 35 | + edm install --environment bootstrap click |
| 36 | + edm run -e bootstrap -- python ci build --environment ets_tutorial |
| 37 | + ``` |
| 38 | + - `ets_tutorial` will be our working Python environment. To activate: |
| 39 | + ```bash |
| 40 | + edm shell -e ets_tutorial |
| 41 | + ``` |
| 42 | + - Follow instructions in README for conda and pip |
| 43 | +<!-- #endregion --> |
| 44 | + |
| 45 | + |
| 46 | +<!-- #region slideshow={"slide_type": "slide"} --> |
| 47 | +## Motivation |
| 48 | + |
| 49 | +- Some tasks are easier with a GUI |
| 50 | +- Seeing a lot of information in one shot |
| 51 | +- Easier for non-programmers |
| 52 | +- Easier to share |
| 53 | + |
| 54 | +<!-- #endregion --> |
| 55 | + |
| 56 | +<!-- #region slideshow={"slide_type": "slide"} --> |
| 57 | +## Why ETS? |
| 58 | + |
| 59 | +- Mature |
| 60 | +- Easy to use |
| 61 | +- Design promotes reusable code |
| 62 | +- Largely declarative UI |
| 63 | +- PyQt/PySide and wxPython support |
| 64 | + |
| 65 | +<!-- #endregion --> |
| 66 | + |
| 67 | +<!-- #region slideshow={"slide_type": "slide"} --> |
| 68 | +## What is ETS? |
| 69 | + |
| 70 | +- Enthought Tool Suite: https://docs.enthought.com/ets |
| 71 | +- Open Source |
| 72 | +- Packages |
| 73 | + - Traits: Python object attributes on steroids |
| 74 | + - TraitsUI: Easy GUI-building |
| 75 | + - PyFace: Low-level GUI components |
| 76 | + - Envisage: plug-in application framework |
| 77 | + - Chaco: interactive plotting library |
| 78 | + - Mayavi: 3D plotting |
| 79 | + - And others |
| 80 | + |
| 81 | +<!-- #endregion --> |
| 82 | + |
| 83 | +<!-- #region slideshow={"slide_type": "slide"} --> |
| 84 | +## Layered package design |
| 85 | + |
| 86 | +<center> |
| 87 | +<img src="images/layers.png" height="90%" align="center"/> |
| 88 | +</center> |
| 89 | + |
| 90 | +<!-- #endregion --> |
| 91 | + |
| 92 | + |
| 93 | +<!-- #region slideshow={"slide_type": "slide"} --> |
| 94 | +## Sample screenshots |
| 95 | + |
| 96 | +- Can make quite sophisticated UIs |
| 97 | +- Much less code |
| 98 | +- Easy to write |
| 99 | + |
| 100 | +<!-- #endregion --> |
| 101 | + |
| 102 | +<!-- #region slideshow={"slide_type": "slide"} --> |
| 103 | +## A Mayavi-based dialog |
| 104 | + |
| 105 | +<center> |
| 106 | +<img src="images/lorenz_ui.png" height="90%" align="center"/> |
| 107 | +</center> |
| 108 | + |
| 109 | +<!-- #endregion --> |
| 110 | + |
| 111 | +<!-- #region slideshow={"slide_type": "slide"} --> |
| 112 | +## A customized viewer |
| 113 | + |
| 114 | +<center> |
| 115 | +<img src="images/pysph_viewer.png" height="90%" align="center"/> |
| 116 | +</center> |
| 117 | + |
| 118 | +<!-- #endregion --> |
| 119 | + |
| 120 | + |
| 121 | +<!-- #region slideshow={"slide_type": "slide"} --> |
| 122 | +## Goals |
| 123 | + |
| 124 | +- Start with simple Python script |
| 125 | + - Detect faces |
| 126 | + - Extract Image metadata |
| 127 | + |
| 128 | +- Build a full-fledged desktop application |
| 129 | + - Easy to use UI |
| 130 | + - Learn a little MVC |
| 131 | + - Design application to scale |
| 132 | +- Share the application with others |
| 133 | + |
| 134 | +<!-- #endregion --> |
| 135 | + |
| 136 | +<!-- #region slideshow={"slide_type": "slide"} --> |
| 137 | +## Result |
| 138 | + |
| 139 | +Final application we will be building in this tutorial: |
| 140 | + |
| 141 | +<img src="../pycasa_final.png" height="90%" width="90%" align="center"/> |
| 142 | + |
| 143 | +<!-- #endregion --> |
| 144 | + |
| 145 | +<!-- #region slideshow={"slide_type": "slide"} --> |
| 146 | +## Schedule |
| 147 | + |
| 148 | +- Step 1: Python script |
| 149 | +- Step 2: Using Traits. |
| 150 | +- Step 3: Basic GUI using TraitsUI |
| 151 | +- Step 4: PyFace application: tree navigator |
| 152 | +- Step 5: More features |
| 153 | +- Step 6: Menus and branding |
| 154 | +- Step 7: [OPTIONAL] Advanced features |
| 155 | +- Step 8: Packaging and sharing |
| 156 | + |
| 157 | + |
| 158 | +<!-- #endregion --> |
| 159 | + |
| 160 | +<!-- #region slideshow={"slide_type": "slide"} --> |
| 161 | +## Basic Python script |
| 162 | + |
| 163 | +- Uses: `PIL`, `skimage`, and `matplotlib` |
| 164 | +- Detects faces in a given image |
| 165 | +- Look inside ... |
| 166 | + |
| 167 | +<!-- #endregion --> |
| 168 | + |
| 169 | +<!-- #region slideshow={"slide_type": "slide"} --> |
| 170 | +## Next steps |
| 171 | + |
| 172 | +- Learn more about traits |
| 173 | +- Build a clean model for our task with traits |
| 174 | +- Learn why models are useful |
| 175 | + |
| 176 | +<!-- #endregion --> |
0 commit comments