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 hashes)