Skip to content

Commit 1302799

Browse files
authored
Merge pull request #462 from fusion-energy/remove-dagmc-vis
removed vis
2 parents da49d6f + af461cd commit 1302799

2 files changed

Lines changed: 2 additions & 88 deletions

File tree

tasks/full-day-workshop/task_20/task_20.ipynb

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"cell_type": "markdown",
3434
"metadata": {},
3535
"source": [
36-
"First we visually inspect the geometry and check it is as expected.\n",
36+
"Optionally we can visually inspect the geometry with Paraview and check it is as expected.\n",
3737
"\n",
3838
"We convert the DAGMC h5m file to a vtkhdf file which can be opened with [Paraview](https://www.paraview.org/download/) or as we do here, loaded with pyvista and viewed interactively in the notebook."
3939
]
@@ -47,49 +47,6 @@
4747
"di.convert_h5m_to_vtkhdf(h5m_filename='dagmc.h5m', vtkhdf_filename='dagmc.vtkhdf')"
4848
]
4949
},
50-
{
51-
"cell_type": "code",
52-
"execution_count": null,
53-
"metadata": {},
54-
"outputs": [],
55-
"source": [
56-
"# TEMP WORKAROUND - remove once dagmc_h5m_file_inspector > 0.7.0 (with the ASCII\n",
57-
"# string fix) is installed. Version 0.7.0 writes the 'material_names' field as\n",
58-
"# UTF-8 strings, which VTK's VTKHDF reader cannot read, so the pv.read() below\n",
59-
"# fails with an H5Dread \"no appropriate function for conversion path\" error.\n",
60-
"# Here we rewrite that field as ASCII so VTK can open the file.\n",
61-
"# Fix: https://github.com/fusion-energy/dagmc_h5m_file_inspector/pull/49\n",
62-
"import h5py\n",
63-
"with h5py.File('dagmc.vtkhdf', 'a') as f:\n",
64-
" field_data = f['VTKHDF/FieldData']\n",
65-
" material_names = [\n",
66-
" name.decode() if isinstance(name, (bytes, bytearray)) else str(name)\n",
67-
" for name in field_data['material_names'][:]\n",
68-
" ]\n",
69-
" del field_data['material_names']\n",
70-
" field_data.create_dataset(\n",
71-
" 'material_names', data=material_names, dtype=h5py.string_dtype('ascii')\n",
72-
" )"
73-
]
74-
},
75-
{
76-
"cell_type": "code",
77-
"execution_count": null,
78-
"metadata": {},
79-
"outputs": [],
80-
"source": [
81-
"# setting the pyvista backend to html makes the plot interactive in the notebook\n",
82-
"pv.set_jupyter_backend('html')\n",
83-
"\n",
84-
"plotter = pv.Plotter()\n",
85-
"\n",
86-
"# reading in the vtkhdf file and colouring the geometry by the material id\n",
87-
"dagmc_geometry = pv.read('dagmc.vtkhdf')\n",
88-
"plotter.add_mesh(dagmc_geometry, scalars='material_id', show_edges=True)\n",
89-
"\n",
90-
"plotter.show()"
91-
]
92-
},
9350
{
9451
"cell_type": "markdown",
9552
"metadata": {},

tasks/half-day-conference-workshop/task_12/task_12.ipynb

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"cell_type": "markdown",
3434
"metadata": {},
3535
"source": [
36-
"First we visually inspect the geometry and check it is as expected.\n",
36+
"Optionally we can visually inspect the geometry with Paraview and check it is as expected.\n",
3737
"\n",
3838
"We convert the DAGMC h5m file to a vtkhdf file which can be opened with [Paraview](https://www.paraview.org/download/) or as we do here, loaded with pyvista and viewed interactively in the notebook."
3939
]
@@ -47,49 +47,6 @@
4747
"di.convert_h5m_to_vtkhdf(h5m_filename='dagmc.h5m', vtkhdf_filename='dagmc.vtkhdf')"
4848
]
4949
},
50-
{
51-
"cell_type": "code",
52-
"execution_count": null,
53-
"metadata": {},
54-
"outputs": [],
55-
"source": [
56-
"# TEMP WORKAROUND - remove once dagmc_h5m_file_inspector > 0.7.0 (with the ASCII\n",
57-
"# string fix) is installed. Version 0.7.0 writes the 'material_names' field as\n",
58-
"# UTF-8 strings, which VTK's VTKHDF reader cannot read, so the pv.read() below\n",
59-
"# fails with an H5Dread \"no appropriate function for conversion path\" error.\n",
60-
"# Here we rewrite that field as ASCII so VTK can open the file.\n",
61-
"# Fix: https://github.com/fusion-energy/dagmc_h5m_file_inspector/pull/49\n",
62-
"import h5py\n",
63-
"with h5py.File('dagmc.vtkhdf', 'a') as f:\n",
64-
" field_data = f['VTKHDF/FieldData']\n",
65-
" material_names = [\n",
66-
" name.decode() if isinstance(name, (bytes, bytearray)) else str(name)\n",
67-
" for name in field_data['material_names'][:]\n",
68-
" ]\n",
69-
" del field_data['material_names']\n",
70-
" field_data.create_dataset(\n",
71-
" 'material_names', data=material_names, dtype=h5py.string_dtype('ascii')\n",
72-
" )"
73-
]
74-
},
75-
{
76-
"cell_type": "code",
77-
"execution_count": null,
78-
"metadata": {},
79-
"outputs": [],
80-
"source": [
81-
"# setting the pyvista backend to html makes the plot interactive in the notebook\n",
82-
"pv.set_jupyter_backend('html')\n",
83-
"\n",
84-
"plotter = pv.Plotter()\n",
85-
"\n",
86-
"# reading in the vtkhdf file and colouring the geometry by the material id\n",
87-
"dagmc_geometry = pv.read('dagmc.vtkhdf')\n",
88-
"plotter.add_mesh(dagmc_geometry, scalars='material_id', show_edges=True)\n",
89-
"\n",
90-
"plotter.show()"
91-
]
92-
},
9350
{
9451
"cell_type": "markdown",
9552
"metadata": {},

0 commit comments

Comments
 (0)