Bases: smodels.tools.externalTool.ExternalTool
An instance of this class represents the installation of nllfast.
Checks if installation of tool is valid by looking for executable and executing it.
Execute nllfast.
Params process: | which process: st, sb, gg, gdcpl, sdcpl, ss, sg, tot |
---|---|
Params pdf: | cteq=cteq6, mstw2008 |
Params squarkmass: | |
squarkmass, None if squark decoupled | |
Params gluinomass: | |
gluinomass, None if gluino decoupled | |
Returns: | stdout and stderr, or error message |
Bases: tools.externalNllFast.ExternalNllFast
An instance of this class represents the installation of nllfast 7.
Bases: tools.externalNllFast.ExternalNllFast
An instance of this class represents the installation of nllfast 8.
Bases: smodels.tools.externalTool.ExternalTool
An instance of this class represents the installation of pythia6.
Check if file exists, raise an IOError if it does not.
Returns: | absolute file name if file exists. |
---|
Check if installation of tool is correct by looking for executable and running it.
Parameters: | compile – should it try to fix the situation, if something is wrong? |
---|---|
Returns: | True, if everything is ok |
Replace strings in the config file by other strings, similar to setParameter.
This is introduced as a simple mechanism to make changes to the parameter file.
Parameters: | replacements – dictionary of strings and values; the strings will be replaced with the values; the dictionary keys must be strings present in the config file |
---|
Run Pythia.
Parameters: |
|
---|---|
Returns: | stdout and stderr, or error message |
Bases: object
An instance of this class represents the installation of an external tool.
An external tool encapsulates a tool that is executed via commands.getoutput. It defines how the tool is tested for proper installation and how the tool is executed.
Bases: smodels.theory.printer.Printer
Object to run several checks on the input file. It holds an LheStatus (SlhaStatus) object if inputType = lhe (slha)
Variables: |
|
---|
Bases: smodels.theory.printer.Printer
Object to check if input lhe file contains errors.
Variables: | filename – path to input LHE file |
---|
Bases: smodels.theory.printer.Printer
Object that holds all status information and has a predefined printout.
Variables: |
|
---|
Append warning to warnings.
Parameters: | warning – warning to be appended |
---|
An instance of this class represents quantum numbers.
Get quantum numbers (spin*2, electrical charge*3, color dimension) from qNumbers.
Bases: smodels.theory.printer.Printer
Class that collects experimental constraints and has a predefined printout.
Variables: |
|
---|
Add a result to the outputarry, unless it violates maxcond.
Parameters: |
|
---|
Access printout format.
Parameters: | outputLevel – general control for the output depth to be printed (0 = no output, 1 = basic output, 2 = detailed output,... |
---|
Bases: smodels.theory.printer.Printer
An instance of this class represents the status of an SLHA file. The output status is: = 0 : the file is not checked, = 1: the check is ok = -1: case of a physical problem, e.g. charged LSP, = -2: case of formal problems, e.g. no cross sections
Variables: |
|
---|
Check if chi01 is lsp and chipm1 is NLSP. If so, check mass splitting. This function is not used, the limit is arbitrary.
Calculate mass splitting between particles with pid1 and pid2.
Returns: | mass difference |
---|
Check if any decay is listed for the particle with pid
Parameters: | pid – PID number of particle to be checked |
---|---|
Returns: | True if the decay block is missing or if it is empty, None otherwise |
Get status summary from all performed checks.
Returns: | a status flag and a message for explanation |
---|
Find decays for which the sum of daughter masses excels the mother mass
Parameters: | findIllegal – True if check should be run |
---|---|
Returns: | status flag and message |
Find lightest particle (not in rEven).
Returns: | pid, mass of the lsp, if returnmass == True |
---|
Find meta-stable particles that decay to visible particles and stable charged particles.
Returns: | status flag, message |
---|
For all non-rEven particles listed in mass block, check if decay block is written
Returns: | status flag and message |
---|
Find second lightest particle (not in rEven).
Returns: | pid ,mass of the NLSP, if returnmass == True |
---|
Compute lifetime from decay-width for a particle with pid.
Parameters: |
|
---|---|
Returns: | lifetime |
Check if XSECTION table is present in the slha file.
Parameters: | checkXsec – set True to run the check |
---|---|
Returns: | status flag, message |
Calculate the sum of all branching ratios for particle with pid.
Parameters: | pid – PID of particle |
---|---|
Returns: | sum of branching ratios as given in the decay table for pid |
Object to describe one missing topology result :ivar topo: topology description :ivar weights: weights dictionary
Bases: smodels.theory.printer.Printer
Object to find and collect MissingTopo objects, plus printout functionality :ivar sqrts: center of mass energy for which missing topologies should be evaluated
adds an element to the list of missing topologies if the element contributes to a missing topology that is already in the list, add weight to topology :parameter el: element to be added
Loops over all the elements in smstoplist and checks if the elements are tested by any of the analysis in listOfAnalysis.
Parameters: |
|
---|
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 1.x should note that the interface has changed a little in version 2.0.0 and onward, in particular in the interface of the Block objects, which are now more dict-like: entries can be added and accessed via the usual square-brackets indexing operators, including for multiple indices as is common for mixing matrices e.g. NMIX[1,2] as opposed to the old NMIX.entries[1][2] way. This does break backward compatibility but is a big improvement both for internal code sanity and usability. The Block interface also now 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.
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.0.x:
- Add handling of XSECTION if/when standardised.
- In set_value, if first item is non-int, treat as None-indexed.
- Refine value string heuristic for strings with ints in them?
- Use Doc to handle document-level header comments.
- Add block and decay summary comments to the OrderedDict (wrap OrderedDict as DataStore?)
- For 3.1.x:
- Preserve inline comments from read -> write (needs full-line/inline comment separation). Can use separate comment dicts in Block and Decay, and attach a multiline .comment attr to the returned/written dicts.
- Later/maybe:
- Add Sphinx docs.
- Identify HERWIG decay matrix element to use in ISAWIG.
- Handle RPV SUSY in ISAWIG.
Bases: exceptions.Exception
Exception object to be raised when a SLHA block is accessed in an invalid way
Bases: object
Object representation of any BLOCK elements read from an SLHA file.
Blocks have a name, may have an associated Q value, and contain a collection of data entries, each indexed by one or more keys. Entries in the dictionary are stored as numeric types (int or float) when a cast from the string in the file has been possible.
Block is closely related to a Python dict (and, in fact, is implemented via an OrderedDict when possible). The preferred methods of entry access use the dict-like [] operator for getting and setting, and the keys() and items() methods for iteration. Purely iterating over the object behaves like keys(), as for an ordinary dict.
Multiple (integer) indices are possible, especially for entries in mixing matrix blocks. These are now implemented in the natural way, e.g. for access to the (1,2) element of a mixing matrix block, use bmix[1,2] = 0.123 and print bmix[1,2]. The value() and set_value() functions behave similarly. Multi-element values are also permitted.
It is possible, although not usual, to store unindexed values in a block. This is only supported when that entry is the only one in the block, and it is stored in the normal fashion but with None as the lookup key. The value() method may be used without a key argument to retrieve this value, if the is_single_valued() method returns True, and similarly the set_value() method may be used to set it if only one argument is supplied and the object is compatible.
Add an entry to the block from an iterable (i.e. list or tuple) of strings, or from a whitespace-separated string.
This method is just for convenience: it splits the single string argument if necessary and converts the list of strings into numeric types when possible. For the treatment of the resulting iterable see the set_value method.
Get a value from the block with the supplied key.
If no key is given, then the block must contain only one non-indexed value otherwise an AccessError exception will be raised.
Return true if there is only one entry, and it has no index: the ‘value()’ attribute may be used in that case without an argument.
Access the block items as (key,value) tuples.
Note: The Python 3 dict attribute ‘items()’ is used rather than the ‘old’ Python 2 ‘iteritems()’ name for forward-looking compatibility.
Set a value in the block via supplied key/value arguments.
Indexing is determined automatically: any leading integers will be treated as a multi-dimensional index, with the remaining entries being a (potentially multi-dimensional) value. If all N args are ints, then the first N-1 are treated as the index and the Nth as the value.
If there is only one arg it will be treated as the value of a single-valued block. In this case the block must already contain at most one non-indexed value otherwise an AccessError exception will be raised.
Set a value in the block via supplied key/value arguments.
Indexing is determined automatically: any leading integers will be treated as a multi-dimensional index, with the remaining entries being a (potentially multi-dimensional) value. If all N args are ints, then the first N-1 are treated as the index and the Nth as the value.
If there is only one arg it will be treated as the value of a single-valued block. In this case the block must already contain at most one non-indexed value otherwise an AccessError exception will be raised.
Bases: object
Object representing a decay entry on a particle decribed by the SLHA file. ‘Decay’ objects are not a direct representation of a DECAY block in an SLHA file... that role, somewhat confusingly, is taken by the Particle class.
Decay objects have three properties: a branching ratio, br, an nda number (number of daughters == len(ids)), and a tuple of PDG PIDs to which the decay occurs. The PDG ID of the particle whose decay this represents may also be stored, but this is normally known via the Particle in which the decay is stored.
Bases: object
Top level container for everything in an SLHA record
Bases: exceptions.Exception
Exception object to be raised when a spectrum file/string is malformed
Bases: object
Representation of a single, specific particle, decay block from an SLHA file. These objects are not themselves called ‘Decay’, since that concept applies more naturally to the various decays found inside this object. Particle classes store the PDG ID (pid) of the particle being represented, and optionally the mass (mass) and total decay width (totalwidth) of that particle in the SLHA scenario. Masses may also be found via the MASS block, from which the Particle.mass property is filled, if at all. They also store a list of Decay objects (decays) which are probably the item of most interest.
Convert a particle ID code in the HERWIG internal IDHW format (as used by ISAWIG) into its equivalent in the standard PDG ID code definition.
Convert a particle ID code in the standard PDG ID code definition into its equivalent in the HERWIG internal IDHW format (as used by ISAWIG).
Read an SLHA or ISAWIG file (or stdin).
spcfile may either be a string filename or a file object. If a s string, the assumed file format is based from the filename; if a file it is assumed to be SLHA format.
Other keyword parameters are passed to readSLHA/readISAWIG.
Read a spectrum definition from a string in the ISAWIG format, returning dictionaries of blocks and decays. While this is not an SLHA format, it is informally supported as a useful mechanism for converting ISAWIG spectra to SLHA.
ISAWIG parsing based on the HERWIG SUSY specification format, from http://www.hep.phy.cam.ac.uk/~richardn/HERWIG/ISAWIG/file.html
If the ignorenobr parameter is True, do not store decay entries with a branching ratio of zero.
Read a spectrum definition from a file in the ISAWIG format, returning dictionaries of blocks and decays. While this is not an SLHA format, it is informally supported as a useful mechanism for converting ISAWIG spectra to SLHA.
isafile may either be a string filename or a file object.
Other keyword parameters are passed to readISAWIG.
Read an SLHA definition from a string, returning dictionaries of blocks and decays.
If the ignorenobr parameter is True, do not store decay entries with a branching ratio of zero.
If the ignorenomass parameter is True, parse file even if mass block is absent in the file (default is to raise a ParseError).
Read an SLHA file, returning dictionaries of blocks and decays.
Other keyword parameters are passed to readSLHA.
Write to an SLHA or ISAWIG file (or stdout).
spcfile may either be a string filename or a file object. If a s string, the assumed file format is based from the filename; if a file it is assumed to be SLHA format.
Other keyword parameters are passed to writeSLHA/writeISAWIG.
Return a SUSY spectrum definition in the format produced by ISAWIG for inut to HERWIG as a string, from the supplied SLHA blocks and decays dicts.
ISAWIG parsing based on the HERWIG SUSY specification format, from http://www.hep.phy.cam.ac.uk/~richardn/HERWIG/ISAWIG/file.html
If the ignorenobr parameter is True, do not write decay entries with a branching ratio of zero.
Write an ISAWIG file from the supplied blocks and decays dicts.
isafile may either be a string filename or a file object.
Other keyword parameters are passed to writeISAWIG.
Return an SLHA definition as a string, from the supplied blocks and decays dicts.
Return an SLHA definition as a string, from the supplied blocks dict.
Compute k-factors in the decoupled (squark or gluino) regime for the process. If a decoupled grid does not exist for the process, return None
Read the NLLfast grid and returns a pair of k-factors (NLO and NLL) for the pair.
Returns: | k-factors = None, if NLLfast does not contain the process; uses the slhafile to obtain the SUSY spectrum. |
---|
Return the process name (in NLLfast notation) for the pair production of pIDs.
Returns: | None, if the particle ID pair is not contained in NLLfast |
---|
Bases: object
A singleton-like class that keeps track of all external tools. Intended to make installation and deployment easier.
Bases: logging.Filter
Messages are allowed through just once. The ‘message’ includes substitutions, but is not formatted by the handler. If it were, then practically all messages would be unique! stolen from: http://code.activestate.com/recipes/412552-using-the-logging-module/
Write cross-sections to an SLHA file.
Parameters: |
|
---|
Run pythia and compute SUSY cross-sections for the input SLHA file.
Parameters: |
|
---|---|
Returns: | XSectionList object |
Execute pythia_lhe with n events, at sqrt(s)=sqrts.
Parameters: |
|
---|---|
Returns: | file object with the LHE events |
Generate a string for a XSECTION block in the SLHA format from a XSection object.
Parameters: |
|
---|