예제 #1
0
def xsecToBlock(xsec, inPDGs=(2212, 2212), comment=None, xsecUnit=pb):
    """
    Generate a string for a XSECTION block in the SLHA format from a XSection
    object.

    :param inPDGs: defines the PDGs of the incoming states
                   (default = 2212,2212)

    :param comment: is added at the end of the header as a comment
    :param xsecUnit: unit of cross sections to be written (default is pb). Must be a Unum unit.

    """
    if type(xsec) != type(crossSection.XSection()):
        logger.error("Wrong input")
        raise SModelSError()
    # Sqrt(s) in GeV
    header = "XSECTION  " + str(xsec.info.sqrts / GeV)
    for pdg in inPDGs:
        # PDGs of incoming states
        header += " " + str(pdg)
    # Number of outgoing states
    header += " " + str(len(xsec.pid))
    for pid in xsec.pid:
        # PDGs of outgoing states
        header += " " + str(pid)
    if comment:
        header += "   # " + str(comment)  # Comment
    entry = "  0  " + str(xsec.info.order) + "  0  0  0  0  " + \
            str("%16.8E" % (xsec.value / xsecUnit) ) + " SModelS " + installation.version()

    return "\n" + header + "\n" + entry
예제 #2
0
def xsecToBlock(xsec, inPDGs=(2212, 2212), comment=None, xsecUnit = pb):
    """
    Generate a string for a XSECTION block in the SLHA format from a XSection
    object.

    :param inPDGs: defines the PDGs of the incoming states
                   (default = 2212,2212)

    :param comment: is added at the end of the header as a comment
    :param xsecUnit: unit of cross-sections to be written (default is pb). Must be a Unum unit.

    """
    if type(xsec) != type(crossSection.XSection()):
        logger.error("Wrong input")
        import sys
        sys.exit()
    # Sqrt(s) in GeV
    header = "XSECTION  " + str(xsec.info.sqrts / GeV)
    for pdg in inPDGs:
        # PDGs of incoming states
        header += " " + str(pdg)
    # Number of outgoing states
    header += " " + str(len(xsec.pid))
    for pid in xsec.pid:
        # PDGs of outgoing states
        header += " " + str(pid)
    if comment:
        header += "   # " + str(comment)  # Comment
    entry = "0  " + str(xsec.info.order) + "  0  0  0  0  " + \
            str("%16.8E" % (xsec.value / xsecUnit) ) + " SModelS " + installation.version()

    return "\n" + header + "\n" + entry
예제 #3
0
def main():
    import argparse
    """ Set default input and output files """
    parameterFile = "%s/smodels/etc/parameters_default.ini" % installDirectory()
    outputDir = "./results/"

    """ Get the name of input SLHA file and parameter file """
    ap = argparse.ArgumentParser( description=
            "Run SModelS over SLHA/LHE input files." )
    ap.add_argument('-f', '--filename',
            help='name of SLHA or LHE input file or a directory path (required argument). '
            'If a directory is given, loop over all files in the directory', required=True)
    ap.add_argument('-p', '--parameterFile',
            help='name of parameter file, where most options are defined (optional argument). If not set, use '
            'all parameters from smodels/etc/parameters_default.ini',
            default=parameterFile)
    ap.add_argument('-o', '--outputDir',
            help='name of output directory (optional argument). The default folder is: ' +
            outputDir, default=outputDir)
    ap.add_argument('-d', '--development', help='if set, SModelS will run in development mode and exit if any errors are found.',
            action='store_true')
    ap.add_argument('-t', '--force_txt', help='force loading the text database',
            action='store_true')
    ap.add_argument('-C', '--colors', help='colored output',
            action='store_true')
    ap.add_argument('-V', '--version', action='version', version = version() )
    ap.add_argument('-c', '--run-crashreport',
            help='parse crash report file and use its contents for a SModelS run. '
                 "Supply the crash file simply via '--filename myfile.crash'",
            action='store_true')
    ap.add_argument('-v','--verbose', help='sets the verbosity level (debug, info, warning, error). Default value is info.',
            default = "info", type = str )
    ap.add_argument('-T', '--timeout',
            help='define a limit on the running time (in secs).'
                 'If not set, run without a time limit. If a directory is given as input, '
                 'the timeout will be  applied for each individual file.',
            default = 0, type = int)


    args = ap.parse_args()
    if args.colors:
        from smodels.tools.colors import colors
        colors.on = True


    db=None
    if args.force_txt: db=True
    smodelsLogging.setLogLevel ( args.verbose )

    if args.run_crashreport:
        args.filename, args.parameterFile = crashReport.readCrashReportFile(
                args.filename)
        run(args.filename, args.parameterFile, args.outputDir,
               db, args.timeout, development=True )

    else:
        run(args.filename, args.parameterFile, args.outputDir,
              db, args.timeout, args.development)
