PyVista ジオメトリの可視化



GEMC は PyVista を使用して、Python から直接検出器ジオメトリを可視化します。 ジオメトリはインタラクティブに表示したり、Web 表示用に .vtksz ファイルとしてエクスポートしたり、 スクリーンショットとしてレンダリングしたりできます。完全な API リファレンスについては、 PyVista API ドキュメント を参照してください。


クイックスタート

サンプルをカレントディレクトリにコピーします:

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

ジオメトリをインタラクティブにプレビューするには(PyVista ウィンドウが開きます):

./gemc_pyvista.py -pv


ジオメトリ

このサンプルでは pyvista_basic_shapes.py で 4 つのボリュームを定義しています: 透明なコンテナボックス、 中実の円柱、球、およびコンテナ内部に角度を付けて配置した小さなボックスです。

インタラクティブビューア:


使い方

ジオメトリの構築

./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


GEMC の実行

gemc pyvista.yaml -n=10

インタラクティブに実行するには -gui を追加します。