import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "gempython.utils.db.settings") import django django.setup() import datetime from time import sleep from gempython.utils.db.ldqm_db.models import * from gempython.utils.db.ldqm_db.amcmanager import * import gempython.utils.gemlogger as GEMLogger query_gemlogger = GEMLogger.getGEMLogger(__name__) #query_gemlogger.setLevel(GEMLogger.DEBUG) def configure_db(station="GEM904",setuptype="teststand",runperiod="2017T",shelf=3): #amc_list=[1,2,3,4,5,6,7,8,9,10,11,12] #geb_list=[[0,1,2,3,4,5,6,7,8,9,10,11],[0,1,2,3,4,5,6,7,8,9,10,11],[0,1,2,3,4,5,6,7,8,9,10,11],[0,1,2,3,4,5,6,7,8,9,10,11],[0,1,2,3,4,5,6,7,8,9,10,11],[0,1,2,3,4,5,6,7,8,9,10,11],[0,1,2,3,4,5,6,7,8,9,10,11],[0,1,2,3,4,5,6,7,8,9,10,11],[0,1,2,3,4,5,6,7,8,9,10,11],[0,1,2,3,4,5,6,7,8,9,10,11],[0,1,2,3,4,5,6,7,8,9,10,11],[0,1,2,3,4,5,6,7,8,9,10,11],] amc_list=[2] geb_list=[[0,],] zlist = zip(amc_list, geb_list) a_list = [] for amcN, gtx_list in zlist: msg = "Trying to connect to AMC # %s on shelf %s \n" %(amcN, shelf) query_gemlogger.info(msg) # m_AMCmanager = AMCmanager(shelf,connection_file) m_AMCmanager = AMCmanager() g_list = [] #try: # m_AMCmanager.connect(int(amcN), int(shelf)) #except ValueError as ve:
parser.add_option("--l1a_block", action="store_true", dest="l1a_block", help="Inhibit the L1As at the TTC backplane link", metavar="l1a_block") parser.add_option("--full", action="store_true", dest="full", help="Show extended information", metavar="full") parser.add_option("--invertTX", type="string", dest="invertTX",default="", help="Flip polarity for SFPs in list", metavar="invertTX") parser.add_option("--user", action="store_true", dest="userOnly", help="print user information only", metavar="userOnly") parser.add_option("--ngtx", type="int", dest="ngtx", default=2, help="Number of GTX links supported in the firmware (default is 2)", metavar="ngtx") parser.add_option("--ttc", type="int", dest="gemttc", default=2, help="choose the TTC encoding (gem/csc=0, amc13=1,default=2 meaning no modification)", metavar="gemttc") (options, args) = parser.parse_args() gemlogger = getGEMLogger(__name__) gemlogger.setLevel(logging.INFO) uhal.setLogLevelTo( uhal.LogLevel.FATAL ) amc = getAMCObject(options.slot,options.shelf,options.debug) print print "--=======================================--" print " Opening AMC with ID", amc print "--=======================================--" print # # set all links to un-inverted # for sfp in range(4): # writeRegister(amc,"GEM_AMC.GEM_SYSTEM.TK_LINK_TX_POLARITY",0x0)
def __init__(self): self.connection_file = "file://${GEM_ADDRESS_TABLE_PATH}/connections.xml" import gempython.utils.gemlogger as GEMLogger self.gemlogger = GEMLogger.getGEMLogger(__name__) pass
from gempython.utils.standardopts import parser parser.add_option("-z", "--sleep", action="store_true", dest="sleepAll", help="set all chips into sleep mode", metavar="sleepAll") parser.add_option("--bias", action="store_true", dest="biasAll", help="set all chips with default bias parameters", metavar="biasAll") parser.add_option("--enable", type="string", dest="enabledChips", help="list of chips to enable, comma separated", metavar="enabledChips", default=[]) parser.add_option("--testi2c", type="int", dest="testi2c", default=-1, help="Testing the I2C lines (select I2C line 0-5, or 6 for all", metavar="testi2c") parser.add_option("--testsingle", action="store_true", dest="testsingle", help="Testing single VFAT transactions (turn on every other VFAT)", metavar="testsingle") (options, args) = parser.parse_args() gemlogger = getGEMLogger(__name__) gemlogger.setLevel(logging.INFO) uhal.setLogLevelTo( uhal.LogLevel.FATAL ) amc = getAMCObject(options.slot,options.shelf,options.debug) ohboard = getOHObject(options.slot,options.gtx,options.shelf,options.debug) setOHLogLevel(logging.INFO) setOHLogLevel(logging.INFO) setAMCLogLevel(logging.INFO) setVFATLogLevel(logging.INFO) v3regs = [ "CFG_PULSE_STRETCH", "CFG_SELF_TRIGGER_MODE", "CFG_FP_FE",
def __init__(self): self.connection_file = "file://${GEM_ADDRESS_TABLE_PATH}/connections.xml" import gempython.utils.gemlogger as GEMLogger self.gemlogger = GEMLogger.getGEMLogger(__name__) pass
import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "gempython.utils.db.settings") import django django.setup() import datetime from time import sleep from gempython.utils.db.ldqm_db.models import * from gempython.utils.db.ldqm_db.amcmanager import * import gempython.utils.gemlogger as GEMLogger query_gemlogger = GEMLogger.getGEMLogger(__name__) #query_gemlogger.setLevel(GEMLogger.DEBUG) def configure_db(station="GEM904", setuptype="teststand", runperiod="2017T", shelf=3): #amc_list=[1,2,3,4,5,6,7,8,9,10,11,12] #geb_list=[[0,1,2,3,4,5,6,7,8,9,10,11],[0,1,2,3,4,5,6,7,8,9,10,11],[0,1,2,3,4,5,6,7,8,9,10,11],[0,1,2,3,4,5,6,7,8,9,10,11],[0,1,2,3,4,5,6,7,8,9,10,11],[0,1,2,3,4,5,6,7,8,9,10,11],[0,1,2,3,4,5,6,7,8,9,10,11],[0,1,2,3,4,5,6,7,8,9,10,11],[0,1,2,3,4,5,6,7,8,9,10,11],[0,1,2,3,4,5,6,7,8,9,10,11],[0,1,2,3,4,5,6,7,8,9,10,11],[0,1,2,3,4,5,6,7,8,9,10,11],] amc_list = [2] geb_list = [ [ 0, ], ] zlist = zip(amc_list, geb_list) a_list = [] for amcN, gtx_list in zlist:
def launchArgs(shelf, slot, link, run, armDAC, armDACBump, configType, cName, debug=False, gemType="ge11"): dataPath = os.getenv('DATA_PATH') from gempython.vfatqc.utils.qcutilities import getCardName from gempython.tools.vfat_user_functions_xhal import HwVFAT cardName = getCardName(shelf, slot) if gemType == "ge11": detType = "short" elif gemType == "ge21": detType = "m1" else: print("GEM types other than GE1/1 and GE2/1 aren't supported yet") os.exit(1) vfatBoard = HwVFAT(cardName, link, debug, gemType, detType) from gempython.vfatqc.utils.namespace import Namespace args = Namespace(applyMasks=False, chConfig=None, compare=False, debug=debug, filename=None, run=run, vt1=armDAC, vt1bump=armDACBump, vt2=0, vfatConfig=None, vfatmask=vfatBoard.parentOH.getVFATMask(), zeroChan=False) from gempython.utils.gemlogger import printYellow if (configType & 0x1): # Set vfatConfig vfatConfig = "{0}/configs/vfatConfig_{1}.txt".format(dataPath, cName) # Channel config if os.path.isfile(chConfig): args.chConfig = chConfig else: print("No channel configuration exists for {0}".format(cName)) # VFAT Config if os.path.isfile(vfatConfig): args.vfatConfig = vfatConfig else: printYellow("No vfat configuration exists for {0}".format(cName)) if ((configType & 0x2) > 0): # Set chConfig and potentially channel masks chConfig = "{0}/configs/chConfig_{1}.txt".format(dataPath, cName) if os.path.isfile(chConfig): args.chConfig = chConfig if ((configType & 0x4) > 0): args.applyMasks = True else: printYellow( "No channel configuration exists for {0}".format(cName)) if ((configType & 0x8) > 0): # Zero all channel registers args.chConfig = None args.applyMasks = False args.zeroChan = True pass from gempython.utils.gemlogger import getGEMLogger import logging gemlogger = getGEMLogger(__name__) gemlogger.setLevel(logging.ERROR) from gempython.vfatqc.utils.confUtils import configure from subprocess import CalledProcessError try: configure(args, vfatBoard) except CalledProcessError as e: print "Caught exception", e pass return