def __init__(self, f, roc, masks): self.config = list() thisf = open(f) try: for line in thisf: if not line.startswith("--") and not line.startswith("#"): parts = shlex.split(line) if len(parts) == 4: # Ignore the 'Pix' string in the file... p = PixelConfig(int(parts[2]),int(parts[3]),int(parts[0])) p.roc = roc # Check if this pixel is masked: if p in masks: p.mask = True else: p.mask = False self.config.append(p) finally: thisf.close()
def __init__(self, f, roc, masks): self.config = list() thisf = open(f) try: for line in thisf: if not line.startswith("--") and not line.startswith("#"): parts = shlex.split(line) if len(parts) == 4: # Ignore the 'Pix' string in the file... p = PixelConfig(int(parts[2]), int(parts[3]), int(parts[0])) p.roc = roc # Check if this pixel is masked: if p in masks: p.mask = True else: p.mask = False self.config.append(p) finally: thisf.close()
def __init__(self, f): self.config = list() import shlex thisf = open(f) try: for line in thisf: if not line.startswith("--") and not line.startswith("#"): parts = shlex.split(line) if len(parts) == 4: # single pixel to be masked: p = PixelConfig(int(parts[2]),int(parts[3]),15) p.roc = int(parts[1]) p.mask = True self.config.append(p) elif len(parts) == 3: # Full Column/Row to be masked: if parts[0] == "col": for row in range(0, 80): p = PixelConfig(int(parts[2]),row,15) p.roc = int(parts[1]) p.mask = True self.config.append(p) elif parts[0] == "row": for column in range(0, 52): p = PixelConfig(column,int(parts[2]),15) p.roc = int(parts[1]) p.mask = True self.config.append(p) elif len(parts) == 2: # Full ROC to be masked for column in range(0, 52): for row in range(0, 80): p = PixelConfig(column,row,15) p.roc = int(parts[1]) p.mask = True self.config.append(p) finally: thisf.close()
def __init__(self, f): self.config = list() import shlex thisf = open(f) try: for line in thisf: if not line.startswith("--") and not line.startswith("#"): parts = shlex.split(line) if len(parts) == 4: # single pixel to be masked: p = PixelConfig(int(parts[2]), int(parts[3]), 15) p.roc = int(parts[1]) p.mask = True self.config.append(p) elif len(parts) == 3: # Full Column/Row to be masked: if parts[0] == "col": for row in range(0, 80): p = PixelConfig(int(parts[2]), row, 15) p.roc = int(parts[1]) p.mask = True self.config.append(p) elif parts[0] == "row": for column in range(0, 52): p = PixelConfig(column, int(parts[2]), 15) p.roc = int(parts[1]) p.mask = True self.config.append(p) elif len(parts) == 2: # Full ROC to be masked for column in range(0, 52): for row in range(0, 80): p = PixelConfig(column, row, 15) p.roc = int(parts[1]) p.mask = True self.config.append(p) finally: thisf.close()
def __init__(self, f): self.config = list() import shlex thisf = open(f) try: for line in thisf: if not line.startswith("--") and not line.startswith("#"): parts = shlex.split(line) if len(parts) == 4: # Ignore the 'Pix' string in the file... p = PixelConfig(int(parts[2]),int(parts[3]),int(parts[0])) p.mask = False self.config.append(p) finally: thisf.close()
def PxarStartup(directory, verbosity): if not directory or not os.path.isdir(directory): print "Error: no or invalid configuration directory specified!" sys.exit(404) config = PxarConfigFile('%sconfigParameters.dat'%(os.path.join(directory,""))) tbparameters = PxarParametersFile('%s%s'%(os.path.join(directory,""),config.get("tbParameters"))) # Power settings: power_settings = { "va":config.get("va",1.9), "vd":config.get("vd",2.6), "ia":config.get("ia",1.190), "id":config.get("id",1.10)} # Pattern Generator for single ROC operation: if int(config.get("nTbms")) == 0: pg_setup = ( ("PG_RESR",25), ("PG_CAL",106), ("PG_TRG",16), ("PG_TOK",0)) else: pg_setup = ( ("PG_REST",15), ("PG_CAL",106), ("PG_TRG",0)) # Start an API instance from the core pxar library api = PyPxarCore(usbId=config.get("testboardName"),logLevel=verbosity) print api.getVersion() if not api.initTestboard(pg_setup = pg_setup, power_settings = power_settings, sig_delays = tbparameters.getAll()): print "WARNING: could not init DTB -- possible firmware mismatch." print "Please check if a new FW version is available" exit tbmDACs = [] for tbm in range(int(config.get("nTbms"))): for n in range(2): tbmparameters = PxarParametersFile('%s%s'%(os.path.join(directory,""),config.get("tbmParameters") + "_C" + str(tbm) + ("a" if n%2 == 0 else "b") + ".dat")) tbmDACs.append(tbmparameters.getAll()) print "Have DAC config for " + str(len(tbmDACs)) + " TBM cores:" for idx, tbmDAC in enumerate(tbmDACs): for key in tbmDAC: print " TBM " + str(idx/2) + ("a" if idx%2 == 0 else "b") + " dac: " + str(key) + " = " + str(tbmDAC[key]) # init pixel list pixels = list() for column in range(0, 52): for row in range(0, 80): p = PixelConfig(column,row,15) p.mask = False pixels.append(p) rocDacs = [] rocPixels = list() for roc in xrange(int(config.get("nrocs"))): dacconfig = PxarParametersFile('%s%s_C%i.dat'%(os.path.join(directory,""),config.get("dacParameters"),roc)) rocDacs.append(dacconfig.getAll()) rocPixels.append(pixels) print "And we have just initialized " + str(len(pixels)) + " pixel configs to be used for every ROC!" api.initDUT(int(config.get("hubId",31)),config.get("tbmType","tbm08"),tbmDACs,config.get("rocType"),rocDacs,rocPixels) api.testAllPixels(True) print "Now enabled all pixels" print "pxar API is now started and configured." return api
def PxarStartup(directory, verbosity): if not directory or not os.path.isdir(directory): print "Error: no or invalid configuration directory specified!" sys.exit(404) config = PxarConfigFile('%sconfigParameters.dat'%(os.path.join(directory,""))) tbparameters = PxarParametersFile('%s%s'%(os.path.join(directory,""),config.get("tbParameters"))) masks = PxarMaskFile('%s%s'%(os.path.join(directory,""),config.get("maskFile"))) # Power settings: power_settings = { "va":config.get("va",1.9), "vd":config.get("vd",2.6), "ia":config.get("ia",1.190), "id":config.get("id",1.10)} tbmDACs = [] for tbm in range(int(config.get("nTbms"))): for n in range(2): tbmparameters = PxarParametersFile('%s%s'%(os.path.join(directory,""),config.get("tbmParameters") + "_C" + str(tbm) + ("a" if n%2 == 0 else "b") + ".dat")) tbmDACs.append(tbmparameters.getAll()) print "Have DAC config for " + str(len(tbmDACs)) + " TBM cores:" for idx, tbmDAC in enumerate(tbmDACs): for key in tbmDAC: print " TBM " + str(idx/2) + ("a" if idx%2 == 0 else "b") + " dac: " + str(key) + " = " + str(tbmDAC[key]) # init pixel list pixels = list() for column in range(0, 52): for row in range(0, 80): p = PixelConfig(column,row,15) p.mask = False pixels.append(p) rocDacs = [] rocPixels = list() rocI2C = [] config_nrocs = config.get("nrocs").split() nrocs = int(config_nrocs[0]) i2cs = [i for i in range(nrocs)] if len(config_nrocs) > 1: if config_nrocs[1].startswith('i2c'): i2cs = ' '.join(config_nrocs[2:]) i2cs = [int(i) for i in i2cs.split(',')] print "Number of ROCs:", nrocs, "\b; Configured I2C's:", i2cs for roc in xrange(nrocs): if len(i2cs)> roc: i2c = i2cs[roc] else: i2c = roc dacconfig = PxarParametersFile('%s%s_C%i.dat'%(os.path.join(directory,""),config.get("dacParameters"),i2c)) trimconfig = PxarTrimFile('%s%s_C%i.dat'%(os.path.join(directory,""),config.get("trimParameters"),i2c),i2c,masks.get()) print "We have " + str(len(trimconfig.getAll())) + " pixels for ROC " + str(i2c) rocI2C.append(i2c) rocDacs.append(dacconfig.getAll()) rocPixels.append(trimconfig.getAll()) # set pgcal according to wbc pgcal = int(rocDacs[0]['wbc']) + 6 # Pattern Generator for single ROC operation: if int(config.get("nTbms")) == 0: pg_setup = ( ("PG_RESR",25), ("PG_CAL",pgcal), ("PG_TRG",16), ("PG_TOK",0)) else: pg_setup = ( ("PG_RESR",15), ("PG_CAL",pgcal), ("PG_TRG",0)) # Start an API instance from the core pxar library api = PyPxarCore(usbId=config.get("testboardName"),logLevel=verbosity) print api.getVersion() if not api.initTestboard(pg_setup = pg_setup, power_settings = power_settings, sig_delays = tbparameters.getAll()): print "WARNING: could not init DTB -- possible firmware mismatch." print "Please check if a new FW version is available" exit api.initDUT(int(config.get("hubId",31)),config.get("tbmType","tbm08"),tbmDACs,config.get("rocType"),rocDacs,rocPixels, rocI2C) api.testAllPixels(True) print "Now enabled all pixels" print "pxar API is now started and configured." return api
def PxarStartup(directory, verbosity): if not directory or not os.path.isdir(directory): print "Error: no or invalid configuration directory specified!" sys.exit(404) config = PxarConfigFile('%sconfigParameters.dat' % (os.path.join(directory, ""))) tbparameters = PxarParametersFile( '%s%s' % (os.path.join(directory, ""), config.get("tbParameters"))) masks = PxarMaskFile('%s%s' % (os.path.join(directory, ""), config.get("maskFile"))) # Power settings: power_settings = { "va": config.get("va", 1.9), "vd": config.get("vd", 2.6), "ia": config.get("ia", 1.190), "id": config.get("id", 1.10) } tbmDACs = [] for tbm in range(int(config.get("nTbms"))): for n in range(2): tbmparameters = PxarParametersFile( '%s%s' % (os.path.join(directory, ""), config.get("tbmParameters") + "_C" + str(tbm) + ("a" if n % 2 == 0 else "b") + ".dat")) tbmDACs.append(tbmparameters.getAll()) print "Have DAC config for " + str(len(tbmDACs)) + " TBM cores:" for idx, tbmDAC in enumerate(tbmDACs): for key in tbmDAC: print " TBM " + str( idx / 2) + ("a" if idx % 2 == 0 else "b" ) + " dac: " + str(key) + " = " + str(tbmDAC[key]) # init pixel list pixels = list() for column in range(0, 52): for row in range(0, 80): p = PixelConfig(column, row, 15) p.mask = False pixels.append(p) rocDacs = [] rocPixels = list() rocI2C = [] config_nrocs = config.get("nrocs").split() nrocs = int(config_nrocs[0]) i2cs = [i for i in range(nrocs)] if len(config_nrocs) > 1: if config_nrocs[1].startswith('i2c'): i2cs = ' '.join(config_nrocs[2:]) i2cs = [int(i) for i in i2cs.split(',')] print "Number of ROCs:", nrocs, "\b; Configured I2C's:", i2cs for roc in xrange(nrocs): if len(i2cs) > roc: i2c = i2cs[roc] else: i2c = roc dacconfig = PxarParametersFile( '%s%s_C%i.dat' % (os.path.join(directory, ""), config.get("dacParameters"), i2c)) trimconfig = PxarTrimFile( '%s%s_C%i.dat' % (os.path.join(directory, ""), config.get("trimParameters"), i2c), i2c, masks.get()) print "We have " + str(len( trimconfig.getAll())) + " pixels for ROC " + str(i2c) rocI2C.append(i2c) rocDacs.append(dacconfig.getAll()) rocPixels.append(trimconfig.getAll()) # set pgcal according to wbc pgcal = int(rocDacs[0]['wbc']) + 6 # Pattern Generator for single ROC operation: if int(config.get("nTbms")) == 0: pg_setup = (("PG_RESR", 25), ("PG_CAL", pgcal), ("PG_TRG", 16), ("PG_TOK", 0)) else: pg_setup = (("PG_RESR", 15), ("PG_CAL", pgcal), ("PG_TRG", 0)) # Start an API instance from the core pxar library api = PyPxarCore(usbId=config.get("testboardName"), logLevel=verbosity) print api.getVersion() if not api.initTestboard(pg_setup=pg_setup, power_settings=power_settings, sig_delays=tbparameters.getAll()): print "WARNING: could not init DTB -- possible firmware mismatch." print "Please check if a new FW version is available" exit api.initDUT(int(config.get("hubId", 31)), config.get("tbmType", "tbm08"), tbmDACs, config.get("rocType"), rocDacs, rocPixels, rocI2C) api.testAllPixels(True) print "Now enabled all pixels" print "pxar API is now started and configured." return api
def PxarStartup(directory, verbosity): if not directory or not os.path.isdir(directory): print "Error: no or invalid configuration directory specified!" sys.exit(404) config = PxarConfigFile('%sconfigParameters.dat'%(os.path.join(directory,""))) tbparameters = PxarParametersFile('%s%s'%(os.path.join(directory,""),config.get("tbParameters"))) # Power settings: power_settings = { "va":config.get("va",1.9), "vd":config.get("vd",2.6), "ia":config.get("ia",1.190), "id":config.get("id",1.10)} # Pattern Generator for single ROC operation: if int(config.get("nTbms")) == 0: pg_setup = ( ("PG_RESR",25), ("PG_CAL",106), ("PG_TRG",16), ("PG_TOK",0)) else: pg_setup = ( ("PG_REST",15), ("PG_CAL",106), ("PG_TRG",0)) # Start an API instance from the core pxar library api = PyPxarCore(usbId=config.get("testboardName"),logLevel=verbosity) print api.getVersion() if not api.initTestboard(pg_setup = pg_setup, power_settings = power_settings, sig_delays = tbparameters.getAll()): print "WARNING: could not init DTB -- possible firmware mismatch." print "Please check if a new FW version is available" exit tbmDACs = [] for tbm in range(int(config.get("nTbms"))): for n in range(2): tbmparameters = PxarParametersFile('%s%s'%(os.path.join(directory,""),config.get("tbmParameters") + "_C" + str(tbm) + ("a" if n%2 == 0 else "b") + ".dat")) tbmDACs.append(tbmparameters.getAll()) print "Have DAC config for " + str(len(tbmDACs)) + " TBM cores:" for idx, tbmDAC in enumerate(tbmDACs): for key in tbmDAC: print " TBM " + str(idx/2) + ("a" if idx%2 == 0 else "b") + " dac: " + str(key) + " = " + str(tbmDAC[key]) # init pixel list pixels = list() for column in range(0, 52): for row in range(0, 80): p = PixelConfig(column,row,15) p.mask = False pixels.append(p) rocDacs = [] rocPixels = list() for roc in xrange(int(config.get("nrocs"))): dacconfig = PxarParametersFile('%s%s_C%i.dat'%(os.path.join(directory,""),config.get("dacParameters"),roc)) rocDacs.append(dacconfig.getAll()) rocPixels.append(pixels) print "And we have just initialized " + str(len(pixels)) + " pixel configs to be used for every ROC!" api.initDUT(0,config.get("tbmType","tbm08"),tbmDACs,config.get("rocType"),rocDacs,rocPixels) api.testAllPixels(True) print "Now enabled all pixels" print "pxar API is now started and configured." return api