Skip to main content

A fast general purpose monte carlo particle simulator (photons, electrons and positrons). Written in Cython, Python and C++.

Project description

The first stable realease will be version 0.1.

MontyCarlo (v0.1a0.dev2)

license pyversion architecture os

MontyCarlo is a python framework for setting up simulations and/or developing applications whose basis is the simulation of particle transport. It simulates the propagation and effects of ionizing radiation (photons, electrons and positrons with energies between 1keV and 1GeV) in matter of homogeneous density, filling constructive solid geometry models.

As of yet, this is an unstable version. This is a thesis project and, as a student, I am still learning!

This work has a poster presentation in the 3rd European Congress of Medical Physics and has been presented in a workshop organized by the Faculty of Sciences of the University of Porto and the Ludwig Maximilian University of Munich.

Try it out!

See here for instructions on installing the latest release.

Once you've installed MontyCarlo, clone or download the following repository: https://github.com/RuiFilipeCampos/MyCo-EXAMPLE1

Inside this repository folder simply run:

python main.py

Have fun exploring high energy particle tracks in a 3d environment!

  • White tracks: Photons
  • Blue tracks: electrons
  • Red tracks: positrons

The innermost sphere contains water, the outer sphere contains air and the rest of space is filled with gold.

ex01

Be sure to zoom in on every detail!

ex02

Bugs

This is a very early version of a fairly large code. Bugs are guaranteed! Submitting an issue is a great way to contribute to the project at this stage!

Available Features:

  • Construction of any material via a stochiometric formula and density water = Mat({1:2, 8:1}, 1);
  • Constructed materials are automatically cached in the folder your_project\mat.
  • Only spheres are available. This will remain as such until all this has been thoroughly tested:
    • Constructive Solid Geometry (CSG) using the | & and - operators;
    • linear transformations on the volumes (translation and rotation);
    • bounding volume hierarchy (BVH) constructed with the aid of the user;
    • a syntatic indication of the BVH using with statements;
    • a new method of particle transport that greatly accelerates the simulation of electrons and positrons;
  • The volumes surfaces are rendered and cached in your_project/geo;
  • Three particles are available:
    • Photons (analogue simulation);
      • Compton Scattering;
      • Rayleigh Scattering;
      • Photoelectric Effect;
      • Pair Production;
      • Triplet Production;
    • Electrons (class II condensed history);
      • Elastic Scattering (atom is not affected): Angular Deflection + Bremstrahlung Production;
      • Inelastic Scattering (atom is affected): Interaction with an individual atom + with the condensed medium as a whole;
    • Positrons (class II condensed history);
      • Elastic Scattering (atom is not affected): Angular Deflection + Bremstrahlung Production;
      • Inelastic Scattering (atom is affected): Interaction with an individual atom + with the condensed medium as a whole;
      • Anihilation (positron meets electron);
  • The simulation is coupled (e.g. supports secondary particle creation)
  • Supports simulation of post-ionization relaxation effects;
  • Two particle sources are available:
    • Isotropic point source: emits particles from a point with randomized directions - IsotropicPoint
    • Directional point source: emits particles from a point towards a specified direction - Beam
  • Automated database download on first import;
  • 3d plotting of particle trajectories;
  • 3d plotting of the constructed geometry;
  • simultaneous plotting of both geometry and trajectories;
  • One tally is available:
    • Z_TALLY - calculates PDD's
  • Automatic generation of *.html output files (work in progress though)

Possible Future Work

  • Sources
  • Tallying
    • Energy Deposition (1d, 2d, 3d, 4d(spatial + temporal) )
    • Flux
    • Others
  • Variance reduction
  • Image Detectors
  • Extension to E < 1keV (for laser applications)
  • Extension to E > 1GeV (for thermonuclear applications)
  • Implementation of other particles
    • Protons
    • Neutrons
    • etc...
  • Dedicated graphics engine (w/sphere tracing)
  • An auto-cad like GUI for CSG modeling
  • Geant4 like API
  • GPU accelaration
  • CPU multiprocessing/multithreading
  • Advanced data vizualization (w/ ParaView)
  • Distributed Cloud Computing
  • Dedicated python notebook (like Jupyter)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

MontyCarlo-0.1a0.dev2-cp39-cp39-win_amd64.whl (17.8 MB view details)

Uploaded CPython 3.9 Windows x86-64

MontyCarlo-0.1a0.dev2-cp39-cp39-macosx_10_14_x86_64.whl (21.9 MB view details)

Uploaded CPython 3.9 macOS 10.14+ x86-64

