Skip to main content

Hadronic Interaction Model interface in Python

Project description


Cosmic ray and HadROnic interactiOn MOnte-carlo frontend

This package provides a simple and generic user interface to popular event generators used in cosmic ray and high-energy particle physics. By removing the need for complicated Fortran-style interfaces, ASCII input cards, and C++ dependencies, the package simplifies the simulation of particle interactions, making it easier and faster for a wider audience to access.

Usage

Python user interface

To simulate interactions with one of the supported event generators, import the package and define the parameters of the collision. Then, create an instance of an event generator, and generate events.

import numpy as np
import chromo

# Define the parameters of the collisions
kinematics = chromo.kinematics.CenterOfMass(
    13 * chromo.constants.TeV,
    "proton", "proton")
# Create an instance of an event generator
generator = chromo.models.Sibyll23d(kinematics)

nevents = 0
average_pt = 0

# Generate 10000 events
for event in generator(10000):
    # Filter event
    event = event.final_state_charged()
    # do something with event.pid, event.eta, event.en, event.pt, etc.
    # these variables are numpy arrays, that can be histogrammed or counted like
    pt = event.pt[np.abs(event.pid) == 211]
    # The list could be empty
    if len(pt) > 0:
        nevents += 1
        average_pt += np.mean(pt)

average_pt = average_pt / nevents
print("Average pT for charged pions {0:4.3f}".format(average_pt))

Further examples, such as this can be found in the examples folder.

Command line user interface (CLI)

Installing chromo also makes a command-line interface available. If your Python runtime environment is properly set up, you can do

 chromo --help

To see the help of the command-line interface. If that does not work, just replace chromo with python -m chromo. The command-line interface was designed to feel familiar for users of CRMC. The CLI can write events in a variety of output formats, as detailed below. HepMC output can be piped into RIVET and many other tools supporting the format.

Output formats

  • HepMC (via pyhepmc, optionally gzip compressed)
  • ROOT (via uproot)
  • SVG images of events (via pyhepmc package)

Supported models and how to cite them

Please note that chromo only provides a user interface for the following models, and does not contain any particle physics models itself. When using any of these models in public-facing work, it is important to properly cite the original model reference by following the links below. Additionally, if you find chromo useful in your work, we would appreciate an acknowledgement, footnote, or link to chromo.

