slha2isawig

Sun, 28 Apr 2013 21:13:25 +0200

author
Andy Buckley <andy@insectnation.org>
date
Sun, 28 Apr 2013 21:13:25 +0200
changeset 199
80d4b063103a
parent 73
427216d07f43
child 209
42fe24d30c22
permissions
-rwxr-xr-x

Various fixes to ISAWIG output (and conversion to use new tuple-indexing on mixing matrices and single-value accessing on ALPHA).

     1 #! /usr/bin/env python
     3 """\
     4 Usage: %prog IN.slha [OUT.isa]
     6 Convert an SLHA model/decay spectrum file to a HERWIG/ISAWIG SUSY spectrum input
     7 file, in the format written by ISAWIG. The intention of this script is to allow
     8 HERWIG to be used with spectra generated by codes other than ISAWIG,
     9 e.g. SoftSUSY, SPheno, etc. And fundamentally because the author was fed up with
    10 having to make ISASUSY compile with gfortran on platforms where CERNLIB wasn't
    11 available!
    13 Conversion based on the HERWIG SUSY specification format, from
    14 http://www.hep.phy.cam.ac.uk/~richardn/HERWIG/ISAWIG/file.html
    15 """
    17 __author__ = "Andy Buckley <andy.buckley@cern.ch"
    19 import pyslha
    20 import sys, optparse
    21 parser = optparse.OptionParser(usage=__doc__, version=pyslha.__version__)
    22 opts, args = parser.parse_args()
    23 if len(args) < 1 or len(args) > 2:
    24     parser.print_help()
    25     sys.exit(1)
    27 ## Choose output file
    28 import os
    29 o = os.path.basename(args[0])
    30 if "." in o:
    31     o = o[:o.rindex(".")]
    32 opts.OUTFILE = o + ".isa"
    33 if len(args) == 2:
    34     opts.OUTFILE = args[1]
    36 ## Read spectrum file
    37 BLOCKS, DECAYS = pyslha.readSLHAFile(args[0])
    39 ## And write it out again!
    40 if opts.OUTFILE == "-":
    41     sys.stdout.write(pyslha.writeISAWIG(opts.OUTFILE))
    42 else:
    43     pyslha.writeISAWIGFile(opts.OUTFILE, BLOCKS, DECAYS)

mercurial