Parsing, manipulating, and visualising SUSY Les Houches Accord data
Project description
A simple but flexible handler of the SUSY Les Houches Accord (SLHA) data format.
pyslha is a parser/writer module for particle physics SUSY Les Houches Accord (SLHA) supersymmetric spectrum/decay files, and a collection of scripts which use the interface, e.g. for conversion to and from the legacy ISAWIG format, or to plot the mass spectrum and decay chains.
The current release supports SLHA version 1, and as far as I’m aware is also fully compatible with SLHA2: the block structures are read and accessed generically. If you have any problems, please provide an example input file and I’ll happily investigate. SLHA3 is not yet supported (or standardised) but in recent releases the new structures will not crash the parser. Support will be added once the format is standardised (and in response to demand!)
The plotting script provides output in PDF, EPS and PNG via LaTeX and the TikZ graphics package, and as LaTeX/TikZ source for direct embedding into documents or user-tweaking of the generated output.
Users of version 2.x should note that the interface has changed a little in version 3.x: there are now generic read()/write() functions which can operate on filenames or file objects, and all I/O functions now return/accept a single Doc object rather than a tuple of blocks, decays, etc. dicts. This single-object interface to the SLHA document allows for more coherent handling of the data, as well as better robustness against future changes in the format and planned support for documentation comments.
API example
>>> import pyslha >>> # generic read from file: >>> d = pyslha.read('spcfiles/sps1a.spc') >>> d <PySLHA Doc: 22 blocks, 35 decays, 0 xsections> >>> # or, to ignore blocks known to be e.g. badly formatted: >>> d = pyslha.read('spcfiles/sps1a.spc', ignoreblocks=['DCINFO']) >>> d <PySLHA Doc: 21 blocks, 35 decays, 0 xsections> >>> d.blocks Blocks SPINFO { 1 : SOFTSUSY; 2 : 2.0.5 } MODSEL { 1,1 : sugra } SMINPUTS { 1 : 1.27934000e+02; 2 : 1.16637000e-05; ... ... >>> d.blocks.has_key('MODSEL') True >>> d.blocks['MODSEL'] MODSEL { 1,1 : sugra } >>> d.blocks['MODSEL'][1,1] 'sugra' >>> d.blocks['MODSEL'][1,2] = 'foo' >>> d.blocks['MODSEL'] MODSEL { 1,1 : sugra; 1,2 : foo }
Blocks
The Block interface also supplies dict-like has_key(), keys(), and items() methods, as well as more specialist value(), set_value() and is_single_valued() methods for improved access to ALPHA and any other unindexed blocks.
Decays
The decay system has a similar interface to that of the generic Block for accessing particle decay channel information:
>>> d.decays.keys() [23, 24, 6, 25, 35, 36, 37, 1000021, 1000006, 2000006, 1000005, 2000005, ... >>> d.decays[1000021] 1000021 : mass = 6.07713704e+02 GeV : total width = 5.50675438e+00 GeV 1.05840237e-01 [1000005, -5] 1.05840237e-01 [-1000005, 5] ...
The DECAY blocks in SLHA files are in fact mapped into Particle objects, each of which contains multiple Decay objects. Check the Python documentation for Doc, Block, Particle and Decay, plus the pyslha module free functions for I/O.
Cross-sections
Cross-section information, cf. the new XSECTION block type, is available via Doc.xsections. As for decays, the API structure is a bit different from the text format: xsections is a dict of Process objects, each of which contains all XSECTION lines for a given list of (sorted) initial + final state particle IDs. This is different from the text format in that a single Process contains cross-sections, as XSec objects, for multiple centre-of-mass energies (sqrts). For example:
>>> print d.xsections [(2212, 2212, 1000001, 1000003), (2212, 2212, -1000002, 2000002), ...] >>> myproc = d.xsections[2212,2212,1000001,1000003]
The Process interface supplies a convenient method for filtering the contained XSecs on any of their defining attributes, including scale scheme, QCD and EW orders, multiplicative scale factors, PDF ID code, and generator/integrator.
>>> myproc.get_xsecs(sqrts=13000., kappa_r=2., code='Prospino')
Citation
If you use PySLHA, for either model data handling or spectrum visualisation, please cite the paper: http://arxiv.org/abs/1305.4194
TODOs:
- For 3.1.x:
In set_value, if first item is non-int, treat as None-indexed.
Refine value string heuristic for strings with ints in them?
- For 3.2.0:
Use Doc to handle document-level header comments.
Use _dict to handle block and decay summary comments.
Preserve _inline_ comments from read -> write (needs full-line/inline comment separation). Can use separate comment dicts in Block, Decay, etc. and attach a multiline .comment attr to the returned/written dicts.
- Later, maybe:
Identify HERWIG decay matrix element to use in ISAWIG.
Handle RPV SUSY in ISAWIG.
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
File details
Details for the file pyslha-3.1.1.tar.gz
.
File metadata
- Download URL: pyslha-3.1.1.tar.gz
- Upload date:
- Size: 42.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ae161657a5a5265980a18d55cd911b87afae29733391c493717dc3057f26ca5 |
|
MD5 | b501b345ffcab17e164c4be325f6ec0c |
|
BLAKE2b-256 | 50aafb62c6c9ac084cb898c4dc9b046e870c0e3a69a37a6a766cec636faac8ff |