Interaction model Supported proj/targ Comment
DPMJET-III 3.0.7 & PHOJET 1.12-36 hN, γγ, γN, hA, γA, AA
DPMJET-III & PHOJET 19.1 and 19.3 (repo on GitHub) hN, γγ, γN, hA, γA, AA
EPOS-LHC hN, hA, AA
PYTHIA 6.4 hN, ee, γγ, γN
PYTHIA 8.3 (https://pythia.org/) hN, ee, γγ, γN & hA, AA (Argantyr) unavailable on Windows
QGSJet-01 hN, hA, AA
QGSJet-II-03 hN, hA, AA
QGSJet-II-04 hN, hA, AA
SIBYLL-2.1 hN, hA (A<=20)
SIBYLL-2.3d hN, hA (A<=20) incl. legacy versions -2.3/-2.3c
SOPHIA 2.0 γN
UrQMD 3.4 + second citation hN, hA, AA* unavailable on Windows

h = hadron, N = nucleon (p or n), A = nucleus, γ = photon, e = electron/positron

Installation via PyPI

Supported platforms

  • Python 3.8+
  • Linux, Mac OS X (x86 and M1/M2), Windows

The recommended way to install chromo is by using the pre-compiled binary wheel, which is available for most common architectures and Python versions

pip install chromo

Advanced and developer installation instructions can be found here.

Authors

  • Anatoli Fedynitch
  • Hans Dembinski
  • Anton Prosekin
  • Sonia El Hadri
  • Keito Watanabe

LICENSE

The source code of chromo is licensed under the BSD 3-clause license (see LICENSE for detail). The source codes of the event generators are individually licensed under different conditions (see the COPYING files located in the subdirectories).

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

chromo-0.5.0.tar.gz (71.3 MB view details)

Uploaded Source

Built Distributions

chromo-0.5.0-cp312-cp312-win_amd64.whl (19.8 MB view details)

Uploaded CPython 3.12 Windows x86-64

chromo-0.5.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (23.8 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

chromo-0.5.0-cp312-cp312-macosx_11_0_arm64.whl (22.8 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

chromo-0.5.0-cp312-cp312-macosx_10_9_x86_64.whl (25.5 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

chromo-0.5.0-cp311-cp311-win_amd64.whl (19.8 MB view details)

Uploaded CPython 3.11 Windows x86-64

chromo-0.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (23.8 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

chromo-0.5.0-cp311-cp311-macosx_11_0_arm64.whl (22.8 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

chromo-0.5.0-cp311-cp311-macosx_10_9_x86_64.whl (25.5 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

chromo-0.5.0-cp310-cp310-win_amd64.whl (19.8 MB view details)

Uploaded CPython 3.10 Windows x86-64

chromo-0.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (23.8 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

chromo-0.5.0-cp310-cp310-macosx_11_0_arm64.whl (22.8 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

chromo-0.5.0-cp310-cp310-macosx_10_9_x86_64.whl (25.5 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

chromo-0.5.0-cp39-cp39-win_amd64.whl (19.8 MB view details)

Uploaded CPython 3.9 Windows x86-64

chromo-0.5.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (23.8 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

chromo-0.5.0-cp39-cp39-macosx_11_0_arm64.whl (22.8 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

chromo-0.5.0-cp39-cp39-macosx_10_9_x86_64.whl (25.5 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

Details for the file chromo-0.5.0.tar.gz.

File metadata

  • Download URL: chromo-0.5.0.tar.gz
  • Upload date:
  • Size: 71.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.8

File hashes

Hashes for chromo-0.5.0.tar.gz
Algorithm Hash digest
SHA256 9dce823d8f0c85495b3b459b9a83351b18ae74dd83e19dcdae475c7bcedacc29
MD5 8908d069f18208dff11c4f7280265ad6
BLAKE2b-256 acc6e8f6950cefa6dadf8dde5150a37653e96309bf3ec82e52ab91e44dfb9f52

See more details on using hashes here.

File details

Details for the file chromo-0.5.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: chromo-0.5.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 19.8 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.8

File hashes

Hashes for chromo-0.5.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 7f0999a6ad475886876ec8ec90b9b3ed07d73c32e0aba26304827d3cb64d1cb0
MD5 70eb82dc72f62ab6a17e8dca83d5e8da
BLAKE2b-256 8e47bccad9869b16a7bfd1ac941e7e2f8e4f07fc129c617b4359a52bb47b1223

See more details on using hashes here.

File details

Details for the file chromo-0.5.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for chromo-0.5.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7d316c3750b62b02dd0721b7aba45d98502f288cf8385ddc59f9604b8e170feb
MD5 d94061b9655eddf432bd5fd555924d04
BLAKE2b-256 0ca9227fd1eee4dfffc726475c9191d676b7152c61fe3233d9983bef53d7cfb1

See more details on using hashes here.

File details

Details for the file chromo-0.5.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for chromo-0.5.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2e576727041dc56d127ced14dcdf1ee895db952554ddddf909b033354f6a400a
MD5 6d503e1f7c198ff1502de3bb6d75aaef
BLAKE2b-256 9581f280d5402f198d596443ef595d77e2e749528412e59700d563f8b7ec6604

See more details on using hashes here.

File details

Details for the file chromo-0.5.0-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for chromo-0.5.0-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a6f2030cb29ad6b1f3dee32552276d2bf5a4737282a14f5d9e02715e8cb2d472
MD5 110d81231adfdb3432a42eec31c7a220
BLAKE2b-256 4ae9cb30eca9c80730b98700ef8a6f21720f4f6aa58718b9aa596030b6f143e8

See more details on using hashes here.

File details

Details for the file chromo-0.5.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: chromo-0.5.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 19.8 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.8

File hashes

Hashes for chromo-0.5.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 35229472711a136e204d1b7ff309030760cc02d0d1bb82425f1eb941dd82640d
MD5 b63b357ee3efd9bcc0b2d239a8ab01a8
BLAKE2b-256 d3e263a9c730a64b86d5c08ba63eceff7c801f83c0bd465d3d498a8ef88269c2

See more details on using hashes here.

File details

Details for the file chromo-0.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for chromo-0.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dac397d7433d043e1a59b044e1c01b5461c0e4abc03021eceef5613b9e27acdf
MD5 ac78fefcb03feed2cb80643eb6b4820b
BLAKE2b-256 295f162316a8d84bb23e0ba72b004b08c0d0df6a84872384f36a2eeece242ee2

See more details on using hashes here.

File details

Details for the file chromo-0.5.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for chromo-0.5.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 567fa83b36811a4939408a74e1ba4373ae22537d722f669589e1455aec1406e7
MD5 15e1632eae19f4297e2f2787df857258
BLAKE2b-256 44d16e8610ba444d85bc025f418d794735f432c4b6d7016af17c7ae116cdd814

See more details on using hashes here.

File details

Details for the file chromo-0.5.0-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for chromo-0.5.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5dff800b7d7aee46c0b59283953d417b70ec5a19a8e1325495669faa64e41963
MD5 3a84f2812f5644151cdd294b0b2af369
BLAKE2b-256 85a375e483e60098851148686fac204fc9f9cd478f7aab5e105274c472916c02

See more details on using hashes here.

File details

Details for the file chromo-0.5.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: chromo-0.5.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 19.8 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.8

File hashes

Hashes for chromo-0.5.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c7e67af00f20b656a4230584e0f2ebdd7c30144cd57d0b8056dd974521fa2b35
MD5 e664edd900be2ec4b1afe96ebeb768e5
BLAKE2b-256 93a018f3ed3ab846a11943fab70dc416c45065b62598c9771e0dd165bf18931f

See more details on using hashes here.

File details

Details for the file chromo-0.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for chromo-0.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3b769e5be336c516c733ba93804d311c7de11624bd5e8098222c69105b308796
MD5 ec16ad858b4f1a4993eee768fbf84545
BLAKE2b-256 e3863cb746566e570712ef5f1cbd933d1d63cd68afaf5a2eef3261a07878ff32

See more details on using hashes here.

File details

Details for the file chromo-0.5.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for chromo-0.5.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8274c45ce88a4cfe4ee121c3dc84af9ea7e1149e35862a6f0eb0d5e12a078bae
MD5 7ad0cc23a7e0f9b6e0dc53ec1f0b8982
BLAKE2b-256 3c04fb7899b9dc5727288ebd6a05dfe3e9298b0ffa870af8b24ddf8f5a0905bf

See more details on using hashes here.

File details

Details for the file chromo-0.5.0-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for chromo-0.5.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a12dfd74e86e69fe548469e178f172e6c8be49363c64f9e3924caf8aecf0ea70
MD5 502f1286e492a99215601a42927fa40d
BLAKE2b-256 5b76e0fcceb952c29cee5396d394fdbccc2e2c325f07427b11571e5b0e6e2117

See more details on using hashes here.

File details

Details for the file chromo-0.5.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: chromo-0.5.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 19.8 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.8

File hashes

Hashes for chromo-0.5.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 8af08956974dbc54ffcc0e5160d9266bee1b47a506ddac13344b28e88674f24f
MD5 4e99171bfc3e43bf2260ec90f8040d48
BLAKE2b-256 704a1246322cef25d157f50004a90d7123d2536df9bd7ca38d21fda400771124

See more details on using hashes here.

File details

Details for the file chromo-0.5.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for chromo-0.5.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4934d957a1a1eb6e2811cdbe35d43071da18927503bcbadc0462d72747389bc8
MD5 e7c9df7d2c58f8176b8ae90960e11882
BLAKE2b-256 ffd71b8b17f935524fa3773def92c29b27bb5693bdaf4d5b481377e197da0539

See more details on using hashes here.

File details

Details for the file chromo-0.5.0-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for chromo-0.5.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 57842c6d1b349dea157662951474d691fc31959eeed8595582f3daa26f01bd72
MD5 9bf9da9a4e9402f17fa3dc917033a7b6
BLAKE2b-256 f416069ffaabd56ed8dfdff11e2d25a943b9c22da1daa16ea0de8dd17b95efdf

See more details on using hashes here.

File details

Details for the file chromo-0.5.0-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for chromo-0.5.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 17ef6121104743bd648cb17d4176495cc3e8a0efd03d21b5bb42d83925826ace
MD5 866f00f59dc82de137c80ddea4f4a8cd
BLAKE2b-256 93d65a04cbe03bfd1c9d1f0a73fa6788c4ab0fb8160150b3c00654f2ff8a30bb

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