Skip to main content

Pythonic access to high energy particle data tables and PDG ID codes.

Project description

Pythonic access to high energy particle data tables and ID codes.

This is a rethink in Python of the commonly used HepPDT/HepPID packages for accessing particle data tables and PDG scheme particle ID codes.

Particle data table functions (cf. HepPDT)

HepPDT has no native Python interface, and it is not easy to naturally wrap its C++ interface for Python, so PyPDT is written from scratch in Python, with a lighter class count than the original: it’s just a convenience interface to a small ASCII data file, so who needs lots of classes?

Examples:

>>> tbl = pypdt.ParticleDataTable('particle.tbl')
>>> # or tbl = pypdt.ParticleDataTable() # to read from AFS default db
>>> # or tbl = pypdt.PDT() # if you prefer minimal keystrokes to clarity :)
>>> print tbl[13] # print a summary of muon information
>>> tbl[6].mass # access the top mass in GeV
>>> tbl[23].width # access the Z width in GeV
>>> tbl[310].lifetime # access the K0S lifetime in ps
>>> tbl[310].ctau # access the K0S lifetime in mm
>>> tbl[310].mean_disp(10.) # get the mean flight distance of a 10 GeV K0S in mm
>>> print sorted((p.ctau, id) for id, p in tbl) # list all particle ctaus in asc order

The world is your bivalve of choice…

For maximum convenience, you can even use PyPDT from the command line:

$ python -m pypdt 13 310 mu^-: ID=13, m=1.06e-01 GeV, 3*q=-3, width=9.99e-19 GeV, tau=6.59e+05 ps, ctau=1.97e+05 mm K_S^0: ID=310, m=4.98e-01 GeV, 3*q=0, width=2.46e-14 GeV, tau=2.68e+01 ps, ctau=8.02e+00 mm

(If /afs/cern.ch is not present, add -f path/to/my/particle.tbl to the above.)

Particle ID functions (cf. HepPID)

PyPDT also contains Python versions of the HepPID library of functions for interpreting particle ID codes in the PDG scheme. The code of these functions has been directly translated to Python from HepPID’s ParticleIdMethods – please notify the author of this package in case of inaccuracies or evolution of the PID scheme.

Examples:

>>> pypdt.isSUSY(2010011)
True

TODO:

  • Add PID functions to the ParticleData class

  • Use doctest

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

PyPDT-0.2.2.tar.gz (14.1 kB view details)

Uploaded Source

File details

Details for the file PyPDT-0.2.2.tar.gz.

File metadata

  • Download URL: PyPDT-0.2.2.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for PyPDT-0.2.2.tar.gz
Algorithm Hash digest
SHA256 3d4e1d020410a7b25b30acb67e07538c9e89a3552fab6d617f80baae9576ca6b
MD5 5d09f9c5eb2907b9e2942b8cffc36630
BLAKE2b-256 9b99c5af3f961d4f10b445f14c65e28401b0bde81b6f64f824dbf5dd30b73ab2

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