Visualisation de la géométrie avec PyVista



GEMC utilise PyVista pour visualiser la géométrie du détecteur directement depuis Python. La géométrie peut être affichée de façon interactive, exportée dans un fichier .vtksz pour un affichage web, ou rendue sous forme de capture d’écran. Consultez la documentation de l’API PyVista pour la référence complète de l’API.


Démarrage rapide

Copiez l’exemple dans votre répertoire courant :

cp -r $GEMC_HOME/examples/basic/pyvista .
cd pyvista
./gemc_pyvista.py

Pour prévisualiser la géométrie de façon interactive (ouvre une fenêtre PyVista) :

./gemc_pyvista.py -pv


Géométrie

L’exemple définit quatre volumes dans pyvista_basic_shapes.py : une boîte conteneur transparente, un cylindre plein, une sphère, et une petite boîte pivotée à l’intérieur du conteneur.

Visualiseur interactif :


Utilisation

Construction de la géométrie

./gemc_pyvista.py

python API

Pass -h for 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_zero

If you have pyvista (see also install pyvista), you can use the -pv and -pvb options to display the setup without having to run GEMC


Exécution de GEMC

gemc pyvista.yaml -n=10

Ajoutez -gui pour une exécution interactive.