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
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
Built Distributions
File details
Details for the file chromo-0.4.0.tar.gz
.
File metadata
- Download URL: chromo-0.4.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.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 600da3a6a95af9e33a282abf051af3e1c36bf35e511d681ea7df90744b0f7515 |
|
MD5 | c9fa338f3f5173d57dec4988f19cb82c |
|
BLAKE2b-256 | db7305f59ab62e2926595fd3b7ba8d101509a82291c631d5f8d284da773643b0 |
File details
Details for the file chromo-0.4.0-cp311-cp311-win_amd64.whl
.
File metadata
- Download URL: chromo-0.4.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.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68dac69a63b081e6382bb1d3512ee3a9e8b0c2feb6c925632fb203f25bfc5843 |
|
MD5 | 7ddf1c976742f5fcfc82f970a8f9a0ab |
|
BLAKE2b-256 | 9ef85bf25a6f2a21d6ec03b26ebae2ce28470657b27d3ce0a0f0e32035ca490f |
File details
Details for the file chromo-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: chromo-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 23.7 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4d09b0d0223cb2a84424aeae87afc8f948291bae28898a45707d733c0e36ff0 |
|
MD5 | a724d2e2df10a7edd341ca218893a0c4 |
|
BLAKE2b-256 | e5ff61f63aa272d3cd2ce6a1c0b9e373e125dee84b999b8d220d30b436902158 |
File details
Details for the file chromo-0.4.0-cp311-cp311-macosx_11_0_arm64.whl
.
File metadata
- Download URL: chromo-0.4.0-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 22.7 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 589f25b26df935cd2b563cd44b2782cbed18ff00b06f4700d7198fc6daedfa52 |
|
MD5 | 6538a5a219085ffe5660308ee346e0c6 |
|
BLAKE2b-256 | 0d684366a6fced4b17a73cd00f941b05d8f29a81d1d9143ff4557b539d970090 |
File details
Details for the file chromo-0.4.0-cp311-cp311-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: chromo-0.4.0-cp311-cp311-macosx_10_9_x86_64.whl
- Upload date:
- Size: 25.5 MB
- Tags: CPython 3.11, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b00cfc9321addff182228d1bf6991d04f1c765d9458057609a0fe6fcaad5825e |
|
MD5 | 467aed39c792ea1e89860325361dc878 |
|
BLAKE2b-256 | 44a5368bc8efb57ae33191559bf53da87db6be06dee2c82af8766d4fe481541d |
File details
Details for the file chromo-0.4.0-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: chromo-0.4.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.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ed351d91548d5a55df48447c57569093715f6ef1e661cee7586374dc766be8e |
|
MD5 | 3a84270e377f0cfd9f556a3991dfb2dc |
|
BLAKE2b-256 | f32ae1d3d146be8f4fb0d4270e4a961612a76aeed9cf87a1f934b91cfbffd37f |
File details
Details for the file chromo-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: chromo-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 23.7 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dfd411a5221c2183e6ce64c34d50941a4d69ba17eb9dba5c74231ebebed147fd |
|
MD5 | 329997d68c28acefe9eb1f39db35ad0b |
|
BLAKE2b-256 | 167c80e41a9ed2c48fa3e9750e4d5abb8f3f47c0a7a03222452a22afb1d2aec1 |
File details
Details for the file chromo-0.4.0-cp310-cp310-macosx_11_0_arm64.whl
.
File metadata
- Download URL: chromo-0.4.0-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 22.7 MB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8706c7fd32c1e13c23c4079a699ef5d50b9b36c2542e2de427da78360e2ded6 |
|
MD5 | f9be8e2f0ad5b7de77b4f23060b31ce7 |
|
BLAKE2b-256 | 2b52d8194d7857e7f146b8f70301ba446946968725718a5b991b698103716481 |
File details
Details for the file chromo-0.4.0-cp310-cp310-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: chromo-0.4.0-cp310-cp310-macosx_10_9_x86_64.whl
- Upload date:
- Size: 25.5 MB
- Tags: CPython 3.10, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45bef2eeaf9ecea55201eea347d6eb4b5f7dee4d68df9e7c33b56c1f9627a18f |
|
MD5 | f33c04f910b00ecc290bd822ce7b5bba |
|
BLAKE2b-256 | 0f6fc4bed11b3707c558e530a5a9afd6a58af50dd7fd896131a82460f5b22a19 |
File details
Details for the file chromo-0.4.0-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: chromo-0.4.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.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfd85e8ae20dba50a71b9eb7ba2aa96f7deed0a00e3ccdb949bf4ca277a19bc5 |
|
MD5 | fc7153f5db9bba546840ecabc24e139a |
|
BLAKE2b-256 | 42f674401fa208ae98357f41c73f1fb527ebd4e66e4b2478f9797a136604aa33 |
File details
Details for the file chromo-0.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: chromo-0.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 23.7 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2aadf1227c11e4f5f363722588b0f32b6f4be9776a9fe61193e0ac94030e654f |
|
MD5 | 8b18acdd5135d1fdab4a2b517d772a7e |
|
BLAKE2b-256 | 20929f830d0f790bfda65bdaa1277a17017368543bdad5d7f6033e9cf52bbc2a |
File details
Details for the file chromo-0.4.0-cp39-cp39-macosx_11_0_arm64.whl
.
File metadata
- Download URL: chromo-0.4.0-cp39-cp39-macosx_11_0_arm64.whl
- Upload date:
- Size: 22.7 MB
- Tags: CPython 3.9, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fd6001ae459e15994ec80e416ff24723f275e3fea98fea21b0a937f0f86721e |
|
MD5 | 2232e340422081f22ee754422fb0a2d8 |
|
BLAKE2b-256 | 87381c74b5d451e904432f7a238e36bc7b1e2902936b723870f91abc9cf93091 |
File details
Details for the file chromo-0.4.0-cp39-cp39-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: chromo-0.4.0-cp39-cp39-macosx_10_9_x86_64.whl
- Upload date:
- Size: 25.5 MB
- Tags: CPython 3.9, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9af701b9a489ae795aa5465946c3854fdeb8c3660ca56af5bb1afe673f15505 |
|
MD5 | 1f480fc84516231864e6d3337d81b84b |
|
BLAKE2b-256 | 53dde4bc07f5d0fe0c3406bffdf1dfb3c2ac44c2cdc7f8ab7e2cefdcb64c2a93 |
File details
Details for the file chromo-0.4.0-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: chromo-0.4.0-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 19.8 MB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d383eed804d9c883981351f5d3602672dcc1a8819ffd0ee8dbb31bd541a149bd |
|
MD5 | d88c2db7615ffb9fd0e4b4aff9ff01f1 |
|
BLAKE2b-256 | 121f429414d8251c7d3bca721d0589ccb755fc55792920c4ff67ff0eded116e5 |
File details
Details for the file chromo-0.4.0-cp38-cp38-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: chromo-0.4.0-cp38-cp38-macosx_10_9_x86_64.whl
- Upload date:
- Size: 25.5 MB
- Tags: CPython 3.8, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ca4b2876ac0975027d8fc71c8f020896e2379ae1b1e4583f4ee1ba6d488c499 |
|
MD5 | 51b1c9c36f94942788149633c76a74b0 |
|
BLAKE2b-256 | 5834fb1bf9d4c22f24c18a9b98bc10309e62e488ae50e1fdd80827c2e537865a |