Skip to main content

Package to convert a Monte Carlo particle in the form of a numpy-array to a MCPL-file.

Project description

np2mcpl

License: MIT

np2mcpl is a low-key tool to help write mcpl-files directly from numpy-arrays.

Build/Install/Use

  1. Make sure you have installed the MCPL-library (and NumPy)
  2. Build the python/c module: python setup.py build
  3. Add the build directory to PYTHONPATH or run: python setup.py install
  4. In your python script: import np2mcpl
  5. 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


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)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page