parser = argparse.ArgumentParser( formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('source') parser.add_argument('dest') parser.add_argument('--replacechans', action=IntListAction, default=[], help='Links to control' + dftstr) parser.add_argument('--master', default=0, type=int, help='Master link' + dftstr) parser.add_argument('--offset', default=0, type=int, help='Datavalid offset' + dftstr) args = parser.parse_args() return args # logging initialization initLogging(logging.DEBUG) args = parseArgs() input_data = BoardDataFactory.generate(args.source) outdata = overrideDataValidPattern(input_data, args.replacechans, args.master) BoardDataFactory.saveToFile(outdata, args.dest)
'--sddrive', default='/dev/sde', dest='usd', help='Drive for microsd slot, e.g. /dev/sdd') opts, args = parser.parse_args() if len(args) != 1: parser.error('Missing board name') opts.board = args[0] return opts, args # logging initialization import mp7.tools.helpers as hlp initLogging(logging.DEBUG) opts, args = parseOptions() # print('verbose',args.verbose, 'loglevel',args.loglevel) # logging initialization initLogging("ERROR") # Ads hlp.logo() pldfound = False yes = set(['yes', 'y']) no = set(['no', 'n']) #common mp7 butler cmds
import os import sys mp7path=os.environ.get('MP7_TESTS') if mp7path == None: print "ERROR: Set the mp7sw environment before continuing." exit() sys.path.append(mp7path+'/python/daq') import re import dtm import uhal import readline import argparse import logging from mp7.tools.log_config import initLogging initLogging( logging.DEBUG) desc = '' parser = argparse.ArgumentParser(description=desc, formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('--fedID', type=int, default=1402, help='Enter your FED ID.') # TODO: Allow multiple slots to be activated. parser.add_argument('--slot', type=int, default=9, help='Slot to activate in crate') parser.add_argument('--BCNoffset', type=int, default=(0xdec-23), help='Bunch crossing to expect BC0 in.') parser.add_argument('--enableSlink', default='False', action='store_true', help='Flag to enable the Slink to DAQ.') parser.add_argument('--connections_file', type=str, default='/nfshome0/ugmtdev/firmware/connections-ugmt.xml', help='URI to connections file.') opts = parser.parse_args() def status(amc13, state): print "Current state according to script: " + state amc13.status()
help='Analyse Rx buffers on all boards', action='store_true') opts, args = parser.parse_args() return opts, args #linkmap=dict(zip(range(0,72),[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, #17,18,19,20,21,22,23,24,26,27,25,29,28,30,31,32,33,34,35,61, #60,63,62,65,64,67,66,69,68,70,71,49,48,51,50,53,52,55,54,57, #56,58,59,37,36,39,38,41,40,42,43,44,46,45,47])) yes = set(['yes', 'y']) no = set(['no', 'n']) initLogging(logging.INFO) opts, args = parseOptions() hlp.logo() #uhal.setLogLevelTo(uhal.LogLevel.INFO) logging.notice('Running L1->L2 patch panel test... Hold tight!') boards = [] for connection in ET.parse( os.path.expandvars(opts.connections.split('//')[1].split(';') [0])).getroot().findall('connection'): id = connection.get('id') boards.insert(0, id) boards.reverse()
subp.add_argument('--fakesize', dest='fakesize', type=int, default=100, help='') subp = subparsers.add_parser('spy', help='') subp.add_argument('--fake', dest='fake', default=False, action='store_true', help='') args = parser.parse_args() initLogging(logging.INFO if args.verbose == 0 else logging.DEBUG) mp7.setLogThreshold(mp7.kInfo if args.verbose == 0 else mp7.kDebug1) uhal.setLogLevelTo(uhal.LogLevel.ERROR) p5.tcds._log.setLevel(logging.INFO) if args.gdb: helpers.hookDebugger() tcdstoken = args.tcds.split(':') print tcdstoken if len(tcdstoken) != 2 or not tcdstoken[1].isdigit(): logging.critical('Badly formatted tcds applcation address') sys.exit(0) tcdsHost, tcdsPort = tcdstoken[0], int(tcdstoken[1])