Skip to content

Commit 7427668

Browse files
committed
notebook formatting
1 parent f2d2880 commit 7427668

File tree

5 files changed

+72
-86
lines changed

5 files changed

+72
-86
lines changed

notebooks/000_formdiagram.ipynb

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,17 @@
1414
},
1515
{
1616
"cell_type": "code",
17-
"execution_count": 2,
17+
"execution_count": 1,
1818
"metadata": {},
1919
"outputs": [],
2020
"source": [
21-
"import compas\n",
2221
"import pathlib\n",
23-
"from compas_tna.diagrams import FormDiagram\n",
24-
"from compas_tna.equilibrium import relax_boundary_openings\n",
2522
"\n",
26-
"# for visualisation of the result\n",
27-
"from compas.colors import Color\n",
28-
"from compas_notebook.viewer import Viewer"
23+
"from compas_notebook.viewer import Viewer\n",
24+
"\n",
25+
"import compas\n",
26+
"from compas_tna.diagrams import FormDiagram\n",
27+
"from compas_tna.equilibrium import relax_boundary_openings\n"
2928
]
3029
},
3130
{
@@ -41,11 +40,11 @@
4140
},
4241
{
4342
"cell_type": "code",
44-
"execution_count": 3,
43+
"execution_count": 2,
4544
"metadata": {},
4645
"outputs": [],
4746
"source": [
48-
"form = FormDiagram.from_meshgrid(dx=10, nx=10)"
47+
"form: FormDiagram = FormDiagram.from_meshgrid(dx=10, nx=10) # type: ignore"
4948
]
5049
},
5150
{
@@ -60,11 +59,11 @@
6059
},
6160
{
6261
"cell_type": "code",
63-
"execution_count": 4,
62+
"execution_count": 3,
6463
"metadata": {},
6564
"outputs": [],
6665
"source": [
67-
"corners = list(form.vertices_where(vertex_degree=2))\n",
66+
"corners: list[int] = list(form.vertices_where(vertex_degree=2)) # type: ignore\n",
6867
"form.vertices_attribute(\"is_support\", True, keys=corners)"
6968
]
7069
},
@@ -79,12 +78,21 @@
7978
},
8079
{
8180
"cell_type": "code",
82-
"execution_count": 5,
81+
"execution_count": 4,
8382
"metadata": {},
84-
"outputs": [],
83+
"outputs": [
84+
{
85+
"data": {
86+
"text/plain": [
87+
"<compas_tna.diagrams.formdiagram.FormDiagram at 0x10341f220>"
88+
]
89+
},
90+
"execution_count": 4,
91+
"metadata": {},
92+
"output_type": "execute_result"
93+
}
94+
],
8595
"source": [
86-
"%%capture\n",
87-
"\n",
8896
"form.edges_attribute(\"q\", 10.0, keys=form.edges_on_boundary())\n",
8997
"relax_boundary_openings(form, corners)"
9098
]
@@ -100,7 +108,7 @@
100108
},
101109
{
102110
"cell_type": "code",
103-
"execution_count": 6,
111+
"execution_count": 5,
104112
"metadata": {},
105113
"outputs": [],
106114
"source": [
@@ -122,12 +130,12 @@
122130
},
123131
{
124132
"cell_type": "code",
125-
"execution_count": 7,
133+
"execution_count": null,
126134
"metadata": {},
127135
"outputs": [],
128136
"source": [
129-
"session = {'formdiagram': form, 'forcediagram': None}\n",
130-
"filepath = pathlib.Path('~/Code/compas_tna/notebooks/session.json').expanduser()\n",
137+
"session = {\"formdiagram\": form, \"forcediagram\": None}\n",
138+
"filepath = pathlib.Path().cwd() / \"session.json\"\n",
131139
"\n",
132140
"compas.json_dump(session, filepath)"
133141
]
@@ -141,26 +149,18 @@
141149
},
142150
{
143151
"cell_type": "code",
144-
"execution_count": 8,
152+
"execution_count": 7,
145153
"metadata": {},
146154
"outputs": [
147-
{
148-
"name": "stdout",
149-
"output_type": "stream",
150-
"text": [
151-
"PyThreeJS SceneObjects registered.\n",
152-
"TNA Notebook SceneObjects registered.\n"
153-
]
154-
},
155155
{
156156
"data": {
157157
"application/vnd.jupyter.widget-view+json": {
158-
"model_id": "dce98402e8b44757bc6dad62d1a76f91",
158+
"model_id": "157bdc5222754b7bb64cc9434c54ba5a",
159159
"version_major": 2,
160160
"version_minor": 0
161161
},
162162
"text/plain": [
163-
"VBox(children=(HBox(children=(Button(icon='folder-open', layout=Layout(height='32px', width='48px'), style=But…"
163+
"VBox(children=(HBox(children=(Button(icon='search-plus', layout=Layout(height='32px', width='48px'), style=But…"
164164
]
165165
},
166166
"metadata": {},
@@ -183,7 +183,7 @@
183183
],
184184
"metadata": {
185185
"kernelspec": {
186-
"display_name": "compas-dev",
186+
"display_name": "masonry",
187187
"language": "python",
188188
"name": "python3"
189189
},
@@ -197,7 +197,7 @@
197197
"name": "python",
198198
"nbconvert_exporter": "python",
199199
"pygments_lexer": "ipython3",
200-
"version": "3.9.10"
200+
"version": "3.10.14"
201201
}
202202
},
203203
"nbformat": 4,

notebooks/100_forcediagram.ipynb

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@
1313
"metadata": {},
1414
"outputs": [],
1515
"source": [
16-
"import compas\n",
1716
"import pathlib\n",
18-
"from compas.colors import Color\n",
17+
"\n",
1918
"from compas_notebook.viewer import Viewer\n",
20-
"from compas_tna.diagrams import FormDiagram\n",
21-
"from compas_tna.diagrams import ForceDiagram"
19+
"\n",
20+
"import compas\n",
21+
"from compas_tna.diagrams import ForceDiagram\n",
22+
"from compas_tna.diagrams import FormDiagram\n"
2223
]
2324
},
2425
{
@@ -34,7 +35,7 @@
3435
"metadata": {},
3536
"outputs": [],
3637
"source": [
37-
"filepath = pathlib.Path('~/Code/compas_tna/notebooks/session.json').expanduser()\n",
38+
"filepath = pathlib.Path().cwd() / \"session.json\"\n",
3839
"\n",
3940
"session = compas.json_load(filepath)"
4041
]
@@ -78,6 +79,11 @@
7879
"## Export updated session"
7980
]
8081
},
82+
{
83+
"cell_type": "markdown",
84+
"metadata": {},
85+
"source": []
86+
},
8187
{
8288
"cell_type": "code",
8389
"execution_count": 5,
@@ -101,23 +107,15 @@
101107
"execution_count": 6,
102108
"metadata": {},
103109
"outputs": [
104-
{
105-
"name": "stdout",
106-
"output_type": "stream",
107-
"text": [
108-
"PyThreeJS SceneObjects registered.\n",
109-
"TNA Notebook SceneObjects registered.\n"
110-
]
111-
},
112110
{
113111
"data": {
114112
"application/vnd.jupyter.widget-view+json": {
115-
"model_id": "4840473cc0c24ab0a054db4208ef6ae3",
113+
"model_id": "3d52506939034928b19ede7983307b15",
116114
"version_major": 2,
117115
"version_minor": 0
118116
},
119117
"text/plain": [
120-
"VBox(children=(HBox(children=(Button(icon='folder-open', layout=Layout(height='32px', width='48px'), style=But…"
118+
"VBox(children=(HBox(children=(Button(icon='search-plus', layout=Layout(height='32px', width='48px'), style=But…"
121119
]
122120
},
123121
"metadata": {},
@@ -130,18 +128,11 @@
130128
"viewer.scene.add(force.translated([1.2 * form.aabb().xsize, 0, 0]))\n",
131129
"viewer.show()"
132130
]
133-
},
134-
{
135-
"cell_type": "code",
136-
"execution_count": null,
137-
"metadata": {},
138-
"outputs": [],
139-
"source": []
140131
}
141132
],
142133
"metadata": {
143134
"kernelspec": {
144-
"display_name": "compas-dev",
135+
"display_name": "masonry",
145136
"language": "python",
146137
"name": "python3"
147138
},
@@ -155,7 +146,7 @@
155146
"name": "python",
156147
"nbconvert_exporter": "python",
157148
"pygments_lexer": "ipython3",
158-
"version": "3.9.10"
149+
"version": "3.10.14"
159150
}
160151
},
161152
"nbformat": 4,

