A language to describe particle decays, and tools to work with them.
Project description
A language to describe particle decays, and tools to work with them.
Installation
Just run the following:
pip install decaylanguage
You can use a virtual environment through pipenv or with --user
if you know
what those are. Python 2.7 and 3.4+ are supported.
Dependencies: (click to expand)
Required and compatibility dependencies will be automatically installed by pip.
Required dependencies:
- Numpy: The numerical library for Python
- pandas: Tabular data in Python
- attrs: DataClasses for Python
- plumbum: Command line tools
Python compatibility:
- six: Compatibility library
- pathlib2 backport if using Python 2.7
- enum34 backport if using Python /< 3.5
- importlib_resources backport if using Python /< 3.7
Recommended dependencies:
- graphviz to render (DOT language) graph descriptions of decay chains.
Usage
This is a quick user guide; for full API docs, go here.
DecayLanguage is a set of tools for building and transforming particle decays. The parts are:
Particles
You can use a variety of methods to get particles; if you know the PDG number you can get a particle directly, or you can use a search:
Particle.from_pdgid(211)
Particle.from_search_list(name='pi')[0]
You can search for the properties, which are name
, mass
, width
,
charge
, A
, rank
, I
, J
, G
, P
, quarks
, status
, latex
,
mass_upper
, mass_lower
, width_upper
, and width_lower
(some of
those don't make sense). You can also use from_search
to require only
one match.
Once you have a particle, any of the properties can be accessed, along
with several methods. Though they are not real properties, you can
access bar
, radius
, and spin_type
. You can also invert()
a
particle. There are lots of printing choices, describe()
,
programmatic_name()
, html_name()
, html printing outs in notebooks,
and of course repr
and str
support.
Decays
The most common way to create a decay chain is to read in an AmpGen style syntax from a file or a string. You can use:
from decaylanguage.decay import AmplitudeChain
lines, parameters, constants, states = AmplitudeChain.read_ampgen(text='''
EventType D0 K- pi+ pi+ pi-
D0[D]{K*(892)bar0{K-,pi+},rho(770)0{pi+,pi-}} 0 1 0.1 0 1 0.1
K(1460)bar-_mass 0 1460 1
K(1460)bar-_width 0 250 1
a(1)(1260)+::Spline::Min 0.18412
a(1)(1260)+::Spline::Max 1.86869
a(1)(1260)+::Spline::N 34
''')
Here, lines
will be a list of AmplitudeChain lines (pretty print supported in Jupyter notebooks),
parameters
will be a table of parameters (ranged parameters not yet supported),
constants
will be a table of constants,
and states
will be the list of known states (EventType).
Converters
You can output to a format (currently only GooFit supported, feel free to make a PR to add more). Use a subclass of DecayChain, in this case, GooFitChain. To use the GooFit output, type from the shell:
python -m decaylanguage.decay -G goofit myinput.opts
Acknowledgements
DecayLanguage is free software released under a BSD 3-Clause License. It was originally developed by Henry Schreiner.
Changelog
0.2.0 (2018-08-02)
- First release as part of SciKit-HEP
- Using new data package with
importlib_resources
(orimportlib.resources
on Python 3.7) - Better docs and examples
- Some method renaming
- Generalized converter script
0.1.0 (2018-03-13)
- First release on PyPI
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 Distribution
File details
Details for the file decaylanguage-0.2.0.tar.gz
.
File metadata
- Download URL: decaylanguage-0.2.0.tar.gz
- Upload date:
- Size: 135.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0dc902827631741760f296cfff8115dd4356ba0de599d2c54d79173fc1635229 |
|
MD5 | 4602026ed25cdad019378a277044e1da |
|
BLAKE2b-256 | 344f10909ea217afbaeaafa050b490f14959259fbcd49f4917f38569934e29f4 |
File details
Details for the file decaylanguage-0.2.0-py2.py3-none-any.whl
.
File metadata
- Download URL: decaylanguage-0.2.0-py2.py3-none-any.whl
- Upload date:
- Size: 40.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b4e5c5b2179421300476626fa085084b846ee7db26141b3b4ab92bcd18b076d |
|
MD5 | 45306b24c88f6930dd42ca055f83e17c |
|
BLAKE2b-256 | f005c715bb1d17645d19c39c9051607aef571e814a4254547ed74b3d77c90489 |