Geometry package for high energy physics (Geant4, Fluka)
Project description
pyg4ometry
Python code for rapid creation and conversion of radiation transport Monte Carlo (Geant4 and Fluka) geometries.
Quick start
pyg4ometry is a very capable package to do many tasks related to Geant4/Fluka/MCNP geometry:
- Python scripting to create and assemble geometries
- Loading, editing and writing GDML
- Load and tessellate CAD geometry and export to GDML
- Load ROOT geometry and convert to GDML
- Powerful VTK viewer of geometries
- Converting from GDML to FLUKA and MCNP
- Exporting mesh geometries from GDML to VTP, OBJ, VRML etc.
- Python bindings to CGAL allowing complex mesh manipulation (e.g. hole filling, remeshing)
All with few lines of Python code!
import pyg4ometry as pg4
from g4edgetestdata import G4EdgeTestData
g4data = G4EdgeTestData()
# define a geometry registry
reg = pg4.geant4.Registry()
# build the world volume
world_s = pg4.geant4.solid.Orb("WorldAir", 1.5, reg, lunit="cm")
world_l = pg4.geant4.LogicalVolume(world_s, "G4_AIR", "WorldAir", reg)
reg.setWorld(world_l)
# import an STL file
reader = pg4.stl.Reader(g4data["stl/utah_teapot.stl"], registry=reg)
teapot_s = reader.getSolid()
# place the teapot in the world
teapot_l = pg4.geant4.LogicalVolume(teapot_s, "G4_Cu", "UtahTeapot", reg)
pg4.geant4.PhysicalVolume([0, 0, 0], [0, 0, 0], teapot_l, "UtahTeapot", world_l, reg)
# export to GDML file "geometry.gdml"
writer = pg4.gdml.Writer()
writer.addDetector(reg)
writer.write("./geometry.gdml")
# start an interactive VTK viewer instance
viewer = pg4.visualisation.VtkViewer()
viewer.addLogicalVolume(reg.getWorldVolume())
viewer.view()
Check out our video tutorial for more:
How to Install
Pre-built pyg4ometry wheels can be installed from PyPI using pip:
pip install pyg4ometry
If you cannot find wheels for your operating system / architecture, please open an issue. Building from source requires some non-Python software dependencies. More documentation can be found in the installation guide in the manual.
Many people and groups are using pyg4ometry
- Geometries for BDSIM Geant4 simulation of accelerators
- LEGEND experiment
- FASER2 detector
- CERN North area
- Moller
- Proton therapy beam lines
Referencing and Citation
To support the development and maintenance of pyg4ometry, please cite it! Any publications including simulations made using this software must cite the pyg4ometry paper:
S.D. Walker, A. Abramov, L.J. Nevay, W. Shields, S.T. Boogert, “pyg4ometry: A Python library for the creation of Monte Carlo radiation transport physical geometries”, Computer Physics Communications 272 108228 (2022). DOI: 10.1016/j.cpc.2021.108228
Citation information can be also obtained on GitHub by selecting “Cite this repository” in the sidebar on the right.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file pyg4ometry-1.2.5.tar.gz
.
File metadata
- Download URL: pyg4ometry-1.2.5.tar.gz
- Upload date:
- Size: 6.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9929b71990b3d0773d20fdb65ea94c9bd36d3047a89cf0079f1312c9fa3f4f1 |
|
MD5 | 92ff597ad8400ba4f1bc5addd9223fba |
|
BLAKE2b-256 | d3faa08f267b3933d29074e404b75d2565dc3a466791829f045115e28844def3 |
File details
Details for the file pyg4ometry-1.2.5-cp312-cp312-win_amd64.whl
.
File metadata
- Download URL: pyg4ometry-1.2.5-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 7.3 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d179f9b74b978fa80103e2fa5de592755e09eb0286cc0a30d657d5b27e659812 |
|
MD5 | 7eb88bc0452ad5cbd032b9b126aa6ac1 |
|
BLAKE2b-256 | 58c6373c9d835d0ff6b4aaa972be6977c95d6c25a4d08437af92f2b8202b2836 |
File details
Details for the file pyg4ometry-1.2.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: pyg4ometry-1.2.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 32.6 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a01c66433d5cc85e5fd0339e6966dec5e802b9e2cf78cf9b390947fe445a257e |
|
MD5 | 4357ad1b3e0f4c66eb621562918e9d3f |
|
BLAKE2b-256 | a8553fa459a3d771ad1b1265d6cf020e8e56a6f51fb36c5bb207972dd9e6be07 |
File details
Details for the file pyg4ometry-1.2.5-cp312-cp312-macosx_14_0_arm64.whl
.
File metadata
- Download URL: pyg4ometry-1.2.5-cp312-cp312-macosx_14_0_arm64.whl
- Upload date:
- Size: 7.1 MB
- Tags: CPython 3.12, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 756ec859bd154f6be50fbbd302a13975ae44cb9c6aec9f3b08d812db7bf85835 |
|
MD5 | aee5cc806cfdbfade058970514b38b0c |
|
BLAKE2b-256 | 60bc2269cd8d08442dd3417f680740ee7abd046ec59ea8ff2b626c8918dc7802 |
File details
Details for the file pyg4ometry-1.2.5-cp312-cp312-macosx_13_0_x86_64.whl
.
File metadata
- Download URL: pyg4ometry-1.2.5-cp312-cp312-macosx_13_0_x86_64.whl
- Upload date:
- Size: 7.9 MB
- Tags: CPython 3.12, macOS 13.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c3aea3341b65d3caf59a5022271694748bdb2a49ade4943daf316718f718165 |
|
MD5 | 274b498d1775872d58972beb9bcfd79d |
|
BLAKE2b-256 | 08cc4894853e1e0c7c409fd4925eef8c6209edd682bd6a5251e71802c3342262 |
File details
Details for the file pyg4ometry-1.2.5-cp311-cp311-win_amd64.whl
.
File metadata
- Download URL: pyg4ometry-1.2.5-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 7.3 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9cd46294cb783986a1a43f0c6b3a8ff087f2a23dcac7543a91dc1d62a0b2e30 |
|
MD5 | 4afc8592837aaf1ccf27c380371f55d4 |
|
BLAKE2b-256 | 7c6ed91a35e53b8461fe9231b17080751d5d94f62a2fba2debf557f2310d14aa |
File details
Details for the file pyg4ometry-1.2.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: pyg4ometry-1.2.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 32.7 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 767967d7d80b0dbe16ba7bac94ab769a3a6339db7c3276cde0c9d7221b1e0564 |
|
MD5 | 7b27187f6afb4cc652468b2160fab34b |
|
BLAKE2b-256 | 1dc4cf4359f856fe85d677ba24bd9fb59709ea34768ff858c6d808aa2ff2e5a4 |
File details
Details for the file pyg4ometry-1.2.5-cp311-cp311-macosx_14_0_arm64.whl
.
File metadata
- Download URL: pyg4ometry-1.2.5-cp311-cp311-macosx_14_0_arm64.whl
- Upload date:
- Size: 7.1 MB
- Tags: CPython 3.11, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb64fc5372b8482cafd98bd0b2578ec618aac03cc63d017407c64981837e361c |
|
MD5 | 51577ebac7593f917e4f95988f23da18 |
|
BLAKE2b-256 | fce33004900a233344ea0cc7bfd71a8b306187c94abf52f7fcecffd47d35c0d0 |
File details
Details for the file pyg4ometry-1.2.5-cp311-cp311-macosx_13_0_x86_64.whl
.
File metadata
- Download URL: pyg4ometry-1.2.5-cp311-cp311-macosx_13_0_x86_64.whl
- Upload date:
- Size: 7.9 MB
- Tags: CPython 3.11, macOS 13.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b93006a5f8c1051411f763c99c961616e17af00d0aef3c24438e2cda089b5837 |
|
MD5 | 3bab583518f87afef66d06adc66b97cf |
|
BLAKE2b-256 | 5721f812f06860e24d0a02e4a26287f04d699d2ecef2881c7d9f69af61914978 |
File details
Details for the file pyg4ometry-1.2.5-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: pyg4ometry-1.2.5-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 7.3 MB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4057dc6f96bb73d15b0046ea5ed2afaa16c1701f3eedbf8b0ab77e982883ba95 |
|
MD5 | 66aca59536904ee97567f100f3d45aef |
|
BLAKE2b-256 | 0d835349988298d34adb67513500638239d62083f0dcccd83becd82c75c1500a |
File details
Details for the file pyg4ometry-1.2.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: pyg4ometry-1.2.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 32.6 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7ca1a5406bbccd0022fecddffaae3f9e1611e68245cebd3ebc1e81f2c1ccba5 |
|
MD5 | 05cd9ee6d883e98a9e6692613d17b6ed |
|
BLAKE2b-256 | 825ac4df6adbb8a18430aed5c1c077bbb3180472d05a41e797734360e88ebdcd |
File details
Details for the file pyg4ometry-1.2.5-cp310-cp310-macosx_14_0_arm64.whl
.
File metadata
- Download URL: pyg4ometry-1.2.5-cp310-cp310-macosx_14_0_arm64.whl
- Upload date:
- Size: 7.1 MB
- Tags: CPython 3.10, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d9b3633c8dbfae42c5700fa3bb1ef4f6e5c809865c386274142a5ced05eb34c |
|
MD5 | 4d0ef8c8877edf49a88416bccb74970d |
|
BLAKE2b-256 | 5c4e030183e73b1514f84995b45ec1f60f18cfd5e377396e4ed86cd2f776cce4 |
File details
Details for the file pyg4ometry-1.2.5-cp310-cp310-macosx_13_0_x86_64.whl
.
File metadata
- Download URL: pyg4ometry-1.2.5-cp310-cp310-macosx_13_0_x86_64.whl
- Upload date:
- Size: 7.8 MB
- Tags: CPython 3.10, macOS 13.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a2890875b34a09da13c57b34bce5afda1b5c33a69b97bc04d64127049c68e5c |
|
MD5 | b3d904453f0429d651419623a148f2f3 |
|
BLAKE2b-256 | 4846704f8c2edfcd01dc4ba4557e4d24b28cdf6fa0999868119ba0592532d022 |
File details
Details for the file pyg4ometry-1.2.5-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: pyg4ometry-1.2.5-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 7.2 MB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3bb371a632257464e4e2340111d09aa4dd8010d63996bda99870e2a2b547f515 |
|
MD5 | d19c4cc84402710135981389f3ddf02a |
|
BLAKE2b-256 | c473007428a8e1cf1249c6e3965b8c9e4393aecb73471019264f970494d861be |
File details
Details for the file pyg4ometry-1.2.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: pyg4ometry-1.2.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 32.6 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e12fc26fd6a53eb88844ca1d381a5cef1e924dae389b106009ba54a76bf6e21 |
|
MD5 | 9b36f91162c6dbcf88fd5818bd0cfeb9 |
|
BLAKE2b-256 | 79a47d91f4947f673c303810aae2897fcc37ee7135e1f48bc59315856d9516cb |
File details
Details for the file pyg4ometry-1.2.5-cp39-cp39-macosx_14_0_arm64.whl
.
File metadata
- Download URL: pyg4ometry-1.2.5-cp39-cp39-macosx_14_0_arm64.whl
- Upload date:
- Size: 7.1 MB
- Tags: CPython 3.9, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06f02ab95bbe2f6bf217fa237892ecb7e61d4ec3ff06d9e072952bcb4e1c8cbc |
|
MD5 | 82f7e21abcd95f90225891cda74ef496 |
|
BLAKE2b-256 | dab3f2321fd3217ad05c799f737fb05019377684bbe9d3d6cab8cfa7ddb7b7c1 |
File details
Details for the file pyg4ometry-1.2.5-cp39-cp39-macosx_13_0_x86_64.whl
.
File metadata
- Download URL: pyg4ometry-1.2.5-cp39-cp39-macosx_13_0_x86_64.whl
- Upload date:
- Size: 7.8 MB
- Tags: CPython 3.9, macOS 13.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc036123cc7da8f6001a7f7935119889cebc75195e6afb70b9abcfd67703cd2d |
|
MD5 | a16fc2ff51b5ed96a64aad951cbc15f6 |
|
BLAKE2b-256 | e577d35435ff03336d3f613b1033bd69266379fff3249dcd4dbb7208b2aac10d |
File details
Details for the file pyg4ometry-1.2.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: pyg4ometry-1.2.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 32.6 MB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb1dd9618ae3b9bc840d28d5fc7999f5cc551a1e12f564492a02701db73ce9e7 |
|
MD5 | 2dfdfe763f5c96242bda5677c9a35ed9 |
|
BLAKE2b-256 | 2b33cb792f9c1db2c224e9c92bc7ee7d3da4dcd3300a8a4d740dc7770d9ce0c2 |