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.1.tar.gz (71.3 MB view details)

Uploaded Source

Built Distributions

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

Uploaded CPython 3.12 Windows x86-64

chromo-0.5.1-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.1-cp312-cp312-macosx_11_0_arm64.whl (22.8 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

chromo-0.5.1-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.1-cp311-cp311-win_amd64.whl (19.8 MB view details)

Uploaded CPython 3.11 Windows x86-64

chromo-0.5.1-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.1-cp311-cp311-macosx_11_0_arm64.whl (22.8 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

chromo-0.5.1-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.1-cp310-cp310-win_amd64.whl (19.8 MB view details)

Uploaded CPython 3.10 Windows x86-64

chromo-0.5.1-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.1-cp310-cp310-macosx_11_0_arm64.whl (22.8 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

chromo-0.5.1-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.1-cp39-cp39-win_amd64.whl (19.8 MB view details)

Uploaded CPython 3.9 Windows x86-64

chromo-0.5.1-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.1-cp39-cp39-macosx_11_0_arm64.whl (22.8 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

chromo-0.5.1-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.1.tar.gz.

File metadata

  • Download URL: chromo-0.5.1.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.1.tar.gz
Algorithm Hash digest
SHA256 53ea2bb4004718922d799de6f87a2542901e7dcdaf00401ecd79dd29ebf331d9
MD5 b866d975ce62889f31bbe16ebac6734d
BLAKE2b-256 97e8b053441d3dba2d0fb8b5eccbe58ce083a8cff5e5fdd2930742b3bf2038c8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chromo-0.5.1-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.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4d64303607686a8a6bb02c65089f160d607991880c7425c311418ffe4b638ec0
MD5 a2e840b31a68b31dd504c122083ac09c
BLAKE2b-256 bedd1df004b67570d4a450a32270b51338471ea608694b8ca782137d4657506c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chromo-0.5.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7cd312a57ddc9997e6ec35677419fa04826162a2e75f71ecf9d72071e9a94a5c
MD5 7044bf15e9b6a67c7c4124f5b171c498
BLAKE2b-256 35ef3e9f9f007847883933591b923b7d3c024373bcdac343844f1514061005e9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chromo-0.5.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7054440c405a6aa7379c30f3f958f89824a3f4b1c67702d20c66bfe165a45692
MD5 9b7a3c579f3f98da8541698feea450cb
BLAKE2b-256 bbb71a066cfe1c3b9623be843345b77684bb410e11b5f07b573b45c76d206598

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chromo-0.5.1-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 145b9bcd8d991c40b4ea65943c9e2095abbcf4e1b73b2aa6127cd09b34db1175
MD5 0d2324a2701d6690c45f141b3e6c7794
BLAKE2b-256 961fae287c531ae52e21e9a622f8c6427963f9c2fc3e5f95f193dd415f3d9eac

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chromo-0.5.1-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.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 26a994250d3f9822d92f4d0028835dc7311c79083ab08f8e5c6b6bfe3b26127c
MD5 bd80ba11969b49de92b477fa352d7dff
BLAKE2b-256 56c3b2f018b684245d8dd2f1ed91ed6fd4058c61b07a0611aea4a9718b409e0d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chromo-0.5.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 efb5cdaad37265bb098e4bb6d7879060ce1aba86e06c5db2d07939da02e9650f
MD5 6161a208c1f8d6dbc1a86728ecf4fbd7
BLAKE2b-256 4b751ce3ea95ad88f589d3b2f331084ed0288842660b1aa2746d816d8dd756a0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chromo-0.5.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d76cb19aa8074e3e8472da7196c7954c0a1cb4653f77e657cbf755578b26e144
MD5 df9b87ea870892d64f05e2c7a484a242
BLAKE2b-256 b3fcc8da631ba61e5b6624e740b4693c79ccbd07e9091b5cad9a96d4524855b9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chromo-0.5.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6a9d16c375259974f225b698ef2c581f4bf3ae2852b9597ca244b54c96d6cc8d
MD5 3035f8735f7ba657e879a96eb29ea369
BLAKE2b-256 32e3cab35cfe200e0b8112777a94d878f92697d35a36031e06fc4e8c7719a8c0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chromo-0.5.1-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.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 a477bd9f97a9e4a78686034fdc0b1fd8901ebeda7442ff0241226297dafa1292
MD5 7f86650a7313065b15ce3c31f1a0fe58
BLAKE2b-256 ccad420263b640428d911cfc63a63b85082cee9b97653e4a41f0bbd744b243ab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chromo-0.5.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f9a9496f4917a8acd347b4b6f827f5702d39847e5c126a79c7ea8ec4d416d373
MD5 19c71aa1f2ae6945fc3c3564073755c1
BLAKE2b-256 31abb57e29ffa5de82f798ef3c0819bee84dd9ca297de60cec6b2bab118aa4ad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chromo-0.5.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b25dd042ce1e3e0b08987fc6bf5894c03737632c2d7cc7e4c0284d0e5b1564a7
MD5 f5e5866ffd042aeab1e321e4fc70db31
BLAKE2b-256 b3f4538e61556df0247dc9ab08779ece888ca5382b42f79333f6594dd89191f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chromo-0.5.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6df923558322e77d9d79886e5d54def9ca820b1e98df58fb0ab4e9fe96d25689
MD5 b317c48ef9d15288111e454872efe498
BLAKE2b-256 df8a584ed8ec323ff46cb402b5c9ca357b83b68d4d980f55f74ca18634171a3b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chromo-0.5.1-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.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 73a43420d5069b9a56af0deffecfdab45b16c7c7fa731418df62f5818d0b7d21
MD5 45a7cffc97c00226274bc62e44fa95e0
BLAKE2b-256 cbf614bf80d8689c2b6a1ddf89181ae6825ee9592aefa277cfa4e580400b585a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chromo-0.5.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b754dcdac23e9462cac05c926636db2025e45a83d4488b13126c00fa75212de2
MD5 3e9c569f4df3a50e108804ca4d2470db
BLAKE2b-256 7f5773c560ed9a9d1430855d6aa84bfa91c8f72e903a89f22c44b1661514a9b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chromo-0.5.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5a1cef562b3ca002e51c19792d33cc3a3982fb230e7466af14abdd2bdb0d47bf
MD5 17e5336b37bf0f4e465e95c278ee5745
BLAKE2b-256 97d18dc6b87873b5986bef9887ae3c5ad7f7ca4d551d857644d144c090e106fb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chromo-0.5.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 af7249e220c02618e6470885fbadad8541c3a3b66a2c3b4b57b0504a355037cd
MD5 7bd3d3626d24fe7d4909c3c93a2753fb
BLAKE2b-256 24cab1400c81f20fac592ad6792633e4c1a6adfa7576231340463769c1ad159a

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