def main(group, outfilename, n_orbits=1000000): t = time_string()[:-4] tsname = "HEfnal" if group == 2: tsname = "HEfnal2" ts = hc.teststand(tsname) out = "{0}/histo_{1}".format("data/long_histos", t) if outfilename: out = "{0}/{1}".format("data/long_histos", outfilename.replace(".root","")) histo_output = uhtr.get_histos(ts, n_orbits, sepCapID=0, file_out_base=out, script = False)
# MAIN: start_dir = os.getcwd() os.chdir('..') if __name__ == "__main__": name = '904' # name = "" # if len(sys.argv) == 1: # name = "904" # elif len(sys.argv) == 2: # name = sys.argv[1] # else: # name = "904" ts = teststand(name) # Initialize a teststand object. This object stores the teststand configuration and has a number of useful methods. #print "\nYou've just run a script that's a skeleton for making your own script." # Print out some information about the teststand: #print ">> The teststand you're using is named {0}.".format(ts.name) #print ">> The crate and QIE card organization for the teststand is below:\n{0}".format(ts.fe) # /MAIN parser = optparse.OptionParser() parser.add_option('-v','--verbose', help = 'Display full test output', dest = 'verbose', default = False, action = 'store_true') parser.add_option('-l','--log', help = 'Log test results', dest = 'log', default = False, action = 'store_true') (options, args) = parser.parse_args() os.system("clear") log = options.log verbose = options.verbose
return False # /FUNCTIONS # MAIN: if __name__ == "__main__": name = "" if len(sys.argv) == 1: name = "904" elif len(sys.argv) == 2: name = sys.argv[1] else: name = "904" ts = teststand( name ) # Initialize a teststand object. This object stores the teststand configuration and has a number of useful methods. result = [0] * 24 registers = [] for name in register_names: registers.append(register(ts, name, 48)) # HERE on "48" for i in range(5): #print "test",i for r in registers: #print r.name value = getRandomValue() values = [value[0:8], '0x' + value[8:16]] r.addTestToCache(values[0] + " " + values[1]) #if not testRandomValue( r ) :
randomInt = random.randint(0,1) for i in range( registerSize - 1 ) : if random.randint(0,1) : randomInt = ( randomInt | 1 ) << 1 else : randomInt = randomInt << 1 return str(hex(randomInt)) # MAIN: if __name__ == "__main__": parser=OptionParser() parser.add_option('-t','--teststand',dest='name',default='904',help="The name of the teststand you want to use (default is \"904\").") parser.add_option('-q','--qieid',dest='qieid',default='0x8D000000 0xAA24DA70',help="The ID of the QIE card we read.") (options, args) = parser.parse_args() ts = teststand(options.name) crateslot=ts.crate_slot_from_qie(qie_id=options.qieid) crate=crateslot[0] slot=crateslot[1] result = [0]*24 registers = [ register( ts , "HF{0}-{1}-iBot_CntrReg_CImode".format(crate,slot) , 1 ) , register( ts , "HF{0}-{1}-iBot_CntrReg".format(crate,slot), 1 ) , register( ts , "HF{0}-{1}-iBot_LinkTestMode_BC0Enable".format(crate,slot), 1 ) , register( ts , "HF{0}-{1}-iBot_LinkTestMode_Enable".format(crate,slot) , 1 ) , register( ts , "HF{0}-{1}-iBot_LinkTestMode".format(crate,slot) , 1 ) , register( ts , "HF{0}-{1}-iBot_LinkTestPattern".format(crate,slot) , 32 ) , register( ts , "HF{0}-{1}-iBot_scratch".format(crate,slot) , 32 ) , register( ts , "HF{0}-{1}-iTop_CntrReg_CImode".format(crate,slot) , 1 ) , register( ts , "HF{0}-{1}-iTop_CntrReg".format(crate,slot) , 1 ) , register( ts , "HF{0}-{1}-iTop_LinkTestMode_BC0Enable".format(crate,slot) , 1 ) ,
metavar="STR" ) (options, args) = parser.parse_args() name = options.ts period = float(options.spar) if not options.out: path = "data/ts_{0}".format(name) elif "/" in options.out: path = options.out else: path = "data/" + options.out period_long = float(options.full) # Set up teststand: ts = teststand(name) # Print information: print ">> The output directory is {0}.".format(path) print ">> The logging period is {0} minutes.".format(period) print ">> (A full log will be taken every {0} minutes.)".format(period_long) # Logging loop: z = True t0 = 0 t0_long = time() while z == True: dt = time() - t0 dt_long = time() - t0_long if (period_long!=0) and (dt_long > period_long*60): t0_long = time()
reset = False setup = False link = False if options.all: reset = True setup = True link = True if options.reset: reset = True if options.setup: setup = True if options.link: link = True ts = hc.teststand(tstype) if reset: # Do a reset if tstype == "HEcharm": os.system("source /home/daq/pastika/reset.sh") else: log_teststand.HEreset(ts) if link and tstype != "HEoven": # initialize the links uhtr.initLinks(ts, OrbitDelay=33, Auto_Realign=1, OnTheFlyAlignment=0, CDRreset=0, GTXreset=0, verbose=True) print uhtr.linkStatus(ts) if setup: log_teststand.HEsetup(ts)
import sys # CLASSES: # /CLASSES # FUNCTIONS: # /FUNCTIONS # MAIN: if __name__ == "__main__": name = "" if len(sys.argv) == 1: name = "904" elif len(sys.argv) == 2: name = sys.argv[1] else: name = "904" print "\nYou've just run a script that's a skeleton for making your own script.\n" # Initialize a teststand object: ts = teststand(name) # This object stores the teststand configuration and has a number of useful methods. # ts.update() # Set version info in each component. # Print out some information about the teststand: ts.Print() # print ">> The teststand you're using is named {0}.".format(ts.name) # print ">> The BE crate and uHTR organization for the teststand is below:\n{0}".format(ts.be) # print ">> The FE crate and QIE card organization for the teststand is below:\n{0}".format(ts.fe) # /MAIN
from hcal_teststand import * from hcal_teststand.hcal_teststand import teststand import sys from optparse import OptionParser adcorder=[8,0,11,3,10,2,9,1] tdcorder=[14,6,13,5,12,4] if __name__=="__main__": parser=OptionParser() parser.add_option('-t','--teststand',dest='name',default='904',help="The name of the teststand you want to use (default is \"904\").") parser.add_option('-q','--qieid',dest='qieid',default='0x8D000000 0xAA24DA70',help="The ID of the QIE card we read.") (options, args) = parser.parse_args() ts = teststand(options.name) crateslot=ts.crate_slot_from_qie(qie_id=options.qieid) crate=crateslot[0] slot=crateslot[1] fldec=open('igloodec.txt','w') sepcut='---------------------------------------------------------------------------------------------------------------\n' ostr=sepcut+'channel(T/B)\t' for i in range(12): ostr+='{0}/{1}\t'.format(i+1,i+13) ostr+='\n' fldec.write(ostr) command1=['put HF{0}-{1}-iTop_CntrReg 0x2'.format(crate,slot),'put HF{0}-{1}-iTop_CntrReg 0x0'.format(crate,slot)] command2=['put HF{0}-{1}-iBot_CntrReg 0x2'.format(crate,slot),'put HF{0}-{1}-iBot_CntrReg 0x0'.format(crate,slot)] command3=['get HF{0}-{1}-iTop_StatusReg'.format(crate,slot),'get HF{0}-{1}-iTop_inputSpy'.format(crate,slot)]*512 command4=['get HF{0}-{1}-iBot_StatusReg'.format(crate,slot),'get HF{0}-{1}-iBot_inputSpy'.format(crate,slot)]*512 command1.extend(command2) command1.extend(command3) command1.extend(command4) outp=ngccm.send_commands_parsed(ts,command1)['output'] for opt in outp:
help="LED amplitude (0.5)") parser.add_option("-s", "--shunt", dest="shunt", type="int", default=0x00, help="Shunt Setting (0x00)") (options, args) = parser.parse_args() if not options.tstype: print "Please specify which teststand to use!" sys.exit() tstype = options.tstype ts = hc.teststand(tstype) amplitude = options.ledAmp shunt = options.shunt # commands to run cmds1 = [ "put HE1-pulser-ledA-enable 1", "put HE1-pulser-ledA-amplitude_f %f" % amplitude, "put HE1-pulser-ledA-delay_f 0.0", "put HE1-pulser-ledA-bxdelay 9", "put HE1-pulser-ledA-width_f 10.", "put HE1-pulser-ledB-enable 1", "put HE1-pulser-ledB-amplitude_f %f" % amplitude, "put HE1-pulser-ledB-delay_f 0.0", "put HE1-pulser-ledB-bxdelay 9", "put HE1-pulser-ledB-width_f 10.0", "wait", "put HE1-1-QIE[1-48]_Gsel 48*%i" % shunt ]
# CLASSES: # /CLASSES # FUNCTIONS: # /FUNCTIONS # MAIN: if __name__ == "__main__": name = "" if len(sys.argv) == 1: name = "904" elif len(sys.argv) == 2: name = sys.argv[1] else: name = "904" print "\nYou've just run a script that's a skeleton for making your own script.\n" # Initialize a teststand object: ts = teststand( name ) # This object stores the teststand configuration and has a number of useful methods. # ts.update() # Set version info in each component. # Print out some information about the teststand: ts.Print() # print ">> The teststand you're using is named {0}.".format(ts.name) # print ">> The BE crate and uHTR organization for the teststand is below:\n{0}".format(ts.be) # print ">> The FE crate and QIE card organization for the teststand is below:\n{0}".format(ts.fe) # /MAIN