Skip to main content

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.0.0 and onward: 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 }

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.

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.

Citation

If you use PySLHA, for either model data handling or spectrum visualisation, please cite the paper: http://arxiv.org/abs/1305.4194

Metadata

Release files for pyslha 3.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyslha 3.3.2
File Size Uploaded
pyslha-3.3.2.tar.gz 57.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyslha 3.3.2
File Interpreter ABI Platform
pyslha-3.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 100.3 kB

Release files / pyslha-3.3.2.tar.gz

Download URL pyslha-3.3.2.tar.gz
Size 57.3 kB
Tags Source
SHA-256 checksum
How to use checksums
209ba785ce8221a0a0159d58849cd587c94eacad89f8a22aaebc84853a553210
BLAKE2b-256 checksum
How to use checksums
4bd278726bd4fa23e728eff16c2919d60cdbfec325aea949a79e1820e00ea11c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / pyslha-3.3.2-py3-none-any.whl

Download URL pyslha-3.3.2-py3-none-any.whl
Size 43.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
379c4119f822a2edf5065ef8be62fea8216d6bfe31f84e7202ea845498d6dbb7
BLAKE2b-256 checksum
How to use checksums
8068ab86ebac4d992ce4d9850c074d515ba95401c29b2d162ac81a01b40ed28f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

3.3.2 This release

2 release files

3.3.1

2 release files

3.3.0

2 release files

3.2.6

1 release file

3.2.5

1 release file

3.2.4

1 release file

3.2.3

1 release file

3.2.2

1 release file

3.2.1

1 release file

3.2.0

1 release file

3.1.2

1 release file

3.1.1

1 release file

3.1.0

1 release file

3.0.4

1 release file

3.0.3

1 release file

3.0.2

1 release file

3.0.1

1 release file

3.0.0

1 release file

2.1.3

1 release file

2.1.2

1 release file

2.1.1

1 release file

2.1.0

1 release file

2.0.0

1 release file

1.5.0

1 release file

1.4.4

1 release file

1.4.3

1 release file

1.4.2

1 release file

1.4.1

1 release file

1.4.0

1 release file

1.3.3

1 release file

1.3.2

1 release file

1.3.1

1 release file

1.3.0

1 release file

1.2.9

1 release file

1.2.8

1 release file

1.2.7

1 release file

1.2.5

1 release file

1.2.4

1 release file

1.2.3

1 release file

1.2.2

1 release file

1.2.1

1 release file

1.2.0

1 release file

1.1.0

1 release file

1.0.8

1 release file

1.0.7

1 release file

1.0.6

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

0.6.1

1 release file

0.6.0

1 release file

0.5.1

1 release file

0.5.0

1 release file

0.4.4

1 release file

0.4.3

1 release file

0.4.1

1 release file

0.4.0

1 release file

0.3.0

1 release file

0.2.4

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.1.0

1 release file

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page