MontyCarlo-0.1a0.dev2-cp38-cp38-win_amd64.whl (16.3 MB view details)

Uploaded CPython 3.8 Windows x86-64

MontyCarlo-0.1a0.dev2-cp38-cp38-macosx_10_14_x86_64.whl (21.8 MB view details)

Uploaded CPython 3.8 macOS 10.14+ x86-64

MontyCarlo-0.1a0.dev2-cp37-cp37m-win_amd64.whl (17.7 MB view details)

Uploaded CPython 3.7m Windows x86-64

MontyCarlo-0.1a0.dev2-cp37-cp37m-macosx_10_14_x86_64.whl (21.7 MB view details)

Uploaded CPython 3.7m macOS 10.14+ x86-64

File details

Details for the file MontyCarlo-0.1a0.dev2-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: MontyCarlo-0.1a0.dev2-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 17.8 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.0 pkginfo/1.6.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.5

File hashes

Hashes for MontyCarlo-0.1a0.dev2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 345651e91667bdd85b845a3d2e761d68b2876b915ad50f9ea148cba70c875e99
MD5 1eaf68b1d3c9f675d2abe09d15dd1f3b
BLAKE2b-256 6e26e18f51e29303695414c17d18e73e7d585bbfef3669dd838d241927e0c019

See more details on using hashes here.

File details

Details for the file MontyCarlo-0.1a0.dev2-cp39-cp39-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: MontyCarlo-0.1a0.dev2-cp39-cp39-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 21.9 MB
  • Tags: CPython 3.9, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.0 pkginfo/1.6.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.5

File hashes

Hashes for MontyCarlo-0.1a0.dev2-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 56d70f03cc92d0d7d56e15e6aa19aa13bb2bd1645cf688643d1a968c0d00d57e
MD5 efe341e7bcd4ce5eb2d6040f2ccfe482
BLAKE2b-256 206708277f5bfee732c6cd94537a2048bd96cdf240053fd81d26464bbb41f406

See more details on using hashes here.

File details

Details for the file MontyCarlo-0.1a0.dev2-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: MontyCarlo-0.1a0.dev2-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 16.3 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.0 pkginfo/1.6.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.5

File hashes

Hashes for MontyCarlo-0.1a0.dev2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 b60d0a0c6339975f34bf851515c751149dcb56b86f2349b33dcf27ac3ad1ad99
MD5 1b82356c6db020872457cff66f05a744
BLAKE2b-256 9a1b7f573a0ee42f4514aa76818e1a7bfae1f6e62fbe3dfae13e6b3d4c732b9b

See more details on using hashes here.

File details

Details for the file MontyCarlo-0.1a0.dev2-cp38-cp38-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: MontyCarlo-0.1a0.dev2-cp38-cp38-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 21.8 MB
  • Tags: CPython 3.8, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.0 pkginfo/1.6.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.5

File hashes

Hashes for MontyCarlo-0.1a0.dev2-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 f216dca5db7a5a9964eba2953495eb764b002b7b09b0b9239fa065af6a534757
MD5 cbd01478ed30533c1824dce28647f350
BLAKE2b-256 20489b042750013c6ca137cda31703b72e8902438cf2035a8cfc5c5d63327010

See more details on using hashes here.

File details

Details for the file MontyCarlo-0.1a0.dev2-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: MontyCarlo-0.1a0.dev2-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 17.7 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.0 pkginfo/1.6.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.5

File hashes

Hashes for MontyCarlo-0.1a0.dev2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 43fd4aa56f98f43eac555e8242bd029182e6efae7d6dff688b1bca1387777e76
MD5 8d40f01c864da9aa7057e42e473eb8b9
BLAKE2b-256 5cd9ab0fa5fb1992007e8a0d107ac7a555ebfbe3e82e1bbf1687990a16aef0f6

See more details on using hashes here.

File details

Details for the file MontyCarlo-0.1a0.dev2-cp37-cp37m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: MontyCarlo-0.1a0.dev2-cp37-cp37m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 21.7 MB
  • Tags: CPython 3.7m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.0 pkginfo/1.6.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.5

File hashes

Hashes for MontyCarlo-0.1a0.dev2-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 34649259d11fdcd20a1824b8cd201deeee5e844c59438a224dcf58f332377ce2
MD5 821d0c9ec992c30cacef0abdb95816fa
BLAKE2b-256 edda215e8caf03aa33f636de72244f6d846cdfba9c379b296a6f6ac6d4cacbc3

See more details on using hashes here.

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