PyVista Geometry Visualization
GEMC uses PyVista to visualize detector geometry directly from Python.
Geometry can be viewed interactively, exported as a .vtksz file for web-based display, or rendered
as a screenshot. See the PyVista API documentation
for the full API reference.
Quickstart
Copy the example to your current directory:
cp -r $GEMC_HOME/examples/basic/pyvista .
cd pyvista
./gemc_pyvista.py
To preview the geometry interactively (opens a PyVista window):
./gemc_pyvista.py -pv
Geometry
The example defines four volumes in pyvista_basic_shapes.py: a transparent container box,
a solid cylinder, a sphere, and a small rotated box inside the container.
Interactive viewer:
Usage
Building the geometry
./gemc_pyvista.py
python API
Pass
-hfor additional command line options:options: -h, --help show this help message and exit -f, --factory FACTORY ascii, sqlite -v, --variation VARIATION Set variation name -r, --run RUN Set run number -sql, --dbhost DBHOST SQLite filename or MYSQL host -pv, --pyvista Show geometry using pyvista (needs pyvista) -pvb, --pvb, --pyvista-background Use PyVista BackgroundPlotter (needs pyqt6 pyvistaqt) -pvw, --width WIDTH Set plotter width -pvh, --height HEIGHT Set plotter height -pvx, --x X Set plotter x position -pvy, --y Y Set plotter y position -axes, --add_axes_at_zeroIf you have
pyvista(see also install pyvista), you can use the-pvand-pvboptions to display the setup without having to run GEMC
Running gemc
gemc pyvista.yaml -n=10
Add -gui to run interactively.