notebooks/200_equilibrium_horizontal.ipynb

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@
1313
"metadata": {},
1414
"outputs": [],
1515
"source": [
16-
"import compas\n",
1716
"import pathlib\n",
18-
"from compas.colors import Color\n",
17+
"\n",
1918
"from compas_notebook.viewer import Viewer\n",
20-
"from compas_tna.diagrams import FormDiagram\n",
19+
"\n",
20+
"import compas\n",
2121
"from compas_tna.diagrams import ForceDiagram\n",
22-
"from compas_tna.equilibrium import horizontal_nodal"
22+
"from compas_tna.diagrams import FormDiagram\n",
23+
"from compas_tna.equilibrium import horizontal_nodal\n"
2324
]
2425
},
2526
{
@@ -35,7 +36,7 @@
3536
"metadata": {},
3637
"outputs": [],
3738
"source": [
38-
"filepath = pathlib.Path('~/Code/compas_tna/notebooks/session.json').expanduser()\n",
39+
"filepath = pathlib.Path().cwd() / \"session.json\"\n",
3940
"\n",
4041
"session = compas.json_load(filepath)"
4142
]
@@ -49,12 +50,12 @@
4950
},
5051
{
5152
"cell_type": "code",
52-
"execution_count": 3,
53+
"execution_count": null,
5354
"metadata": {},
5455
"outputs": [],
5556
"source": [
56-
"form: FormDiagram = session['formdiagram']\n",
57-
"force: ForceDiagram = session['forcediagram']"
57+
"form: FormDiagram = session[\"formdiagram\"]\n",
58+
"force: ForceDiagram = session[\"forcediagram\"]"
5859
]
5960
},
6061
{
@@ -101,23 +102,15 @@
101102
"execution_count": 6,
102103
"metadata": {},
103104
"outputs": [
104-
{
105-
"name": "stdout",
106-
"output_type": "stream",
107-
"text": [
108-
"PyThreeJS SceneObjects registered.\n",
109-
"TNA Notebook SceneObjects registered.\n"
110-
]
111-
},
112105
{
113106
"data": {
114107
"application/vnd.jupyter.widget-view+json": {
115-
"model_id": "07ddf5142bf94bb2bac2ee92001d5405",
108+
"model_id": "ab9f8ebf821443f692598dd12d5908ec",
116109
"version_major": 2,
117110
"version_minor": 0
118111
},
119112
"text/plain": [
120-
"VBox(children=(HBox(children=(Button(icon='folder-open', layout=Layout(height='32px', width='48px'), style=But…"
113+
"VBox(children=(HBox(children=(Button(icon='search-plus', layout=Layout(height='32px', width='48px'), style=But…"
121114
]
122115
},
123116
"metadata": {},
@@ -134,7 +127,7 @@
134127
],
135128
"metadata": {
136129
"kernelspec": {
137-
"display_name": "compas-dev",
130+
"display_name": "masonry",
138131
"language": "python",
139132
"name": "python3"
140133
},
@@ -148,7 +141,7 @@
148141
"name": "python",
149142
"nbconvert_exporter": "python",
150143
"pygments_lexer": "ipython3",
151-
"version": "3.9.10"
144+
"version": "3.10.14"
152145
}
153146
},
154147
"nbformat": 4,

notebooks/300_equilibrium_vertical.ipynb

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,18 @@
99
},
1010
{
1111
"cell_type": "code",
12-
"execution_count": 1,
12+
"execution_count": null,
1313
"metadata": {},
1414
"outputs": [],
1515
"source": [
16-
"import compas\n",
1716
"import pathlib\n",
18-
"from compas.colors import Color\n",
17+
"\n",
1918
"from compas_notebook.viewer import Viewer\n",
20-
"from compas_tna.diagrams import FormDiagram\n",
19+
"\n",
20+
"import compas\n",
2121
"from compas_tna.diagrams import ForceDiagram\n",
22-
"from compas_tna.equilibrium import vertical_from_zmax"
22+
"from compas_tna.diagrams import FormDiagram\n",
23+
"from compas_tna.equilibrium import vertical_from_zmax\n"
2324
]
2425
},
2526
{
@@ -31,11 +32,11 @@
3132
},
3233
{
3334
"cell_type": "code",
34-
"execution_count": 2,
35+
"execution_count": null,
3536
"metadata": {},
3637
"outputs": [],
3738
"source": [
38-
"filepath = pathlib.Path('~/Code/compas_tna/notebooks/session.json').expanduser()\n",
39+
"filepath = pathlib.Path().cwd() / \"session.json\"\n",
3940
"\n",
4041
"session = compas.json_load(filepath)"
4142
]
@@ -49,12 +50,12 @@
4950
},
5051
{
5152
"cell_type": "code",
52-
"execution_count": 3,
53+
"execution_count": null,
5354
"metadata": {},
5455
"outputs": [],
5556
"source": [
56-
"form: FormDiagram = session['formdiagram']\n",
57-
"force: ForceDiagram = session['forcediagram']"
57+
"form: FormDiagram = session[\"formdiagram\"]\n",
58+
"force: ForceDiagram = session[\"forcediagram\"]"
5859
]
5960
},
6061
{

notebooks/session.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)