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; ...
...
>>> 'MODSEL' in d.blocks
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 keys(), values(), and items()
methods, as well as more specialised 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.
Raw data
{
"_id": null,
"home_page": "http://www.insectnation.org/projects/pyslha",
"name": "pyslha",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "supersymmetry susy slha simulation mass decay hep physics particle",
"author": "Andy Buckley",
"author_email": "andy@insectnation.org",
"download_url": "https://files.pythonhosted.org/packages/b8/bd/4382ed07946bb0e59738fc9a7b19de415b2c28f6fd94183d56b7d9e16d00/pyslha-3.2.6.tar.gz",
"platform": null,
"description": "A simple but flexible handler of the SUSY Les Houches Accord (SLHA) data format.\n\npyslha is a parser/writer module for particle physics SUSY Les Houches Accord\n(SLHA) supersymmetric spectrum/decay files, and a collection of scripts which\nuse the interface, e.g. for conversion to and from the legacy ISAWIG format, or\nto plot the mass spectrum and decay chains.\n\nThe current release supports SLHA version 1, and as far as I'm aware is also\nfully compatible with SLHA2: the block structures are read and accessed\ngenerically. If you have any problems, please provide an example input file and\nI'll happily investigate. SLHA3 is not yet supported (or standardised) but in\nrecent releases the new structures will not crash the parser. Support will be\nadded once the format is standardised (and in response to demand!)\n\nThe plotting script provides output in PDF, EPS and PNG via LaTeX and the TikZ\ngraphics package, and as LaTeX/TikZ source for direct embedding into documents or\nuser-tweaking of the generated output.\n\nUsers of version 2.x should note that the interface has changed a little in\nversion 3.x: there are now generic read()/write() functions which\ncan operate on filenames or file objects, and all I/O functions now\nreturn/accept a single Doc object rather than a tuple of blocks, decays,\netc. dicts. This single-object interface to the SLHA document allows for more\ncoherent handling of the data, as well as better robustness against future\nchanges in the format and planned support for documentation comments.\n\nAPI example\n-----------\n\n>>> import pyslha\n>>> # generic read from file:\n>>> d = pyslha.read('spcfiles/sps1a.spc')\n>>> d\n<PySLHA Doc: 22 blocks, 35 decays, 0 xsections>\n>>> # or, to ignore blocks known to be e.g. badly formatted:\n>>> d = pyslha.read('spcfiles/sps1a.spc', ignoreblocks=['DCINFO'])\n>>> d\n<PySLHA Doc: 21 blocks, 35 decays, 0 xsections>\n>>> d.blocks\nBlocks\n SPINFO { 1 : SOFTSUSY; 2 : 2.0.5 }\n MODSEL { 1,1 : sugra }\n SMINPUTS { 1 : 1.27934000e+02; 2 : 1.16637000e-05; ...\n ...\n>>> 'MODSEL' in d.blocks\nTrue\n>>> d.blocks['MODSEL']\nMODSEL { 1,1 : sugra }\n>>> d.blocks['MODSEL'][1,1]\n'sugra'\n>>> d.blocks['MODSEL'][1,2] = 'foo'\n>>> d.blocks['MODSEL']\nMODSEL { 1,1 : sugra; 1,2 : foo }\n\n\nBlocks\n------\n\nThe Block interface also supplies dict-like keys(), values(), and items()\nmethods, as well as more specialised value(), set_value() and is_single_valued()\nmethods for improved access to ALPHA and any other unindexed blocks.\n\n\nDecays\n------\n\nThe decay system has a similar interface to that of the generic Block for\naccessing particle decay channel information:\n\n>>> d.decays.keys()\n[23, 24, 6, 25, 35, 36, 37, 1000021, 1000006, 2000006, 1000005, 2000005, ...\n>>> d.decays[1000021]\n1000021 : mass = 6.07713704e+02 GeV : total width = 5.50675438e+00 GeV\n 1.05840237e-01 [1000005, -5]\n 1.05840237e-01 [-1000005, 5]\n ...\n\nThe DECAY blocks in SLHA files are in fact mapped into Particle objects, each of\nwhich contains multiple Decay objects. Check the Python documentation for Doc,\nBlock, Particle and Decay, plus the pyslha module free functions for I/O.\n\n\nCross-sections\n--------------\n\nCross-section information, cf. the new XSECTION block type, is available via\nDoc.xsections. As for decays, the API structure is a bit different from the text\nformat: xsections is a dict of Process objects, each of which contains all\nXSECTION lines for a given list of (sorted) initial + final state particle\nIDs. This is different from the text format in that a single Process contains\ncross-sections, as XSec objects, for multiple centre-of-mass energies\n(sqrts). For example:\n\n>>> print d.xsections\n[(2212, 2212, 1000001, 1000003), (2212, 2212, -1000002, 2000002), ...]\n>>> myproc = d.xsections[2212,2212,1000001,1000003]\n\nThe Process interface supplies a convenient method for filtering the\ncontained XSecs on any of their defining attributes, including scale scheme, QCD\nand EW orders, multiplicative scale factors, PDF ID code, and\ngenerator/integrator.\n\n>>> myproc.get_xsecs(sqrts=13000., kappa_r=2., code='Prospino')\n\n\nCitation\n--------\n\nIf you use PySLHA, for either model data handling or spectrum visualisation,\nplease cite the paper: http://arxiv.org/abs/1305.4194\n\nTODOs:\n\n For 3.2.x:\n * In set_value, if first item is non-int, treat as None-indexed.\n * Refine value string heuristic for strings with ints in them?\n\n For 3.3.0:\n * Use Doc to handle document-level header comments.\n * Use _dict to handle block and decay summary comments.\n * Preserve _inline_ comments from read -> write (needs full-line/inline\n comment separation). Can use separate comment dicts in Block, Decay,\n etc. and attach a multiline .comment attr to the returned/written dicts.\n\n Later, maybe:\n * Identify HERWIG decay matrix element to use in ISAWIG.\n * Handle RPV SUSY in ISAWIG.\n",
"bugtrack_url": null,
"license": "GPL",
"summary": "Parsing, manipulating, and visualising SUSY Les Houches Accord data",
"version": "3.2.6",
"split_keywords": [
"supersymmetry",
"susy",
"slha",
"simulation",
"mass",
"decay",
"hep",
"physics",
"particle"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "a9146f154c95c49e553de94ed70aa729",
"sha256": "262a604c244db31a07362933001dedc24dd510e803785f9536e8d983ee66e75d"
},
"downloads": -1,
"filename": "pyslha-3.2.6.tar.gz",
"has_sig": false,
"md5_digest": "a9146f154c95c49e553de94ed70aa729",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 41178,
"upload_time": "2022-12-19T15:20:01",
"upload_time_iso_8601": "2022-12-19T15:20:01.707407Z",
"url": "https://files.pythonhosted.org/packages/b8/bd/4382ed07946bb0e59738fc9a7b19de415b2c28f6fd94183d56b7d9e16d00/pyslha-3.2.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-19 15:20:01",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "pyslha"
}