Package to convert a Monte Carlo particle in the form of a numpy-array to a MCPL-file.
Project description
np2mcpl
np2mcpl is a low-key tool to help write mcpl-files directly from numpy-arrays.
Build/Install/Use
- Make sure you have installed the MCPL-library (and NumPy)
- Build the python/c module:
python setup.py build
- Add the build directory to PYTHONPATH or run:
python setup.py install
- In your python script:
import np2mcpl
- Create a numpy array and save it. E.g. :
np2mcpl.save("output",M)
Notes and limitations
- np2mcpl takes as input a 2D NumPy array with 10 or 13 columns, where the columns are assumed to be:
PDG-code x y z ux uy uz t e_kin weight [ px py pz ]
where the PDG-code denotes which kind of particle it is, e.g. 2112 for neutrons, 22 for photon, ... as documented here: Particle Numbering Scheme
- The vector ux,uy,uz must have unit length. The optional vector px,py,pz is the polarisation vector associated with the Monte Carlo-particle.
- Units follow the MCPL-standard. I.e. x,y,z in cm, e_kin in MeV, t in ms.
- The input array is expected to be made of floating point numbers (including the PDG-code) in either double or single precision. If the numpy array is in single precision, this will be reflected in the mcpl-file.
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
np2mcpl-0.1.0.tar.gz
(5.5 kB
view details)
File details
Details for the file np2mcpl-0.1.0.tar.gz
.
File metadata
- Download URL: np2mcpl-0.1.0.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 559463ef9e065a2edc0bcb7db0afc6a6bff758b0cfd3a35d013f25c38f0ae83c |
|
MD5 | e33c890c0f526710c9a6c0f085e394ff |
|
BLAKE2b-256 | 20e4ea4777961072ef37cfcea3129b31fdd54bcba4a72963a9e1b5da853c884a |