예제 #4
0
def formatSLHAInput(maxcond, minmassgap, sigmacut, databaseversion, docompress):
    try:
        smodelsversion = version()
        if not smodelsversion.startswith("v"): smodelsversion = "v" + smodelsversion
    except:
	    smodelsversion = "unknown"

    output = "BLOCK SModelS_Settings\n"
    output += " 0 %-20s #SModelS version\n" %(smodelsversion)
    output += " 1 %-20s #database version\n" %(databaseversion)
    output += " 2 %-20s #maximum condition violation\n" % (maxcond)
    output += " 3 %-20s #compression (0 off, 1 on)\n" % (docompress)
    output += " 3 %-20s #minimum mass gap for mass compression [GeV]\n" % (minmassgap/GeV)
    output += " 4 %-20s #sigmacut [fb]\n\n" % (sigmacut/fb)
    return output
예제 #5
0
def formatSLHAInput(maxcond, minmassgap, sigmacut, databaseversion,
                    docompress):
    try:
        smodelsversion = version()
        if not smodelsversion.startswith("v"):
            smodelsversion = "v" + smodelsversion
    except:
        smodelsversion = "unknown"

    output = "BLOCK SModelS_Settings\n"
    output += " 0 %-20s #SModelS version\n" % (smodelsversion)
    output += " 1 %-20s #database version\n" % (databaseversion)
    output += " 2 %-20s #maximum condition violation\n" % (maxcond)
    output += " 3 %-20s #compression (0 off, 1 on)\n" % (docompress)
    output += " 3 %-20s #minimum mass gap for mass compression [GeV]\n" % (
        minmassgap / GeV)
    output += " 4 %-20s #sigmacut [fb]\n\n" % (sigmacut / fb)
    return output
예제 #6
0
        if i in [
                "build", "build_ext", "build_clib", "install", "install_lib",
                "bdist", "bdist_rpm", "bdist_dumb", "bdist_wininst",
                "bdist_wheel", "develop"
        ]:
            needs_build = True
    if not needs_build:
        return
    import subprocess
    subprocess.call(["make", "-C", "lib"])


