Spaces:
Sleeping
Sleeping
camilleseab
commited on
Commit
•
334a887
1
Parent(s):
7a92a38
First test run
Browse files- .github/workflows/update-hf.yml +1 -1
- Dockerfile +1 -1
- app.ipynb +114 -0
- environment.yml +5 -10
- notebooks/basics.ipynb +0 -88
- notebooks/bqplot.ipynb +0 -62
- notebooks/dashboard.ipynb +0 -148
- notebooks/ipympl.ipynb +0 -110
- notebooks/ipyvolume.ipynb +0 -44
- notebooks/mimerenderers.ipynb +0 -489
- notebooks/reveal.ipynb +0 -92
.github/workflows/update-hf.yml
CHANGED
@@ -17,4 +17,4 @@ jobs:
|
|
17 |
env:
|
18 |
HF_USER: ${{ secrets.HF_USER }}
|
19 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
20 |
-
run: git push https://$HF_USER:$HF_TOKEN@huggingface.co/spaces/
|
|
|
17 |
env:
|
18 |
HF_USER: ${{ secrets.HF_USER }}
|
19 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
20 |
+
run: git push https://$HF_USER:$HF_TOKEN@huggingface.co/spaces/camilleseab/surveillance main --force
|
Dockerfile
CHANGED
@@ -17,4 +17,4 @@ RUN mamba env create --prefix $HOME/env -f ./environment.yml
|
|
17 |
EXPOSE 7860
|
18 |
WORKDIR $HOME/app
|
19 |
|
20 |
-
CMD mamba run -p $HOME/env --no-capture-output voila --no-browser
|
|
|
17 |
EXPOSE 7860
|
18 |
WORKDIR $HOME/app
|
19 |
|
20 |
+
CMD mamba run -p $HOME/env --no-capture-output voila --no-browser app.ipynb
|
app.ipynb
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": null,
|
6 |
+
"metadata": {},
|
7 |
+
"outputs": [],
|
8 |
+
"source": [
|
9 |
+
"import ipywidgets as widgets"
|
10 |
+
]
|
11 |
+
},
|
12 |
+
{
|
13 |
+
"cell_type": "code",
|
14 |
+
"execution_count": null,
|
15 |
+
"metadata": {},
|
16 |
+
"outputs": [],
|
17 |
+
"source": [
|
18 |
+
"DEFAULTS = {\n",
|
19 |
+
" 'size': 640,\n",
|
20 |
+
" 'heading': 140,\n",
|
21 |
+
" 'pitch': 10,\n",
|
22 |
+
" 'fov': 50\n",
|
23 |
+
"}"
|
24 |
+
]
|
25 |
+
},
|
26 |
+
{
|
27 |
+
"cell_type": "code",
|
28 |
+
"execution_count": null,
|
29 |
+
"metadata": {},
|
30 |
+
"outputs": [],
|
31 |
+
"source": [
|
32 |
+
"output = widgets.Output()\n",
|
33 |
+
"lbl_style = {'description_width': '200px'}\n",
|
34 |
+
"layout = widgets.Layout(width='600px')\n",
|
35 |
+
"location = widgets.Text(value='33rd & Loch Raven Baltimore MD',\n",
|
36 |
+
" description='Location',\n",
|
37 |
+
" layout=layout,\n",
|
38 |
+
" style=lbl_style)\n",
|
39 |
+
"size = widgets.IntSlider(value=DEFAULTS['size'],\n",
|
40 |
+
" min=100,\n",
|
41 |
+
" max=1024,\n",
|
42 |
+
" layout=layout,\n",
|
43 |
+
" style=lbl_style,\n",
|
44 |
+
" description='Image size')\n",
|
45 |
+
"heading = widgets.IntSlider(value=DEFAULTS['heading'],\n",
|
46 |
+
" min=0,\n",
|
47 |
+
" max=360,\n",
|
48 |
+
" layout=layout,\n",
|
49 |
+
" style=lbl_style,\n",
|
50 |
+
" description='Heading (rotation)')\n",
|
51 |
+
"pitch = widgets.IntSlider(value=DEFAULTS['pitch'],\n",
|
52 |
+
" min=0,\n",
|
53 |
+
" max=40,\n",
|
54 |
+
" layout=layout,\n",
|
55 |
+
" style=lbl_style,\n",
|
56 |
+
" description='Pitch (tilt)')\n",
|
57 |
+
"fov = widgets.IntSlider(value=DEFAULTS['fov'],\n",
|
58 |
+
" min=10,\n",
|
59 |
+
" max=120,\n",
|
60 |
+
" layout=layout,\n",
|
61 |
+
" style=lbl_style,\n",
|
62 |
+
" description='Field of view (zoom)')\n",
|
63 |
+
"\n",
|
64 |
+
"button = widgets.Button(description='Get image')\n",
|
65 |
+
"\n",
|
66 |
+
"display(location, size, heading, pitch, fov, button, output)\n",
|
67 |
+
"\n",
|
68 |
+
"\n",
|
69 |
+
"def button_click(b):\n",
|
70 |
+
" with output:\n",
|
71 |
+
" output.clear_output()\n",
|
72 |
+
" txt = f'test: location = {location.value}'\n",
|
73 |
+
" print(txt)\n",
|
74 |
+
" return txt\n",
|
75 |
+
"\n",
|
76 |
+
"sv_img = button.on_click(button_click)\n"
|
77 |
+
]
|
78 |
+
},
|
79 |
+
{
|
80 |
+
"cell_type": "code",
|
81 |
+
"execution_count": null,
|
82 |
+
"metadata": {},
|
83 |
+
"outputs": [],
|
84 |
+
"source": []
|
85 |
+
},
|
86 |
+
{
|
87 |
+
"cell_type": "code",
|
88 |
+
"execution_count": null,
|
89 |
+
"metadata": {},
|
90 |
+
"outputs": [],
|
91 |
+
"source": []
|
92 |
+
},
|
93 |
+
{
|
94 |
+
"cell_type": "code",
|
95 |
+
"execution_count": null,
|
96 |
+
"metadata": {},
|
97 |
+
"outputs": [],
|
98 |
+
"source": []
|
99 |
+
}
|
100 |
+
],
|
101 |
+
"metadata": {
|
102 |
+
"kernelspec": {
|
103 |
+
"display_name": "voila",
|
104 |
+
"language": "python",
|
105 |
+
"name": "python3"
|
106 |
+
},
|
107 |
+
"language_info": {
|
108 |
+
"name": "python",
|
109 |
+
"version": "3.11.5"
|
110 |
+
}
|
111 |
+
},
|
112 |
+
"nbformat": 4,
|
113 |
+
"nbformat_minor": 2
|
114 |
+
}
|
environment.yml
CHANGED
@@ -2,19 +2,14 @@ name: voila
|
|
2 |
channels:
|
3 |
- conda-forge
|
4 |
dependencies:
|
5 |
-
- python=3.
|
6 |
- ipywidgets
|
7 |
- ipykernel
|
8 |
-
- pandas
|
9 |
- pip
|
10 |
-
-
|
11 |
-
-
|
12 |
-
-
|
13 |
-
-
|
14 |
-
- matplotlib
|
15 |
-
- scipy
|
16 |
-
- vega_datasets
|
17 |
-
- ipyvolume
|
18 |
|
19 |
- pip:
|
20 |
- voila==0.5.0
|
|
|
2 |
channels:
|
3 |
- conda-forge
|
4 |
dependencies:
|
5 |
+
- python=3.11.5
|
6 |
- ipywidgets
|
7 |
- ipykernel
|
|
|
8 |
- pip
|
9 |
+
- ultralytics=8.0.186
|
10 |
+
- pillow
|
11 |
+
- python-dotenv
|
12 |
+
- opencv
|
|
|
|
|
|
|
|
|
13 |
|
14 |
- pip:
|
15 |
- voila==0.5.0
|
notebooks/basics.ipynb
DELETED
@@ -1,88 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"cells": [
|
3 |
-
{
|
4 |
-
"cell_type": "markdown",
|
5 |
-
"source": [
|
6 |
-
"# So easy, *voilà*!\n",
|
7 |
-
"\n",
|
8 |
-
"In this example notebook, we demonstrate how Voilà can render Jupyter notebooks with interactions requiring a roundtrip to the kernel."
|
9 |
-
],
|
10 |
-
"metadata": {}
|
11 |
-
},
|
12 |
-
{
|
13 |
-
"cell_type": "markdown",
|
14 |
-
"source": [
|
15 |
-
"## Jupyter Widgets"
|
16 |
-
],
|
17 |
-
"metadata": {}
|
18 |
-
},
|
19 |
-
{
|
20 |
-
"cell_type": "code",
|
21 |
-
"execution_count": null,
|
22 |
-
"source": [
|
23 |
-
"import ipywidgets as widgets\n",
|
24 |
-
"\n",
|
25 |
-
"slider = widgets.FloatSlider(description='$x$')\n",
|
26 |
-
"text = widgets.FloatText(disabled=True, description='$x^2$')\n",
|
27 |
-
"\n",
|
28 |
-
"def compute(*ignore):\n",
|
29 |
-
" text.value = str(slider.value ** 2)\n",
|
30 |
-
"\n",
|
31 |
-
"slider.observe(compute, 'value')\n",
|
32 |
-
"\n",
|
33 |
-
"slider.value = 4\n",
|
34 |
-
"\n",
|
35 |
-
"widgets.VBox([slider, text])"
|
36 |
-
],
|
37 |
-
"outputs": [],
|
38 |
-
"metadata": {}
|
39 |
-
},
|
40 |
-
{
|
41 |
-
"cell_type": "markdown",
|
42 |
-
"source": [
|
43 |
-
"## Basic outputs of code cells"
|
44 |
-
],
|
45 |
-
"metadata": {}
|
46 |
-
},
|
47 |
-
{
|
48 |
-
"cell_type": "code",
|
49 |
-
"execution_count": null,
|
50 |
-
"source": [
|
51 |
-
"import pandas as pd\n",
|
52 |
-
"\n",
|
53 |
-
"iris = pd.read_csv('https://raw.githubusercontent.com/mwaskom/seaborn-data/master/iris.csv')\n",
|
54 |
-
"iris"
|
55 |
-
],
|
56 |
-
"outputs": [],
|
57 |
-
"metadata": {}
|
58 |
-
},
|
59 |
-
{
|
60 |
-
"cell_type": "code",
|
61 |
-
"execution_count": null,
|
62 |
-
"source": [],
|
63 |
-
"outputs": [],
|
64 |
-
"metadata": {}
|
65 |
-
}
|
66 |
-
],
|
67 |
-
"metadata": {
|
68 |
-
"kernelspec": {
|
69 |
-
"display_name": "Python 3",
|
70 |
-
"language": "python",
|
71 |
-
"name": "python3"
|
72 |
-
},
|
73 |
-
"language_info": {
|
74 |
-
"codemirror_mode": {
|
75 |
-
"name": "ipython",
|
76 |
-
"version": 3
|
77 |
-
},
|
78 |
-
"file_extension": ".py",
|
79 |
-
"mimetype": "text/x-python",
|
80 |
-
"name": "python",
|
81 |
-
"nbconvert_exporter": "python",
|
82 |
-
"pygments_lexer": "ipython3",
|
83 |
-
"version": "3.8.5"
|
84 |
-
}
|
85 |
-
},
|
86 |
-
"nbformat": 4,
|
87 |
-
"nbformat_minor": 4
|
88 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
notebooks/bqplot.ipynb
DELETED
@@ -1,62 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"cells": [
|
3 |
-
{
|
4 |
-
"cell_type": "markdown",
|
5 |
-
"metadata": {},
|
6 |
-
"source": [
|
7 |
-
"# So easy, *voilà*!\n",
|
8 |
-
"\n",
|
9 |
-
"In this example notebook, we demonstrate how Voilà can render custom Jupyter widgets such as [bqplot](https://github.com/bloomberg/bqplot). "
|
10 |
-
]
|
11 |
-
},
|
12 |
-
{
|
13 |
-
"cell_type": "code",
|
14 |
-
"execution_count": null,
|
15 |
-
"metadata": {},
|
16 |
-
"outputs": [],
|
17 |
-
"source": [
|
18 |
-
"import warnings\n",
|
19 |
-
"warnings.filterwarnings('ignore')"
|
20 |
-
]
|
21 |
-
},
|
22 |
-
{
|
23 |
-
"cell_type": "code",
|
24 |
-
"execution_count": null,
|
25 |
-
"metadata": {},
|
26 |
-
"outputs": [],
|
27 |
-
"source": [
|
28 |
-
"import numpy as np\n",
|
29 |
-
"from bqplot import pyplot as plt\n",
|
30 |
-
"\n",
|
31 |
-
"plt.figure(1, title='Line Chart')\n",
|
32 |
-
"np.random.seed(0)\n",
|
33 |
-
"n = 200\n",
|
34 |
-
"x = np.linspace(0.0, 10.0, n)\n",
|
35 |
-
"y = np.cumsum(np.random.randn(n))\n",
|
36 |
-
"plt.plot(x, y)\n",
|
37 |
-
"plt.show()"
|
38 |
-
]
|
39 |
-
}
|
40 |
-
],
|
41 |
-
"metadata": {
|
42 |
-
"kernelspec": {
|
43 |
-
"display_name": "Python 3",
|
44 |
-
"language": "python",
|
45 |
-
"name": "python3"
|
46 |
-
},
|
47 |
-
"language_info": {
|
48 |
-
"codemirror_mode": {
|
49 |
-
"name": "ipython",
|
50 |
-
"version": 3
|
51 |
-
},
|
52 |
-
"file_extension": ".py",
|
53 |
-
"mimetype": "text/x-python",
|
54 |
-
"name": "python",
|
55 |
-
"nbconvert_exporter": "python",
|
56 |
-
"pygments_lexer": "ipython3",
|
57 |
-
"version": "3.7.3"
|
58 |
-
}
|
59 |
-
},
|
60 |
-
"nbformat": 4,
|
61 |
-
"nbformat_minor": 2
|
62 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
notebooks/dashboard.ipynb
DELETED
@@ -1,148 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"cells": [
|
3 |
-
{
|
4 |
-
"cell_type": "markdown",
|
5 |
-
"metadata": {},
|
6 |
-
"source": [
|
7 |
-
"This demo uses Voilà to render a notebook to a custom HTML page using gridstack.js for the layout of each output. In the cell metadata you can change the default cell with and height (in grid units between 1 and 12) by specifying.\n",
|
8 |
-
" * `grid_row`\n",
|
9 |
-
" * `grid_columns`"
|
10 |
-
]
|
11 |
-
},
|
12 |
-
{
|
13 |
-
"cell_type": "code",
|
14 |
-
"execution_count": null,
|
15 |
-
"metadata": {},
|
16 |
-
"outputs": [],
|
17 |
-
"source": [
|
18 |
-
"import numpy as np\n",
|
19 |
-
"n = 200\n",
|
20 |
-
"\n",
|
21 |
-
"x = np.linspace(0.0, 10.0, n)\n",
|
22 |
-
"y = np.cumsum(np.random.randn(n)*10).astype(int)\n"
|
23 |
-
]
|
24 |
-
},
|
25 |
-
{
|
26 |
-
"cell_type": "code",
|
27 |
-
"execution_count": null,
|
28 |
-
"metadata": {},
|
29 |
-
"outputs": [],
|
30 |
-
"source": [
|
31 |
-
"import ipywidgets as widgets"
|
32 |
-
]
|
33 |
-
},
|
34 |
-
{
|
35 |
-
"cell_type": "code",
|
36 |
-
"execution_count": null,
|
37 |
-
"metadata": {},
|
38 |
-
"outputs": [],
|
39 |
-
"source": [
|
40 |
-
"label_selected = widgets.Label(value=\"Selected: 0\")\n",
|
41 |
-
"label_selected"
|
42 |
-
]
|
43 |
-
},
|
44 |
-
{
|
45 |
-
"cell_type": "code",
|
46 |
-
"execution_count": null,
|
47 |
-
"metadata": {
|
48 |
-
"grid_columns": 8,
|
49 |
-
"grid_rows": 4
|
50 |
-
},
|
51 |
-
"outputs": [],
|
52 |
-
"source": [
|
53 |
-
"import numpy as np\n",
|
54 |
-
"from bqplot import pyplot as plt\n",
|
55 |
-
"import bqplot\n",
|
56 |
-
"\n",
|
57 |
-
"fig = plt.figure( title='Histogram')\n",
|
58 |
-
"np.random.seed(0)\n",
|
59 |
-
"hist = plt.hist(y, bins=25)\n",
|
60 |
-
"hist.scales['sample'].min = float(y.min())\n",
|
61 |
-
"hist.scales['sample'].max = float(y.max())\n",
|
62 |
-
"display(fig)\n",
|
63 |
-
"fig.layout.width = 'auto'\n",
|
64 |
-
"fig.layout.height = 'auto'\n",
|
65 |
-
"fig.layout.min_height = '300px' # so it shows nicely in the notebook\n",
|
66 |
-
"fig.layout.flex = '1'"
|
67 |
-
]
|
68 |
-
},
|
69 |
-
{
|
70 |
-
"cell_type": "code",
|
71 |
-
"execution_count": null,
|
72 |
-
"metadata": {
|
73 |
-
"grid_columns": 12,
|
74 |
-
"grid_rows": 6
|
75 |
-
},
|
76 |
-
"outputs": [],
|
77 |
-
"source": [
|
78 |
-
"import numpy as np\n",
|
79 |
-
"from bqplot import pyplot as plt\n",
|
80 |
-
"import bqplot\n",
|
81 |
-
"\n",
|
82 |
-
"fig = plt.figure( title='Line Chart')\n",
|
83 |
-
"np.random.seed(0)\n",
|
84 |
-
"n = 200\n",
|
85 |
-
"p = plt.plot(x, y)\n",
|
86 |
-
"fig"
|
87 |
-
]
|
88 |
-
},
|
89 |
-
{
|
90 |
-
"cell_type": "code",
|
91 |
-
"execution_count": null,
|
92 |
-
"metadata": {},
|
93 |
-
"outputs": [],
|
94 |
-
"source": [
|
95 |
-
"fig.layout.width = 'auto'\n",
|
96 |
-
"fig.layout.height = 'auto'\n",
|
97 |
-
"fig.layout.min_height = '300px' # so it shows nicely in the notebook\n",
|
98 |
-
"fig.layout.flex = '1'"
|
99 |
-
]
|
100 |
-
},
|
101 |
-
{
|
102 |
-
"cell_type": "code",
|
103 |
-
"execution_count": null,
|
104 |
-
"metadata": {},
|
105 |
-
"outputs": [],
|
106 |
-
"source": [
|
107 |
-
"brushintsel = bqplot.interacts.BrushIntervalSelector(scale=p.scales['x'])"
|
108 |
-
]
|
109 |
-
},
|
110 |
-
{
|
111 |
-
"cell_type": "code",
|
112 |
-
"execution_count": null,
|
113 |
-
"metadata": {},
|
114 |
-
"outputs": [],
|
115 |
-
"source": [
|
116 |
-
"def update_range(*args):\n",
|
117 |
-
" label_selected.value = \"Selected range {}\".format(brushintsel.selected)\n",
|
118 |
-
" mask = (x > brushintsel.selected[0]) & (x < brushintsel.selected[1])\n",
|
119 |
-
" hist.sample = y[mask]\n",
|
120 |
-
" \n",
|
121 |
-
"brushintsel.observe(update_range, 'selected')\n",
|
122 |
-
"fig.interaction = brushintsel"
|
123 |
-
]
|
124 |
-
}
|
125 |
-
],
|
126 |
-
"metadata": {
|
127 |
-
"celltoolbar": "Edit Metadata",
|
128 |
-
"kernelspec": {
|
129 |
-
"display_name": "Python 3",
|
130 |
-
"language": "python",
|
131 |
-
"name": "python3"
|
132 |
-
},
|
133 |
-
"language_info": {
|
134 |
-
"codemirror_mode": {
|
135 |
-
"name": "ipython",
|
136 |
-
"version": 3
|
137 |
-
},
|
138 |
-
"file_extension": ".py",
|
139 |
-
"mimetype": "text/x-python",
|
140 |
-
"name": "python",
|
141 |
-
"nbconvert_exporter": "python",
|
142 |
-
"pygments_lexer": "ipython3",
|
143 |
-
"version": "3.6.4"
|
144 |
-
}
|
145 |
-
},
|
146 |
-
"nbformat": 4,
|
147 |
-
"nbformat_minor": 2
|
148 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
notebooks/ipympl.ipynb
DELETED
@@ -1,110 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"cells": [
|
3 |
-
{
|
4 |
-
"cell_type": "markdown",
|
5 |
-
"metadata": {},
|
6 |
-
"source": [
|
7 |
-
"# So easy, *voilà*!\n",
|
8 |
-
"\n",
|
9 |
-
"In this example notebook, we demonstrate how Voilà can render custom interactive matplotlib figures using the [ipympl](https://github.com/matplotlib/ipympl) widget."
|
10 |
-
]
|
11 |
-
},
|
12 |
-
{
|
13 |
-
"cell_type": "code",
|
14 |
-
"execution_count": null,
|
15 |
-
"metadata": {},
|
16 |
-
"outputs": [],
|
17 |
-
"source": [
|
18 |
-
"%matplotlib widget\n",
|
19 |
-
"import ipympl\n",
|
20 |
-
"\n",
|
21 |
-
"import numpy as np\n",
|
22 |
-
"import matplotlib.pyplot as plt\n",
|
23 |
-
"\n",
|
24 |
-
"x = np.linspace(0, 2 * np.pi, 500)\n",
|
25 |
-
"y1 = np.sin(x)\n",
|
26 |
-
"y2 = np.sin(3 * x)\n",
|
27 |
-
"\n",
|
28 |
-
"fig, ax = plt.subplots()\n",
|
29 |
-
"ax.fill(x, y1, 'b', x, y2, 'r', alpha=0.3)\n",
|
30 |
-
"plt.show()"
|
31 |
-
]
|
32 |
-
},
|
33 |
-
{
|
34 |
-
"cell_type": "code",
|
35 |
-
"execution_count": null,
|
36 |
-
"metadata": {},
|
37 |
-
"outputs": [],
|
38 |
-
"source": [
|
39 |
-
"import numpy as np\n",
|
40 |
-
"import matplotlib.pyplot as plt\n",
|
41 |
-
"\n",
|
42 |
-
"plt.style.use('ggplot')\n",
|
43 |
-
"\n",
|
44 |
-
"fig, axes = plt.subplots(ncols=2, nrows=2)\n",
|
45 |
-
"ax1, ax2, ax3, ax4 = axes.ravel()\n",
|
46 |
-
"\n",
|
47 |
-
"# scatter plot (Note: `plt.scatter` doesn't use default colors)\n",
|
48 |
-
"x, y = np.random.normal(size=(2, 200))\n",
|
49 |
-
"ax1.plot(x, y, 'o')\n",
|
50 |
-
"\n",
|
51 |
-
"# sinusoidal lines with colors from default color cycle\n",
|
52 |
-
"L = 2 * np.pi\n",
|
53 |
-
"x = np.linspace(0, L)\n",
|
54 |
-
"ncolors = len(plt.rcParams['axes.prop_cycle'])\n",
|
55 |
-
"shift = np.linspace(0, L, ncolors, endpoint=False)\n",
|
56 |
-
"for s in shift:\n",
|
57 |
-
" ax2.plot(x, np.sin(x + s), '-')\n",
|
58 |
-
"ax2.margins(0)\n",
|
59 |
-
"\n",
|
60 |
-
"# bar graphs\n",
|
61 |
-
"x = np.arange(5)\n",
|
62 |
-
"y1, y2 = np.random.randint(1, 25, size=(2, 5))\n",
|
63 |
-
"width = 0.25\n",
|
64 |
-
"ax3.bar(x, y1, width)\n",
|
65 |
-
"ax3.bar(x + width, y2, width,\n",
|
66 |
-
" color=list(plt.rcParams['axes.prop_cycle'])[2]['color'])\n",
|
67 |
-
"ax3.set_xticks(x + width)\n",
|
68 |
-
"ax3.set_xticklabels(['a', 'b', 'c', 'd', 'e'])\n",
|
69 |
-
"\n",
|
70 |
-
"# circles with colors from default color cycle\n",
|
71 |
-
"for i, color in enumerate(plt.rcParams['axes.prop_cycle']):\n",
|
72 |
-
" xy = np.random.normal(size=2)\n",
|
73 |
-
" ax4.add_patch(plt.Circle(xy, radius=0.3, color=color['color']))\n",
|
74 |
-
"\n",
|
75 |
-
"ax4.axis('equal')\n",
|
76 |
-
"ax4.margins(0)\n",
|
77 |
-
"\n",
|
78 |
-
"plt.show()"
|
79 |
-
]
|
80 |
-
},
|
81 |
-
{
|
82 |
-
"cell_type": "code",
|
83 |
-
"execution_count": null,
|
84 |
-
"metadata": {},
|
85 |
-
"outputs": [],
|
86 |
-
"source": []
|
87 |
-
}
|
88 |
-
],
|
89 |
-
"metadata": {
|
90 |
-
"kernelspec": {
|
91 |
-
"display_name": "Python 3",
|
92 |
-
"language": "python",
|
93 |
-
"name": "python3"
|
94 |
-
},
|
95 |
-
"language_info": {
|
96 |
-
"codemirror_mode": {
|
97 |
-
"name": "ipython",
|
98 |
-
"version": 3
|
99 |
-
},
|
100 |
-
"file_extension": ".py",
|
101 |
-
"mimetype": "text/x-python",
|
102 |
-
"name": "python",
|
103 |
-
"nbconvert_exporter": "python",
|
104 |
-
"pygments_lexer": "ipython3",
|
105 |
-
"version": "3.7.3"
|
106 |
-
}
|
107 |
-
},
|
108 |
-
"nbformat": 4,
|
109 |
-
"nbformat_minor": 2
|
110 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
notebooks/ipyvolume.ipynb
DELETED
@@ -1,44 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"cells": [
|
3 |
-
{
|
4 |
-
"cell_type": "markdown",
|
5 |
-
"metadata": {},
|
6 |
-
"source": [
|
7 |
-
"# So easy, *voilà*!\n",
|
8 |
-
"\n",
|
9 |
-
"In this example notebook, we demonstrate how Voilà can render custom Jupyter widgets such as [ipyvolume](https://github.com/maartenbreddels/ipyvolume). "
|
10 |
-
]
|
11 |
-
},
|
12 |
-
{
|
13 |
-
"cell_type": "code",
|
14 |
-
"execution_count": null,
|
15 |
-
"metadata": {},
|
16 |
-
"outputs": [],
|
17 |
-
"source": [
|
18 |
-
"import ipyvolume as ipv\n",
|
19 |
-
"ipv.examples.example_ylm();"
|
20 |
-
]
|
21 |
-
}
|
22 |
-
],
|
23 |
-
"metadata": {
|
24 |
-
"kernelspec": {
|
25 |
-
"display_name": "Python 3",
|
26 |
-
"language": "python",
|
27 |
-
"name": "python3"
|
28 |
-
},
|
29 |
-
"language_info": {
|
30 |
-
"codemirror_mode": {
|
31 |
-
"name": "ipython",
|
32 |
-
"version": 3
|
33 |
-
},
|
34 |
-
"file_extension": ".py",
|
35 |
-
"mimetype": "text/x-python",
|
36 |
-
"name": "python",
|
37 |
-
"nbconvert_exporter": "python",
|
38 |
-
"pygments_lexer": "ipython3",
|
39 |
-
"version": "3.7.3"
|
40 |
-
}
|
41 |
-
},
|
42 |
-
"nbformat": 4,
|
43 |
-
"nbformat_minor": 2
|
44 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
notebooks/mimerenderers.ipynb
DELETED
@@ -1,489 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"cells": [
|
3 |
-
{
|
4 |
-
"cell_type": "code",
|
5 |
-
"execution_count": null,
|
6 |
-
"id": "ff203dda-d0f3-48a8-95d5-587fbe1acae8",
|
7 |
-
"metadata": {},
|
8 |
-
"outputs": [],
|
9 |
-
"source": [
|
10 |
-
"from IPython.display import display\n",
|
11 |
-
"from IPython.display import (\n",
|
12 |
-
" HTML, Image, Latex, Math, Markdown, SVG\n",
|
13 |
-
")"
|
14 |
-
]
|
15 |
-
},
|
16 |
-
{
|
17 |
-
"cell_type": "markdown",
|
18 |
-
"id": "83934e25-4c2a-4521-b128-f4da77793fe8",
|
19 |
-
"metadata": {},
|
20 |
-
"source": [
|
21 |
-
"## Text"
|
22 |
-
]
|
23 |
-
},
|
24 |
-
{
|
25 |
-
"cell_type": "code",
|
26 |
-
"execution_count": null,
|
27 |
-
"id": "4c0ef0c2-a7c2-4aee-b047-d009e9794ef9",
|
28 |
-
"metadata": {},
|
29 |
-
"outputs": [],
|
30 |
-
"source": [
|
31 |
-
"text = \"\"\"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam urna\n",
|
32 |
-
"libero, dictum a egestas non, placerat vel neque. In imperdiet iaculis fermentum. \n",
|
33 |
-
"Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia \n",
|
34 |
-
"Curae; Cras augue tortor, tristique vitae varius nec, dictum eu lectus. Pellentesque \n",
|
35 |
-
"id eleifend eros. In non odio in lorem iaculis sollicitudin. In faucibus ante ut \n",
|
36 |
-
"arcu fringilla interdum. Maecenas elit nulla, imperdiet nec blandit et, consequat \n",
|
37 |
-
"ut elit.\"\"\"\n",
|
38 |
-
"print(text)"
|
39 |
-
]
|
40 |
-
},
|
41 |
-
{
|
42 |
-
"cell_type": "code",
|
43 |
-
"execution_count": null,
|
44 |
-
"id": "9f841613-56a3-4b9f-a342-929f77534159",
|
45 |
-
"metadata": {},
|
46 |
-
"outputs": [],
|
47 |
-
"source": [
|
48 |
-
"import sys; print('this is stderr', file=sys.stderr)"
|
49 |
-
]
|
50 |
-
},
|
51 |
-
{
|
52 |
-
"cell_type": "markdown",
|
53 |
-
"id": "ff9bcbcb-8b11-4215-a5bd-a82265ab63f2",
|
54 |
-
"metadata": {},
|
55 |
-
"source": [
|
56 |
-
"## HTML"
|
57 |
-
]
|
58 |
-
},
|
59 |
-
{
|
60 |
-
"cell_type": "code",
|
61 |
-
"execution_count": null,
|
62 |
-
"id": "317c2b55-881f-436c-8cc5-1753e8ebb4b6",
|
63 |
-
"metadata": {},
|
64 |
-
"outputs": [],
|
65 |
-
"source": [
|
66 |
-
"div = HTML('<div style=\"width:100px;height:100px;background:grey;\" />')\n",
|
67 |
-
"div"
|
68 |
-
]
|
69 |
-
},
|
70 |
-
{
|
71 |
-
"cell_type": "markdown",
|
72 |
-
"id": "e410f2d6-d6be-4dc5-b3fa-80ee61ac30ec",
|
73 |
-
"metadata": {},
|
74 |
-
"source": [
|
75 |
-
"## Markdown"
|
76 |
-
]
|
77 |
-
},
|
78 |
-
{
|
79 |
-
"cell_type": "code",
|
80 |
-
"execution_count": null,
|
81 |
-
"id": "8088840b-ebec-4964-b823-4864330aa021",
|
82 |
-
"metadata": {},
|
83 |
-
"outputs": [],
|
84 |
-
"source": [
|
85 |
-
"md = Markdown(\"\"\"\n",
|
86 |
-
"### Subtitle\n",
|
87 |
-
"\n",
|
88 |
-
"This is some *markdown* text with math $F=ma$.\n",
|
89 |
-
"\n",
|
90 |
-
"\"\"\")\n",
|
91 |
-
"md"
|
92 |
-
]
|
93 |
-
},
|
94 |
-
{
|
95 |
-
"cell_type": "code",
|
96 |
-
"execution_count": null,
|
97 |
-
"id": "de749ce9-0531-4151-b2c5-6100706ddd59",
|
98 |
-
"metadata": {},
|
99 |
-
"outputs": [],
|
100 |
-
"source": [
|
101 |
-
"display(md)"
|
102 |
-
]
|
103 |
-
},
|
104 |
-
{
|
105 |
-
"cell_type": "markdown",
|
106 |
-
"id": "a4d62188-c67b-4058-a679-a08f6ad0ad87",
|
107 |
-
"metadata": {},
|
108 |
-
"source": [
|
109 |
-
"## LaTeX"
|
110 |
-
]
|
111 |
-
},
|
112 |
-
{
|
113 |
-
"cell_type": "markdown",
|
114 |
-
"id": "09eb8496-cea0-496a-97de-f887ce924d3d",
|
115 |
-
"metadata": {},
|
116 |
-
"source": [
|
117 |
-
"Examples LaTeX in a markdown cell:\n",
|
118 |
-
"\n",
|
119 |
-
"\n",
|
120 |
-
"\\begin{align}\n",
|
121 |
-
"\\nabla \\times \\vec{\\mathbf{B}} -\\, \\frac1c\\, \\frac{\\partial\\vec{\\mathbf{E}}}{\\partial t} & = \\frac{4\\pi}{c}\\vec{\\mathbf{j}} \\\\ \\nabla \\cdot \\vec{\\mathbf{E}} & = 4 \\pi \\rho \\\\\n",
|
122 |
-
"\\nabla \\times \\vec{\\mathbf{E}}\\, +\\, \\frac1c\\, \\frac{\\partial\\vec{\\mathbf{B}}}{\\partial t} & = \\vec{\\mathbf{0}} \\\\\n",
|
123 |
-
"\\nabla \\cdot \\vec{\\mathbf{B}} & = 0\n",
|
124 |
-
"\\end{align}"
|
125 |
-
]
|
126 |
-
},
|
127 |
-
{
|
128 |
-
"cell_type": "code",
|
129 |
-
"execution_count": null,
|
130 |
-
"id": "e59f7a97-9ad5-424f-ba99-2f69deba04a1",
|
131 |
-
"metadata": {},
|
132 |
-
"outputs": [],
|
133 |
-
"source": [
|
134 |
-
"math = Latex(\"$F=ma$\")\n",
|
135 |
-
"math"
|
136 |
-
]
|
137 |
-
},
|
138 |
-
{
|
139 |
-
"cell_type": "code",
|
140 |
-
"execution_count": null,
|
141 |
-
"id": "0f14b258-22e0-465d-9b86-d134e7d4a07c",
|
142 |
-
"metadata": {},
|
143 |
-
"outputs": [],
|
144 |
-
"source": [
|
145 |
-
"maxwells = Latex(r\"\"\"\n",
|
146 |
-
"\\begin{align}\n",
|
147 |
-
"\\nabla \\times \\vec{\\mathbf{B}} -\\, \\frac1c\\, \\frac{\\partial\\vec{\\mathbf{E}}}{\\partial t} & = \\frac{4\\pi}{c}\\vec{\\mathbf{j}} \\\\ \\nabla \\cdot \\vec{\\mathbf{E}} & = 4 \\pi \\rho \\\\\n",
|
148 |
-
"\\nabla \\times \\vec{\\mathbf{E}}\\, +\\, \\frac1c\\, \\frac{\\partial\\vec{\\mathbf{B}}}{\\partial t} & = \\vec{\\mathbf{0}} \\\\\n",
|
149 |
-
"\\nabla \\cdot \\vec{\\mathbf{B}} & = 0\n",
|
150 |
-
"\\end{align}\n",
|
151 |
-
"\"\"\")\n",
|
152 |
-
"maxwells"
|
153 |
-
]
|
154 |
-
},
|
155 |
-
{
|
156 |
-
"cell_type": "markdown",
|
157 |
-
"id": "cefadf9b-3bab-451e-963d-38cee15c05ea",
|
158 |
-
"metadata": {},
|
159 |
-
"source": [
|
160 |
-
"## PDF"
|
161 |
-
]
|
162 |
-
},
|
163 |
-
{
|
164 |
-
"cell_type": "code",
|
165 |
-
"execution_count": null,
|
166 |
-
"id": "0654a20f-1c14-47fd-a8b2-4de3fcbe6379",
|
167 |
-
"metadata": {},
|
168 |
-
"outputs": [],
|
169 |
-
"source": [
|
170 |
-
"%matplotlib inline\n",
|
171 |
-
"import matplotlib.pyplot as plt\n",
|
172 |
-
"import numpy as np\n",
|
173 |
-
"from IPython.display import set_matplotlib_formats\n",
|
174 |
-
"set_matplotlib_formats('pdf')"
|
175 |
-
]
|
176 |
-
},
|
177 |
-
{
|
178 |
-
"cell_type": "code",
|
179 |
-
"execution_count": null,
|
180 |
-
"id": "e472026e-1019-4ef1-aae7-190dfa27c6a6",
|
181 |
-
"metadata": {},
|
182 |
-
"outputs": [],
|
183 |
-
"source": [
|
184 |
-
"plt.scatter(np.random.rand(20), np.random.rand(20), c=np.random.rand(20))"
|
185 |
-
]
|
186 |
-
},
|
187 |
-
{
|
188 |
-
"cell_type": "markdown",
|
189 |
-
"id": "52d8c23c-85e9-4a58-b2ab-a1686f5efaf3",
|
190 |
-
"metadata": {},
|
191 |
-
"source": [
|
192 |
-
"## Image"
|
193 |
-
]
|
194 |
-
},
|
195 |
-
{
|
196 |
-
"cell_type": "code",
|
197 |
-
"execution_count": null,
|
198 |
-
"id": "e6b7d130-7033-4783-bec1-031beabe66ef",
|
199 |
-
"metadata": {},
|
200 |
-
"outputs": [],
|
201 |
-
"source": [
|
202 |
-
"img = Image(\"https://apod.nasa.gov/apod/image/1707/GreatWallMilkyWay_Yu_1686.jpg\")\n",
|
203 |
-
"img"
|
204 |
-
]
|
205 |
-
},
|
206 |
-
{
|
207 |
-
"cell_type": "markdown",
|
208 |
-
"id": "f0063685-9296-4149-abfb-5d0e15cc0b3c",
|
209 |
-
"metadata": {},
|
210 |
-
"source": [
|
211 |
-
"## SVG"
|
212 |
-
]
|
213 |
-
},
|
214 |
-
{
|
215 |
-
"cell_type": "code",
|
216 |
-
"execution_count": null,
|
217 |
-
"id": "959bbce1-1bbb-45a4-8373-d3994bab420d",
|
218 |
-
"metadata": {},
|
219 |
-
"outputs": [],
|
220 |
-
"source": [
|
221 |
-
"svg_source = \"\"\"\n",
|
222 |
-
"<svg width=\"400\" height=\"110\">\n",
|
223 |
-
" <rect width=\"300\" height=\"100\" style=\"fill:#E0E0E0;\" /> \n",
|
224 |
-
"</svg>\n",
|
225 |
-
"\"\"\"\n",
|
226 |
-
"svg = SVG(svg_source)\n",
|
227 |
-
"svg"
|
228 |
-
]
|
229 |
-
},
|
230 |
-
{
|
231 |
-
"cell_type": "markdown",
|
232 |
-
"id": "41009292-8e51-4fde-90d2-804a52aa6d7f",
|
233 |
-
"metadata": {},
|
234 |
-
"source": [
|
235 |
-
"## HTML Tables"
|
236 |
-
]
|
237 |
-
},
|
238 |
-
{
|
239 |
-
"cell_type": "code",
|
240 |
-
"execution_count": null,
|
241 |
-
"id": "dbc0850d-bce6-4b6d-901e-c6ea1b857898",
|
242 |
-
"metadata": {},
|
243 |
-
"outputs": [],
|
244 |
-
"source": [
|
245 |
-
"from vega_datasets import data"
|
246 |
-
]
|
247 |
-
},
|
248 |
-
{
|
249 |
-
"cell_type": "code",
|
250 |
-
"execution_count": null,
|
251 |
-
"id": "384e0e32-001d-4e40-bda7-4c76578fe123",
|
252 |
-
"metadata": {},
|
253 |
-
"outputs": [],
|
254 |
-
"source": [
|
255 |
-
"df = data.cars()"
|
256 |
-
]
|
257 |
-
},
|
258 |
-
{
|
259 |
-
"cell_type": "code",
|
260 |
-
"execution_count": null,
|
261 |
-
"id": "702d284d-fefb-4b68-a327-ab311179c991",
|
262 |
-
"metadata": {},
|
263 |
-
"outputs": [],
|
264 |
-
"source": [
|
265 |
-
"df.head()"
|
266 |
-
]
|
267 |
-
},
|
268 |
-
{
|
269 |
-
"cell_type": "markdown",
|
270 |
-
"id": "5355a073-8ab7-46f9-87c8-04f2a2c4af7c",
|
271 |
-
"metadata": {},
|
272 |
-
"source": [
|
273 |
-
"## Vega"
|
274 |
-
]
|
275 |
-
},
|
276 |
-
{
|
277 |
-
"cell_type": "code",
|
278 |
-
"execution_count": null,
|
279 |
-
"id": "ba337247-3bfa-4f70-b067-b25d4236660c",
|
280 |
-
"metadata": {
|
281 |
-
"tags": []
|
282 |
-
},
|
283 |
-
"outputs": [],
|
284 |
-
"source": [
|
285 |
-
"from IPython.display import display\n",
|
286 |
-
"import pandas as pd\n",
|
287 |
-
"\n",
|
288 |
-
"def Vega(spec):\n",
|
289 |
-
" bundle = {}\n",
|
290 |
-
" bundle['application/vnd.vega.v5+json'] = spec\n",
|
291 |
-
" display(bundle, raw=True)\n",
|
292 |
-
"\n",
|
293 |
-
"def VegaLite(spec):\n",
|
294 |
-
" bundle = {}\n",
|
295 |
-
" bundle['application/vnd.vegalite.v4+json'] = spec\n",
|
296 |
-
" display(bundle, raw=True)\n",
|
297 |
-
"\n",
|
298 |
-
"Vega({\n",
|
299 |
-
" \"$schema\": \"https://vega.github.io/schema/vega/v5.0.json\",\n",
|
300 |
-
" \"width\": 400,\n",
|
301 |
-
" \"height\": 200,\n",
|
302 |
-
" \"padding\": 5,\n",
|
303 |
-
"\n",
|
304 |
-
" \"data\": [\n",
|
305 |
-
" {\n",
|
306 |
-
" \"name\": \"table\",\n",
|
307 |
-
" \"values\": [\n",
|
308 |
-
" {\"category\": \"A\", \"amount\": 28},\n",
|
309 |
-
" {\"category\": \"B\", \"amount\": 55},\n",
|
310 |
-
" {\"category\": \"C\", \"amount\": 43},\n",
|
311 |
-
" {\"category\": \"D\", \"amount\": 91},\n",
|
312 |
-
" {\"category\": \"E\", \"amount\": 81},\n",
|
313 |
-
" {\"category\": \"F\", \"amount\": 53},\n",
|
314 |
-
" {\"category\": \"G\", \"amount\": 19},\n",
|
315 |
-
" {\"category\": \"H\", \"amount\": 87}\n",
|
316 |
-
" ]\n",
|
317 |
-
" }\n",
|
318 |
-
" ],\n",
|
319 |
-
"\n",
|
320 |
-
" \"signals\": [\n",
|
321 |
-
" {\n",
|
322 |
-
" \"name\": \"tooltip\",\n",
|
323 |
-
" \"value\": {},\n",
|
324 |
-
" \"on\": [\n",
|
325 |
-
" {\"events\": \"rect:mouseover\", \"update\": \"datum\"},\n",
|
326 |
-
" {\"events\": \"rect:mouseout\", \"update\": \"{}\"}\n",
|
327 |
-
" ]\n",
|
328 |
-
" }\n",
|
329 |
-
" ],\n",
|
330 |
-
"\n",
|
331 |
-
" \"scales\": [\n",
|
332 |
-
" {\n",
|
333 |
-
" \"name\": \"xscale\",\n",
|
334 |
-
" \"type\": \"band\",\n",
|
335 |
-
" \"domain\": {\"data\": \"table\", \"field\": \"category\"},\n",
|
336 |
-
" \"range\": \"width\",\n",
|
337 |
-
" \"padding\": 0.05,\n",
|
338 |
-
" \"round\": True\n",
|
339 |
-
" },\n",
|
340 |
-
" {\n",
|
341 |
-
" \"name\": \"yscale\",\n",
|
342 |
-
" \"domain\": {\"data\": \"table\", \"field\": \"amount\"},\n",
|
343 |
-
" \"nice\": True,\n",
|
344 |
-
" \"range\": \"height\"\n",
|
345 |
-
" }\n",
|
346 |
-
" ],\n",
|
347 |
-
"\n",
|
348 |
-
" \"axes\": [\n",
|
349 |
-
" { \"orient\": \"bottom\", \"scale\": \"xscale\" },\n",
|
350 |
-
" { \"orient\": \"left\", \"scale\": \"yscale\" }\n",
|
351 |
-
" ],\n",
|
352 |
-
"\n",
|
353 |
-
" \"marks\": [\n",
|
354 |
-
" {\n",
|
355 |
-
" \"type\": \"rect\",\n",
|
356 |
-
" \"from\": {\"data\":\"table\"},\n",
|
357 |
-
" \"encode\": {\n",
|
358 |
-
" \"enter\": {\n",
|
359 |
-
" \"x\": {\"scale\": \"xscale\", \"field\": \"category\"},\n",
|
360 |
-
" \"width\": {\"scale\": \"xscale\", \"band\": 1},\n",
|
361 |
-
" \"y\": {\"scale\": \"yscale\", \"field\": \"amount\"},\n",
|
362 |
-
" \"y2\": {\"scale\": \"yscale\", \"value\": 0}\n",
|
363 |
-
" },\n",
|
364 |
-
" \"update\": {\n",
|
365 |
-
" \"fill\": {\"value\": \"steelblue\"}\n",
|
366 |
-
" },\n",
|
367 |
-
" \"hover\": {\n",
|
368 |
-
" \"fill\": {\"value\": \"red\"}\n",
|
369 |
-
" }\n",
|
370 |
-
" }\n",
|
371 |
-
" },\n",
|
372 |
-
" {\n",
|
373 |
-
" \"type\": \"text\",\n",
|
374 |
-
" \"encode\": {\n",
|
375 |
-
" \"enter\": {\n",
|
376 |
-
" \"align\": {\"value\": \"center\"},\n",
|
377 |
-
" \"baseline\": {\"value\": \"bottom\"},\n",
|
378 |
-
" \"fill\": {\"value\": \"#333\"}\n",
|
379 |
-
" },\n",
|
380 |
-
" \"update\": {\n",
|
381 |
-
" \"x\": {\"scale\": \"xscale\", \"signal\": \"tooltip.category\", \"band\": 0.5},\n",
|
382 |
-
" \"y\": {\"scale\": \"yscale\", \"signal\": \"tooltip.amount\", \"offset\": -2},\n",
|
383 |
-
" \"text\": {\"signal\": \"tooltip.amount\"},\n",
|
384 |
-
" \"fillOpacity\": [\n",
|
385 |
-
" {\"test\": \"datum === tooltip\", \"value\": 0},\n",
|
386 |
-
" {\"value\": 1}\n",
|
387 |
-
" ]\n",
|
388 |
-
" }\n",
|
389 |
-
" }\n",
|
390 |
-
" }\n",
|
391 |
-
" ]\n",
|
392 |
-
"})"
|
393 |
-
]
|
394 |
-
},
|
395 |
-
{
|
396 |
-
"cell_type": "markdown",
|
397 |
-
"id": "be6347a4-f418-49d2-a83e-ba0ef6366505",
|
398 |
-
"metadata": {},
|
399 |
-
"source": [
|
400 |
-
"## GeoJSON"
|
401 |
-
]
|
402 |
-
},
|
403 |
-
{
|
404 |
-
"cell_type": "code",
|
405 |
-
"execution_count": null,
|
406 |
-
"id": "67a6bc44-7588-4ae0-8eae-0428b6428f80",
|
407 |
-
"metadata": {
|
408 |
-
"tags": []
|
409 |
-
},
|
410 |
-
"outputs": [],
|
411 |
-
"source": [
|
412 |
-
"from IPython.display import GeoJSON, JSON\n",
|
413 |
-
"\n",
|
414 |
-
"data = {\n",
|
415 |
-
" \"type\": \"Feature\",\n",
|
416 |
-
" \"geometry\": {\n",
|
417 |
-
" \"type\": \"Point\",\n",
|
418 |
-
" \"coordinates\": [-118.4563712, 34.0163116]\n",
|
419 |
-
" }\n",
|
420 |
-
"}\n",
|
421 |
-
"\n",
|
422 |
-
"GeoJSON(data)"
|
423 |
-
]
|
424 |
-
},
|
425 |
-
{
|
426 |
-
"cell_type": "code",
|
427 |
-
"execution_count": null,
|
428 |
-
"id": "1a1a2fc6",
|
429 |
-
"metadata": {},
|
430 |
-
"outputs": [],
|
431 |
-
"source": [
|
432 |
-
"JSON(data)"
|
433 |
-
]
|
434 |
-
},
|
435 |
-
{
|
436 |
-
"cell_type": "markdown",
|
437 |
-
"id": "dc69fbe1",
|
438 |
-
"metadata": {},
|
439 |
-
"source": [
|
440 |
-
"# Fasta"
|
441 |
-
]
|
442 |
-
},
|
443 |
-
{
|
444 |
-
"cell_type": "code",
|
445 |
-
"execution_count": null,
|
446 |
-
"id": "85730759",
|
447 |
-
"metadata": {},
|
448 |
-
"outputs": [],
|
449 |
-
"source": [
|
450 |
-
"def Fasta(data=''):\n",
|
451 |
-
" bundle = {}\n",
|
452 |
-
" bundle['application/vnd.fasta.fasta'] = data\n",
|
453 |
-
" bundle['text/plain'] = data\n",
|
454 |
-
" display(bundle, raw=True)\n",
|
455 |
-
"\n",
|
456 |
-
"\n",
|
457 |
-
"Fasta(\"\"\">SEQUENCE_1\n",
|
458 |
-
"MTEITAAMVKELRESTGAGMMDCKNALSETNGDFDKAVQLLREKGLGKAAKKADRLAAEG\n",
|
459 |
-
"LVSVKVSDDFTIAAMRPSYLSYEDLDMTFVENEYKALVAELEKENEERRRLKDPNKPEHK\n",
|
460 |
-
"IPQFASRKQLSDAILKEAEEKIKEELKAQGKPEKIWDNIIPGKMNSFIADNSQLDSKLTL\n",
|
461 |
-
"MGQFYVMDDKKTVEQVIAEKEKEFGGKIKIVEFICFEVGEGLEKKTEDFAAEVAAQL\n",
|
462 |
-
">SEQUENCE_2\n",
|
463 |
-
"SATVSEINSETDFVAKNDQFIALTKDTTAHIQSNSLQSVEELHSSTINGVKFEEYLKSQI\n",
|
464 |
-
"ATIGENLVVRRFATLKAGANGVVNGYIHTNGRVGVVIAAACDSAEVASKSRDLLRQICMH\"\"\")"
|
465 |
-
]
|
466 |
-
}
|
467 |
-
],
|
468 |
-
"metadata": {
|
469 |
-
"kernelspec": {
|
470 |
-
"display_name": "Python 3 (ipykernel)",
|
471 |
-
"language": "python",
|
472 |
-
"name": "python3"
|
473 |
-
},
|
474 |
-
"language_info": {
|
475 |
-
"codemirror_mode": {
|
476 |
-
"name": "ipython",
|
477 |
-
"version": 3
|
478 |
-
},
|
479 |
-
"file_extension": ".py",
|
480 |
-
"mimetype": "text/x-python",
|
481 |
-
"name": "python",
|
482 |
-
"nbconvert_exporter": "python",
|
483 |
-
"pygments_lexer": "ipython3",
|
484 |
-
"version": "3.10.6"
|
485 |
-
}
|
486 |
-
},
|
487 |
-
"nbformat": 4,
|
488 |
-
"nbformat_minor": 5
|
489 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
notebooks/reveal.ipynb
DELETED
@@ -1,92 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"cells": [
|
3 |
-
{
|
4 |
-
"cell_type": "code",
|
5 |
-
"execution_count": null,
|
6 |
-
"metadata": {
|
7 |
-
"slideshow": {
|
8 |
-
"slide_type": "slide"
|
9 |
-
}
|
10 |
-
},
|
11 |
-
"outputs": [],
|
12 |
-
"source": [
|
13 |
-
"print('hi')"
|
14 |
-
]
|
15 |
-
},
|
16 |
-
{
|
17 |
-
"cell_type": "code",
|
18 |
-
"execution_count": null,
|
19 |
-
"metadata": {},
|
20 |
-
"outputs": [],
|
21 |
-
"source": [
|
22 |
-
"import ipywidgets as widgets\n",
|
23 |
-
"slider = widgets.FloatSlider(description='x')\n",
|
24 |
-
"text = widgets.FloatText(disabled=True, description='$x^2$')\n",
|
25 |
-
"text.disabled\n",
|
26 |
-
"def compute(*ignore):\n",
|
27 |
-
" text.value = str(slider.value**2)\n",
|
28 |
-
"slider.observe(compute, 'value')\n",
|
29 |
-
"slider.value = 14\n",
|
30 |
-
"widgets.VBox([slider, text])"
|
31 |
-
]
|
32 |
-
},
|
33 |
-
{
|
34 |
-
"cell_type": "code",
|
35 |
-
"execution_count": null,
|
36 |
-
"metadata": {
|
37 |
-
"slideshow": {
|
38 |
-
"slide_type": "slide"
|
39 |
-
}
|
40 |
-
},
|
41 |
-
"outputs": [],
|
42 |
-
"source": [
|
43 |
-
"print('voila')"
|
44 |
-
]
|
45 |
-
},
|
46 |
-
{
|
47 |
-
"cell_type": "code",
|
48 |
-
"execution_count": null,
|
49 |
-
"metadata": {
|
50 |
-
"slideshow": {
|
51 |
-
"slide_type": "subslide"
|
52 |
-
}
|
53 |
-
},
|
54 |
-
"outputs": [],
|
55 |
-
"source": [
|
56 |
-
"1+2"
|
57 |
-
]
|
58 |
-
},
|
59 |
-
{
|
60 |
-
"cell_type": "code",
|
61 |
-
"execution_count": null,
|
62 |
-
"metadata": {},
|
63 |
-
"outputs": [],
|
64 |
-
"source": []
|
65 |
-
}
|
66 |
-
],
|
67 |
-
"metadata": {
|
68 |
-
"celltoolbar": "Slideshow",
|
69 |
-
"kernelspec": {
|
70 |
-
"display_name": "Python 3",
|
71 |
-
"language": "python",
|
72 |
-
"name": "python3"
|
73 |
-
},
|
74 |
-
"language_info": {
|
75 |
-
"codemirror_mode": {
|
76 |
-
"name": "ipython",
|
77 |
-
"version": 3
|
78 |
-
},
|
79 |
-
"file_extension": ".py",
|
80 |
-
"mimetype": "text/x-python",
|
81 |
-
"name": "python",
|
82 |
-
"nbconvert_exporter": "python",
|
83 |
-
"pygments_lexer": "ipython3",
|
84 |
-
"version": "3.6.4"
|
85 |
-
},
|
86 |
-
"voila": {
|
87 |
-
"template": "reveal"
|
88 |
-
}
|
89 |
-
},
|
90 |
-
"nbformat": 4,
|
91 |
-
"nbformat_minor": 2
|
92 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|