Skip to content

Commit e181772

Browse files
authored
Merge pull request #13 from virtualcell/trame-widgets
Add trame widgets for VTK visualization
2 parents 8b78cfb + 5393b49 commit e181772

File tree

6 files changed

+1834
-405
lines changed

6 files changed

+1834
-405
lines changed

examples/notebooks/fielddata_trame.ipynb

Lines changed: 466 additions & 0 deletions
Large diffs are not rendered by default.

examples/notebooks/widget.ipynb

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{
2+
"cells": [
3+
{
4+
"metadata": {
5+
"ExecuteTime": {
6+
"end_time": "2025-03-21T23:23:46.759746Z",
7+
"start_time": "2025-03-21T23:23:44.598316Z"
8+
}
9+
},
10+
"cell_type": "code",
11+
"source": [
12+
"import os\n",
13+
"from pathlib import Path\n",
14+
"from pyvcell.sim_results.result import Result\n",
15+
"from pyvcell.sim_results.widget import App\n",
16+
"\n",
17+
"out_dir_path = Path(os.getcwd()) / \"workspace\" / \"sim1_dir\"\n",
18+
"zarr_path = out_dir_path / \"zarr\"\n",
19+
"\n",
20+
"result = Result(solver_output_dir=out_dir_path,\n",
21+
" out_dir=out_dir_path,\n",
22+
" sim_id=1072355302, job_id=0,\n",
23+
" zarr_dir=zarr_path)\n",
24+
"app = App(vtk_data=result.vtk_data)\n",
25+
"# asyncio.get_event_loop().run_until_complete(app.run())\n",
26+
"\n",
27+
"await app.run()"
28+
],
29+
"id": "92ac6f0eb409f41",
30+
"outputs": [
31+
{
32+
"name": "stdout",
33+
"output_type": "stream",
34+
"text": [
35+
"subdomain0::s0 VariableType.VOLUME\n",
36+
"subdomain0::s1 VariableType.VOLUME\n",
37+
"subdomain0_subdomain1_membrane::s2 VariableType.MEMBRANE\n",
38+
"subdomain1::s3 VariableType.VOLUME\n",
39+
"vcRegionVolume VariableType.VOLUME_REGION\n",
40+
"vcRegionArea VariableType.MEMBRANE_REGION\n",
41+
"vcRegionVolume_subdomain1 VariableType.MEMBRANE_REGION\n",
42+
"vcRegionVolume_subdomain0 VariableType.MEMBRANE_REGION\n"
43+
]
44+
},
45+
{
46+
"data": {
47+
"text/plain": [
48+
"HTML(value='<iframe id=\"trame_trame__template_main\" src=\"http://localhost:64932/index.html?ui=main&reconnect=a…"
49+
],
50+
"application/vnd.jupyter.widget-view+json": {
51+
"version_major": 2,
52+
"version_minor": 0,
53+
"model_id": "270ada65b2c14ffd938a2ba462df6087"
54+
}
55+
},
56+
"metadata": {},
57+
"output_type": "display_data"
58+
}
59+
],
60+
"execution_count": 1
61+
}
62+
],
63+
"metadata": {
64+
"kernelspec": {
65+
"display_name": "Python 3 (ipykernel)",
66+
"language": "python",
67+
"name": "python3"
68+
},
69+
"language_info": {
70+
"codemirror_mode": {
71+
"name": "ipython",
72+
"version": 3
73+
},
74+
"file_extension": ".py",
75+
"mimetype": "text/x-python",
76+
"name": "python",
77+
"nbconvert_exporter": "python",
78+
"pygments_lexer": "ipython3",
79+
"version": "3.9.19"
80+
}
81+
},
82+
"nbformat": 4,
83+
"nbformat_minor": 5
84+
}

0 commit comments

Comments
 (0)