compile()
setup(
    name = "smodels",
    version = version(),
    author = authors(),
    author_email="[email protected] ",
    scripts=[ "smodels-config", "runSModelS.py", "smodelsTools.py" ],
    install_requires=[ 'docutils>=0.3', 'numpy', 'scipy>=0.9.0', \
                         'unum', 'argparse', 'pyslha>=3.1.0' ],
    data_files=dataFiles() ,
    description=("A tool for interpreting simplified-model results from the "
                   "LHC"),
    license="GPLv3",
    # use_2to3 = True,
    keywords=("simplified models LHC BSM theories interpretation "
                "supersymmetry UEDs"),
    url="http://smodels.hephy.at/",
    packages=['smodels',
              'smodels.theory',
예제 #7
0
def main():
    import argparse
    parser = argparse.ArgumentParser(description="SModelS-tools command line tool.")

    parser.add_argument('-v','--verbose', help='verbosity level. '
                        'accepted values are: debug, info, warning, error.',
                                    default = "info", type = str )

    subparsers = parser.add_subparsers(dest='subparser_name')

    installation = subparsers.add_parser('installation', description="Print installation setup and exit.")
    fixpermissions = subparsers.add_parser('fixpermissions', description="Fix file permissions for xseccomputer.")
    xseccomputer = subparsers.add_parser('xseccomputer', description="Compute MSSM cross sections for a SLHA file.")
    xseccomputer.add_argument('-s', '--sqrts', nargs='+', action='append',
        help="sqrt(s) TeV. Can supply more than one value (as a space separated list). Default is both 8 and 13.",
        type=int, default=[])
    xseccomputer.add_argument('-e', '--nevents', type=int, default=10000,
        help="number of events to be simulated.")
    xseccomputer.add_argument('-v', '--verbosity', type=str, default="info",
        help="Verbosity (debug, info, warning, error)")
    xseccomputer.add_argument('-c', '--ncpus', type=int, default=-1,
        help="number of cores to be used simultaneously. -1 means 'all'. ")
    xseccomputer.add_argument('-p', '--tofile', action='store_true',
        help="write cross sections to file (only highest order)")
    xseccomputer.add_argument('-P', '--alltofile', action='store_true',
        help="write all cross sections to file, including lower orders")
    xseccomputer.add_argument('-q', '--query', action='store_true',
        help="only query if there are cross sections in the file")
    xseccomputer.add_argument('-C', '--colors', action='store_true',
        help="colored terminal output" )
    xseccomputer.add_argument('-k', '--keep', action='store_true',
        help="do not unlink temporary directory")
    xseccomputer.add_argument('-6', '--pythia6', action='store_true',
        help="use pythia6 for LO cross sections")
    xseccomputer.add_argument('-8', '--pythia8', action='store_true',
        help="use pythia8 for LO cross sections (default)")
    xseccomputer.add_argument('-n', '--NLO', action='store_true',
        help="compute at the NLO level (default is LO)")
    xseccomputer.add_argument('-N', '--NLL', help="compute at the NLO+NLL level (takes precedence over NLO, default is LO)", action='store_true')
    xseccomputer.add_argument('-O', '--LOfromSLHA', help="use LO cross sections from file to compute the NLO or NLL cross sections", action='store_true')
    xseccomputer.add_argument('-f', '--filename', required=True,
            help="SLHA file to compute cross sections for. "
            "If a directory is given, compute cross sections for all files in directory." )

    slhachecker = subparsers.add_parser('slhachecker', description="Perform several checks on a SLHA file.")
    slhachecker.add_argument('-xS', '--xsec', help='turn off the check for xsection blocks', action='store_false')
    slhachecker.add_argument('-s', '--sigmacut', help='give sigmacut in fb', default=.03, type=float)
    slhachecker.add_argument('-illegal', '--illegal', help='turn on check for kinematically forbidden decays', action='store_true')
    slhachecker.add_argument('-dB', '--decayBlocks', help='turn off the check for missing decay blocks', action='store_false')
    slhachecker.add_argument('-f', '--filename', help='name of input SLHA file', required=True)

    lhechecker = subparsers.add_parser('lhechecker', description="Check if the input file has LHE format.")
    lhechecker.add_argument('-f', '--filename', help='name of input LHE file', required=True)

    dbBrowser = subparsers.add_parser('database-browser', description="Interface for browsing the Database.")
    dbBrowser.add_argument('-p', '--path_to_database', help='path to SModelS database', required=True)
    dbBrowser.add_argument('-t', '--text', help='load text database, dont even search for binary database file', action='store_true')
    
    iPlots = subparsers.add_parser('interactive-plots', description="Produces a set of interactive plots for visualizing results from a scan.")
    iPlots.add_argument('-p', '--parameters', help='path to the parameters file [./iplots_parameters.py]', default = './iplots_parameters.py')
    iPlots.add_argument('-f', '--smodelsFolder', help='path to the smodels folder with the SModelS python output files.', 
                            required=True)
    iPlots.add_argument('-s', '--slhaFolder', help='path to the SLHA folder with the SLHA input files.', 
                            required=True)
    iPlots.add_argument('-o', '--outputFolder', 
                  help='path to the output folder, where the plots will be stored. [./iplots]', 
                  default = "./iplots" )
    
    iPlots.add_argument('-N', '--npoints', type=int, default=-1,
        help="How many (randomly selected) points will be included in the plot. If -1 all points will be read and included (default = -1).")
    
    iPlots.add_argument('-v', '--verbosity', type=str, default="info",
        help="Verbosity (debug, info, warning, error)")


    toolbox = subparsers.add_parser( 'toolbox', description=
								                     "Facility to control external dependencies")
    toolbox.add_argument('-c', '--colors', help='turn on terminal colors',
                           action='store_true')
    toolbox.add_argument('-l', '--long', help='long output lines',
                           action='store_true')
    toolbox.add_argument('-m', '--make', help='compile packages if needed',
                           action='store_true')
    args = parser.parse_args()

    from smodels.tools import smodelsLogging
    smodelsLogging.setLogLevel(args.verbose)

    if args.subparser_name == 'fixpermissions':
        from smodels import installation
        installation.fixpermissions()

    if args.subparser_name == 'installation':
        from smodels import installation
        import sys, os
        print ( installation.banner() )
        print ( "SModelS version:", installation.version() )
        print ( "Installation directory:",installation.installDirectory() )
        path = os.path.abspath(os.path.realpath(__file__))
        print ( "This binary:",path )
        sys.exit()
    if args.subparser_name == 'toolbox':
        from smodels.tools import toolBox
        toolBox.main ( args )
    if args.subparser_name == 'xseccomputer':
        from smodels.tools import xsecComputer
        xsecComputer.main(args)
    if args.subparser_name == 'slhachecker':
        from smodels.tools import slhaChecks
        slhaChecks.main(args)
    if args.subparser_name == 'lhechecker':
        from smodels.tools import lheChecks
        lheChecks.main(args)
    if args.subparser_name == 'database-browser':
        from smodels.tools import databaseBrowser
        databaseBrowser.main(args)
    if args.subparser_name == 'interactive-plots':
        from smodels.tools import interactivePlots
        interactivePlots.main(args)
예제 #8
0
def main():
    import argparse
    """ Set default input and output files """
    parameterFile = "%s/smodels/etc/parameters_default.ini" % installDirectory(
    )
    outputDir = "./results/"
    """ Get the name of input SLHA file and parameter file """
    ap = argparse.ArgumentParser(
        description="Run SModelS over SLHA/LHE input files.")
    ap.add_argument(
        '-f',
        '--filename',
        help=
        'name of SLHA or LHE input file or a directory path (required argument). '
        'If a directory is given, loop over all files in the directory',
        required=True)
    ap.add_argument(
        '-p',
        '--parameterFile',
        help=
        'name of parameter file, where most options are defined (optional argument). If not set, use '
        'all parameters from smodels/etc/parameters_default.ini',
        default=parameterFile)
    ap.add_argument(
        '-o',
        '--outputDir',
        help=
        'name of output directory (optional argument). The default folder is: '
        + outputDir,
        default=outputDir)
    ap.add_argument(
        '-d',
        '--development',
        help=
        'if set, SModelS will run in development mode and exit if any errors are found.',
        action='store_true')
    ap.add_argument('-t',
                    '--force_txt',
                    help='force loading the text database',
                    action='store_true')
    ap.add_argument('-C',
                    '--colors',
                    help='colored output',
                    action='store_true')
    ap.add_argument('-V', '--version', action='version', version=version())
    ap.add_argument(
        '-c',
        '--run-crashreport',
        help='parse crash report file and use its contents for a SModelS run. '
        "Supply the crash file simply via '--filename myfile.crash'",
        action='store_true')
    ap.add_argument(
        '-v',
        '--verbose',
        help=
        'sets the verbosity level (debug, info, warning, error). Default value is info.',
        default="info",
        type=str)
    ap.add_argument(
        '-T',
        '--timeout',
        help='define a limit on the running time (in secs).'
        'If not set, run without a time limit. If a directory is given as input, '
        'the timeout will be  applied for each individual file.',
        default=0,
        type=int)

    args = ap.parse_args()
    if args.colors:
        from smodels.tools.colors import colors
        colors.on = True

    db = None
    if args.force_txt: db = True
    smodelsLogging.setLogLevel(args.verbose)

    if args.run_crashreport:
        args.filename, args.parameterFile = crashReport.readCrashReportFile(
            args.filename)
        run(args.filename,
            args.parameterFile,
            args.outputDir,
            db,
            args.timeout,
            development=True)

    else:
        run(args.filename, args.parameterFile, args.outputDir, db,
            args.timeout, args.development)
예제 #9
0
def main():
    parser = argparse.ArgumentParser(
        description="SModelS-tools command line tool.")

    parser.add_argument('-particles',
                        '--particlePath',
                        help='path to directory where particles.py is located',
                        default=installDirectory() + "/smodels")
    parser.add_argument('-v',
                        '--verbose',
                        help='verbosity level. '
                        'accepted values are: debug, info, warning, error.',
                        default="info",
                        type=str)

    subparsers = parser.add_subparsers(dest='subparser_name')

    installation = subparsers.add_parser(
        'installation', description="Print installation setup and exit.")
    xseccomputer = subparsers.add_parser(
        'xseccomputer',
        description="Compute MSSM cross sections for a SLHA file.")
    xseccomputer.add_argument(
        '-s',
        '--sqrts',
        nargs='+',
        action='append',
        help=
        "sqrt(s) TeV. Can supply more than one value. Default is both 8 and 13.",
        type=int,
        default=[])
    xseccomputer.add_argument('-e',
                              '--nevents',
                              type=int,
                              default=10000,
                              help="number of events to be simulated.")
    xseccomputer.add_argument('-v',
                              '--verbosity',
                              type=str,
                              default="info",
                              help="Verbosity (debug, info, warning, error)")
    xseccomputer.add_argument(
        '-c',
        '--ncpus',
        type=int,
        default=-1,
        help="number of cores to be used simultaneously. -1 means 'all'. ")
    xseccomputer.add_argument('-p',
                              '--tofile',
                              action='store_true',
                              help="write cross sections to file")
    xseccomputer.add_argument(
        '-q',
        '--query',
        action='store_true',
        help="only query if there are cross sections in the file")
    xseccomputer.add_argument('-k',
                              '--keep',
                              action='store_true',
                              help="do not unlink temporary directory")
    xseccomputer.add_argument('-n',
                              '--NLO',
                              action='store_true',
                              help="compute at the NLO level (default is LO)")
    xseccomputer.add_argument(
        '-N',
        '--NLL',
        help=
        "compute at the NLO+NLL level (takes precedence over NLO, default is LO)",
        action='store_true')
    xseccomputer.add_argument(
        '-O',
        '--LOfromSLHA',
        help=
        "use LO cross sections from file to compute the NLO or NLL cross sections",
        action='store_true')
    xseccomputer.add_argument(
        '-f',
        '--filename',
        required=True,
        help="SLHA file to compute cross sections for. "
        "If a directory is given, compute cross sections for all files in directory."
    )

    slhachecker = subparsers.add_parser(
        'slhachecker', description="Perform several checks on a SLHA file.")
    slhachecker.add_argument('-xS',
                             '--xsec',
                             help='turn off the check for xsection blocks',
                             action='store_false')
    slhachecker.add_argument('-lsp',
                             '--lsp',
                             help='turn off the check for charged lsp',
                             action='store_false')
    slhachecker.add_argument(
        '-longlived',
        '--longlived',
        help=
        'turn off the check for stable charged particles and visible displaced vertices',
        action='store_false')
    slhachecker.add_argument(
        '-m',
        '--displacement',
        help='give maximum displacement of secondary vertex in m',
        default=.001,
        type=float)
    slhachecker.add_argument('-s',
                             '--sigmacut',
                             help='give sigmacut in fb',
                             default=.03,
                             type=float)
    slhachecker.add_argument(
        '-illegal',
        '--illegal',
        help='turn on check for kinematically forbidden decays',
        action='store_true')
    slhachecker.add_argument(
        '-dB',
        '--decayBlocks',
        help='turn off the check for missing decay blocks',
        action='store_false')
    slhachecker.add_argument('-f',
                             '--filename',
                             help='name of input SLHA file',
                             required=True)

    lhechecker = subparsers.add_parser(
        'lhechecker', description="Check if the input file has LHE format.")
    lhechecker.add_argument('-f',
                            '--filename',
                            help='name of input LHE file',
                            required=True)

    dbBrowser = subparsers.add_parser(
        'database-browser', description="Interface for browsing the Database.")
    dbBrowser.add_argument('-p',
                           '--path_to_database',
                           help='path to SModelS database',
                           required=True)
    dbBrowser.add_argument(
        '-t',
        '--text',
        help='load text database, dont even search for binary database file',
        action='store_true')

    args = parser.parse_args()
    """
    check if particles.py exists in specified path, and add to sys.path
    """
    if not os.path.isfile(os.path.join(args.particlePath, "particles.py")):
        log.error("particle.py not found in %s" % args.particlePath)
        return
    else:
        sys.path.insert(1, args.particlePath)
        from smodels.tools import xsecComputer
        from smodels.tools import slhaChecks, lheChecks

    smodelsLogging.setLogLevel(args.verbose)

    if args.subparser_name == 'installation':
        from smodels import installation
        print(installation.banner())
        print("SModelS version:", installation.version())
        print("Installation directory:", installation.installDirectory())
        path = os.path.abspath(os.path.realpath(__file__))
        print("This binary:", path)
        sys.exit()

    if args.subparser_name == 'xseccomputer':
        xsecComputer.main(args)
    if args.subparser_name == 'slhachecker':
        slhaChecks.main(args)
    if args.subparser_name == 'lhechecker':
        lheChecks.main(args)
    if args.subparser_name == 'database-browser':
        databaseBrowser.main(args)
예제 #10
0
def main():
    import argparse
    parser = argparse.ArgumentParser(
        description="SModelS-tools command line tool.")

    parser.add_argument('-v',
                        '--verbose',
                        help='verbosity level. '
                        'accepted values are: debug, info, warning, error.',
                        default="info",
                        type=str)

    subparsers = parser.add_subparsers(dest='subparser_name')

    subparsers.add_parser('installation',
                          description="Print installation setup and exit.")
    subparsers.add_parser('fixpermissions',
                          description="Fix file permissions for xseccomputer.")
    xseccomputer = subparsers.add_parser(
        'xseccomputer',
        description="Compute MSSM cross sections for a SLHA file.")
    xseccomputer.add_argument(
        '-s',
        '--sqrts',
        nargs='+',
        action='append',
        help=
        "sqrt(s) TeV. Can supply more than one value (as a space separated list). Default is both 8 and 13.",
        type=int,
        default=[])
    xseccomputer.add_argument('-e',
                              '--nevents',
                              type=int,
                              default=10000,
                              help="number of events to be simulated [10000].")
    xseccomputer.add_argument('-v',
                              '--verbosity',
                              type=str,
                              default="info",
                              help="Verbosity (debug, info, warning, error)")
    xseccomputer.add_argument(
        '-c',
        '--ncpus',
        type=int,
        default=-1,
        help="number of cores to be used simultaneously. -1 means 'all'. ")
    xseccomputer.add_argument(
        '-p',
        '--tofile',
        action='store_true',
        help="write cross sections to file (only highest order)")
    xseccomputer.add_argument(
        '-P',
        '--alltofile',
        action='store_true',
        help="write all cross sections to file, including lower orders")
    xseccomputer.add_argument(
        '-q',
        '--query',
        action='store_true',
        help="only query if there are cross sections in the file")
    xseccomputer.add_argument('-C',
                              '--colors',
                              action='store_true',
                              help="colored terminal output")
    xseccomputer.add_argument('--noautocompile',
                              action='store_true',
                              help="turn off automatic compilation")
    xseccomputer.add_argument('-k',
                              '--keep',
                              action='store_true',
                              help="do not unlink temporary directory")
    xseccomputer.add_argument('-6',
                              '--pythia6',
                              action='store_true',
                              help="use pythia6 for LO cross sections")
    xseccomputer.add_argument(
        '-8',
        '--pythia8',
        action='store_true',
        help="use pythia8 for LO cross sections (default)")
    xseccomputer.add_argument('-n',
                              '--NLO',
                              action='store_true',
                              help="compute at the NLO level (default is LO)")
    xseccomputer.add_argument(
        '-N',
        '--NLL',
        help=
        "compute at the NLO+NLL level (takes precedence over NLO, default is LO)",
        action='store_true')
    xseccomputer.add_argument(
        '-O',
        '--LOfromSLHA',
        help=
        "use LO cross sections from file to compute the NLO or NLL cross sections",
        action='store_true')
    xseccomputer.add_argument(
        '-S',
        '--ssmultipliers',
        type=str,
        default=None,
        help="Signal strength multipliers, provided as dictionary of pids")
    xseccomputer.add_argument(
        '-f',
        '--filename',
        required=True,
        help="SLHA file to compute cross sections for. "
        "If a directory is given, compute cross sections for all files in directory."
    )

    slhachecker = subparsers.add_parser(
        'slhachecker', description="Perform several checks on a SLHA file.")
    slhachecker.add_argument('-xS',
                             '--xsec',
                             help='turn off the check for xsection blocks',
                             action='store_false')
    slhachecker.add_argument(
        '-illegal',
        '--illegal',
        help='turn on check for kinematically forbidden decays',
        action='store_true')
    slhachecker.add_argument(
        '-dB',
        '--decayBlocks',
        help='turn off the check for missing decay blocks',
        action='store_false')
    slhachecker.add_argument('-f',
                             '--filename',
                             help='name of input SLHA file',
                             required=True)

    lhechecker = subparsers.add_parser(
        'lhechecker', description="Check if the input file has LHE format.")
    lhechecker.add_argument('-f',
                            '--filename',
                            help='name of input LHE file',
                            required=True)

    dbBrowser = subparsers.add_parser(
        'database-browser', description="Interface for browsing the Database.")
    dbBrowser.add_argument('-p',
                           '--path_to_database',
                           help='path to SModelS database',
                           required=True)
    dbBrowser.add_argument(
        '-t',
        '--text',
        help='load text database, dont even search for binary database file',
        action='store_true')

    iPlots = subparsers.add_parser(
        'interactive-plots',
        description=
        "Produces a set of interactive plots for visualizing results from a scan."
    )
    iPlots.add_argument(
        '-p',
        '--parameters',
        help='path to the parameters file [./iplots_parameters.py]',
        default='./iplots_parameters.py')
    iPlots.add_argument(
        '-f',
        '--smodelsFolder',
        help='path to the smodels folder with the SModelS python output files.',
        required=True)
    iPlots.add_argument(
        '-s',
        '--slhaFolder',
        help='path to the SLHA folder with the SLHA input files.',
        required=True)
    iPlots.add_argument(
        '-o',
        '--outputFolder',
        help=
        'path to the output folder, where the plots will be stored. [./iplots]',
        default="./iplots")

    iPlots.add_argument(
        '-N',
        '--npoints',
        type=int,
        default=-1,
        help=
        "How many (randomly selected) points will be included in the plot. If -1 all points will be read and included (default = -1)."
    )

    iPlots.add_argument('-v',
                        '--verbosity',
                        type=str,
                        default="info",
                        help="Verbosity (debug, info, warning, error)")

    proxydb = subparsers.add_parser(
        'proxydb', description="create proxy databases for network use")
    proxydb.add_argument('-i',
                         '--inputfile',
                         help='input database file [db31.pcl]',
                         type=str,
                         default="db31.pcl")
    proxydb.add_argument('-s',
                         '--servername',
                         help='the server name [None]',
                         type=str,
                         default=None)
    proxydb.add_argument('-v',
                         '--verbose',
                         help='verbosity, for server and client [info]',
                         type=str,
                         default="info")
    proxydb.add_argument('-R',
                         '--rundir',
                         help='the rundir [./]',
                         type=str,
                         default="./")
    proxydb.add_argument('-p',
                         '--serverport',
                         help='the server port [31770]',
                         type=int,
                         default=None)
    proxydb.add_argument('-l',
                         '--symlink',
                         help='set a symlink from outputfile to default.pcl',
                         action='store_true')
    proxydb.add_argument('-o',
                         '--outputfile',
                         help='input database file [proxy31.pcl]',
                         type=str,
                         default="proxy31.pcl")
    proxydb.add_argument('-r',
                         '--run',
                         help='start the server upon creation',
                         action='store_true')

    toolbox = subparsers.add_parser(
        'toolbox', description="Facility to control external dependencies")
    toolbox.add_argument('-c',
                         '--colors',
                         help='turn on terminal colors',
                         action='store_true')
    toolbox.add_argument('-l',
                         '--long',
                         help='long output lines',
                         action='store_true')
    toolbox.add_argument('-m',
                         '--make',
                         help='compile packages if needed',
                         action='store_true')
    args = parser.parse_args()

    from smodels.tools import smodelsLogging
    smodelsLogging.setLogLevel(args.verbose)

    from smodels import installation
    if args.subparser_name == 'fixpermissions':
        installation.fixpermissions()

    if args.subparser_name == 'installation':
        import sys, os
        print(installation.banner())
        print("SModelS version:", installation.version())
        print("Installation directory:", installation.installDirectory())
        path = os.path.abspath(os.path.realpath(__file__))
        print("This binary:", path)
        sys.exit()
    if args.subparser_name == 'toolbox':
        from smodels.tools import toolBox
        toolBox.main(args)
    if args.subparser_name == 'proxydb':
        from smodels.tools import proxyDBCreator
        proxyDBCreator.main(args)
    if args.subparser_name == 'xseccomputer':
        from smodels.tools import xsecComputer
        xsecComputer.main(args)
    if args.subparser_name == 'slhachecker':
        from smodels.tools import slhaChecks
        slhaChecks.main(args)
    if args.subparser_name == 'lhechecker':
        from smodels.tools import lheChecks
        lheChecks.main(args)
    if args.subparser_name == 'database-browser':
        from smodels.tools import databaseBrowser
        databaseBrowser.main(args)
    if args.subparser_name == 'interactive-plots':
        from smodels.tools import interactivePlots
        interactivePlots.main(args)
예제 #11
0
#!/usr/bin/env python3

"""
.. module:: databaseLoader
   :synopsis: When running the complete test suite, we need to
              load the database only once

.. moduleauthor:: Wolfgang Waltenberger <*****@*****.**>

"""

import sys
sys.path.insert(0,"../")
from smodels.experiment.databaseObj import Database
from smodels.installation import version
ver = "".join ( map ( str, version(True)[:3] ) ) 
#dbname="./database/db%d0.pcl" % int ( sys.version[0] )
dbname="http://smodels.hephy.at/database/unittest%s" % ver
database = Database(dbname, discard_zeroes = False)

if __name__ == "__main__":
    print ( database )
예제 #12
0
파일: setup.py 프로젝트: SModelS/smodels
        return
    needs_build = False
    for i in sys.argv[1:]:
        if i in [ "build", "build_ext", "build_clib", "install", 
                  "install_lib", "bdist", "bdist_rpm", "bdist_dumb", 
                  "bdist_wininst", "bdist_wheel", "develop"]:
            needs_build = True
    if not needs_build:
        return
    subprocess.call(["make", "-C", "smodels/lib" ])

# compile() ## not needed anymore as we perform compilation-on-demand now

setup(
    name = "smodels",
    version = version(),
    author = authors(),
    author_email="[email protected] ",
    entry_points = {
            'console_scripts': ['smodels-config=smodels.installation:main',
                           'runSModelS.py=smodels.tools.runSModelS:main',
                           'smodelsTools.py=smodels.tools.smodelsTools:main' ]
    },
    install_requires=requirements(),
    data_files=dataFiles() ,
    description=("A tool for interpreting simplified-model results from the "
                   "LHC"),
    cmdclass={'install': OverrideInstall},
    license="GPLv3",
    # use_2to3 = True,
    keywords=("simplified models LHC BSM theories interpretation "
예제 #13
0
#!/usr/bin/env python3
"""
.. module:: databaseLoader
   :synopsis: When running the complete test suite, we need to
              load the database only once

.. moduleauthor:: Wolfgang Waltenberger <*****@*****.**>

"""

import sys
sys.path.insert(0, "../")
from smodels.experiment.databaseObj import Database
from smodels.installation import version
ver = "".join(map(str, version(True)[:3]))
#dbname="./database/db%d0.pcl" % int ( sys.version[0] )
dbname = "http://smodels.hephy.at/database/unittest%s" % ver
database = Database(dbname, discard_zeroes=False)

if __name__ == "__main__":
    print(database)
예제 #14
0
     '--outputDir',
     help=
     'name of output directory (optional argument). The default folder is: '
     + outputDir,
     default=outputDir)
 ap.add_argument(
     '-d',
     '--development',
     help=
     'if set, SModelS will run in development mode and exit if any errors are found.',
     action='store_true')
 ap.add_argument('-t',
                 '--force_txt',
                 help='force loading the text database',
                 action='store_true')
 ap.add_argument('-V', '--version', action='version', version=version())
 ap.add_argument(
     '-c',
     '--run-crashreport',
     help='parse crash report file and use its contents for a SModelS run. '
     "Supply the crash file simply via '--filename myfile.crash'",
     action='store_true')
 ap.add_argument(
     '-v',
     '--verbose',
     help=
     'sets the verbosity level (debug, info, warning, error). Default value is info.',
     default="info",
     type=str)
 ap.add_argument(
     '-T',
예제 #15
0
    def __init__(self,
                 base=None,
                 force_load=None,
                 discard_zeroes=True,
                 progressbar=False,
                 subpickle=True):
        """
        :param base: path to the database, or pickle file (string), or http
                     address. If None, "official", or "official_fastlim",
                     use the official database for your code version
                     (including fastlim results, if specified).
                     If "latest", or "latest_fastlim", check for the latest database.
        :param force_load: force loading the text database ("txt"),
                           or binary database ("pcl"), dont force anything if None
        :param discard_zeroes: discard txnames with only zeroes as entries.
        :param progressbar: show a progressbar when building pickle file
                            (needs the python-progressbar module)
        :param subpickle: produce small pickle files per exp result.
                          Should only be used when working on the database.
        """

        self.url = base
        self.source = ""
        if force_load == None and base.endswith(".pcl"):
            force_load = "pcl"
        self.force_load = force_load
        self.subpickle = subpickle
        obase = base  ## keep old name for more checks for 'latest'
        if base in [None, "official"]:
            from smodels.installation import officialDatabase
            base = officialDatabase()
        if base in ["official_fastlim"]:
            from smodels.installation import officialDatabase
            base = officialDatabase(fastlim=True)
        if base in ["latest"]:
            from smodels.installation import latestDatabase
            base = latestDatabase()
        if base in ["latest_fastlim"]:
            from smodels.installation import latestDatabase
            base = latestDatabase(fastlim=True)
        if base in ["unittest"]:
            from smodels.installation import testDatabase
            base = testDatabase()
        base, pclfile = self.checkPathName(base, discard_zeroes)
        self.pcl_meta = Meta(pclfile)
        self.expResultList = []
        self.txt_meta = self.pcl_meta
        if not self.force_load == "pcl":
            self.txt_meta = Meta(base, discard_zeroes=discard_zeroes)
        self.progressbar = None
        if progressbar:
            try:
                import progressbar as P
                self.progressbar = P.ProgressBar(widgets=[
                    "Building Database ",
                    P.Percentage(),
                    P.Bar(marker=P.RotatingMarker()),
                    P.ETA()
                ])
            except ImportError as e:
                logger.warning(
                    "progressbar requested, but python-progressbar is not installed."
                )

        if self.force_load == "txt":
            self._setParticles()
            self.loadTextDatabase()
            self.txt_meta.printFastlimBanner()
            return
        if self.force_load == "pcl":
            self.loadBinaryFile()
            self._setParticles()
            self.pcl_meta.printFastlimBanner()
            if "latest" in obase:
                from smodels import installation
                codeVersion = installation.version()
                pclVersion = self.pcl_meta.databaseVersion
                if codeVersion[0] != pclVersion[0]:
                    logger.error(
                        "major versions of code and database differ! code=%s, database=%s"
                        % (codeVersion[0], pclVersion[0]))
            return
        if self.force_load in [None, "none", "None"]:
            self.loadDatabase()
            self._setParticles()
            self.txt_meta.printFastlimBanner()
            return
        logger.error( "when initialising database: force_load=%s is not " \
                       "recognized. Valid values are: pcl, txt, None." % force_load )
        raise SModelSError()