Skip to main content

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.2.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.3.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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyslha-3.2.3.tar.gz (43.3 kB view details)

Uploaded Source

File details

Details for the file pyslha-3.2.3.tar.gz.

File metadata

  • Download URL: pyslha-3.2.3.tar.gz
  • Upload date:
  • Size: 43.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/2.7

File hashes

Hashes for pyslha-3.2.3.tar.gz
Algorithm Hash digest
SHA256 ca7311af368496b55f6a7cb8bed86dd255a477b2a1d61f81d781ec6d07e17476
MD5 43fef4f4958504df8ae775f59978ee07
BLAKE2b-256 7e3928891d37a16099067e57aca04db480ba4d94f70076cbeb26f4fa4952e955

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