コード例 #1
0
ファイル: runtests.py プロジェクト: vfabiani/eutelescope
def run(argv=sys.argv):
    from Interface import runROOT
    colors = False  #By default use ANSI colors for output
    cdash = False

    if len(argv) >= 1:
        import getopt
        try:
            opts, args = getopt.getopt(argv, "hvVg:",
                                       ["list", "colors", "cdash"])
        except getopt.GetoptError, err:
            sys.stderr.write(str(err))
            usage()
            sys.exit(2)

        sys.stderr.write("Number of arguments: %d\n" % len(args))

        doplots = "report.pdf"
        for op, ar in opts:
            if op == '-h':
                usage()
                sys.exit(0)
            elif op == '-v':
                from Interface import _logger
                _logger.setLevel('INFO')
            elif op == '-V':
                from Interface import _logger
                _logger.setLevel('DEBUG')
            elif op == '--list':
                printList()
                sys.exit(0)
            elif op == "--colors":
                colors = True
            elif op == "--cdash":
                cdash = True
            elif op == '-g':
                doplots = ar
        if len(args) >= 2:
            try:
                if len(args) >= 3:
                    errcode = runROOT(args[0],
                                      args[1],
                                      doPlots=doplots,
                                      defaultReferenceFile=args[2],
                                      useColorsForOutput=colors,
                                      doCDashOutput=cdash)
                else:
                    errcode = runROOT(args[0],
                                      args[1],
                                      doPlots=doplots,
                                      useColorsForOutput=colors,
                                      doCDashOutput=cdash)
            except Exception, e:
                sys.stderr.write("Error: %s\n" % e)
                sys.exit(1)
コード例 #2
0
def run( argv = sys.argv ):
    from Interface import runROOT
    colors = False #By default use ANSI colors for output
    cdash = False

    if len(argv)>=1:
        import getopt
        try:
            opts,args = getopt.getopt( argv ,"hvVg:",["list","colors","cdash"])
        except getopt.GetoptError,err:
            sys.stderr.write( str(err) )
            usage()
            sys.exit(2)

        sys.stderr.write( "Number of arguments: %d\n"%len(args))
            
        doplots = "report.pdf"
        for op,ar in opts:
            if op == '-h':
                usage()
                sys.exit(0)
            elif op == '-v':
                from Interface import _logger
                _logger.setLevel('INFO')
            elif op == '-V':
                from Interface import _logger
                _logger.setLevel('DEBUG')
            elif op == '--list':
                printList()
                sys.exit(0)
            elif op == "--colors":
                colors = True
            elif op == "--cdash":
                cdash = True
            elif op == '-g':
                doplots=ar
        if len(args)>=2:
            try:
                if len(args)>=3:
                    errcode = runROOT( args[0],args[1] , doPlots = doplots , defaultReferenceFile = args[2] , useColorsForOutput = colors, doCDashOutput = cdash)
                else:
                    errcode = runROOT( args[0] , args[1] ,doPlots = doplots , useColorsForOutput = colors, doCDashOutput = cdash)
            except Exception,e:
                sys.stderr.write("Error: %s\n"%e)
                sys.exit(1)
コード例 #3
0
ファイル: runtests.py プロジェクト: andreadotti/StatTest
def run( argv = sys.argv ):
    from Interface import runROOT
    colors = False #By default use ANSI colors for output
    if len(argv)>=1:
        import getopt
        try:
            opts,args = getopt.getopt( argv ,"hvVTg:H",["list","colors"])
        except getopt.GetoptError,err:
            sys.stderr.write( str(err) )
            usage()
            sys.exit(2)
            
#t        doplots = "report.pdf" 
        doplots = None
        input = "HISTOS"
        for op,ar in opts:
#            print("OP %s AR %s"%(op,ar)) 
            if op == '-h':
                usage()
                sys.exit(0)
            elif op == '-v':
                from Interface import _logger
                _logger.setLevel('INFO')
            elif op == '-V':
                from Interface import _logger
                _logger.setLevel('DEBUG')
            elif op == '--list':
                printList()
                sys.exit(0)
            elif op == "--colors":
                colors = True
            elif op == '-g':
                doplots=ar
            elif op == '-T':
                input = "TEXT"
            elif op == '-H':
                input = "HISTOS"
        if len(args)>=2:
            inputfile=args[1]
            if '*' in args[1]:
                print 'Merging multiple input files'
                from glob import glob
                files=glob(args[1])
                import subprocess
                import tempfile
                (fd,filename)=tempfile.mkstemp('.root')
                subprocess.call(['hadd','-f',filename,]+files)
                inputfile=filename
            try:
                if len(args)>=3:
                    if input == "TEXT" :
                        errcode = runROOT( args[0] ,inputfile , doPlots = None , doText = True , doHistos = False , doUnBinned = False , defaultReferenceFile = args[2] ) 
                    else :
                        errcode = runROOT( args[0], inputfile , doPlots = doplots , doText = False , defaultReferenceFile = args[2] , useColorsForOutput = colors)
                else:
                    if input == "TEXT" :
                        sys.stderr.write("Error: NO REFERENCE FILE %s\n")
                        sys.exit(1)
                    else:
                        errcode = runROOT( args[0] , inputfile , doPlots = doplots , useColorsForOutput = colors)
            except Exception,e:
                sys.stderr.write("Error: %s\n"%e)
                sys.exit(1)