def init(verbose=verbose, reset_shift_bytes=True): sys = nuphase.Nuphase() sys.boardInit(verbose=verbose) current_atten_values = sys.getCurrentAttenValues(verbose=True) sys.setAttenValues(numpy.zeros(NUM_CHANNELS, dtype=int), readback=verbose) sys.calPulser(True, readback=verbose) #turn on cal pulse feature SHIFT_BYTES = numpy.zeros(NUM_CHANNELS, dtype=int) if reset_shift_bytes: #set to 0 and read in current values for delay: ##master board for i in range(4): sys.write(sys.BUS_MASTER, [56 + i, 0, 0, 0]) readback = sys.readRegister(sys.BUS_MASTER, 56 + i) SHIFT_BYTES[2 * i] = readback[3] SHIFT_BYTES[2 * i + 1] = readback[2] return sys, SHIFT_BYTES, current_atten_values
epcq_address, int(_min), _sec)) setMode(dev, bus, 0) ###----------------------------------------------------------------- ### load new application firmware image # ###----------------------------------------------------------------- if __name__ == '__main__': import sys from optparse import OptionParser parser = OptionParser() (options, args) = parser.parse_args() dev = nuphase.Nuphase() bus = dev.BUS_MASTER #bus = dev.BUS_SLAVE print '\n RUNNING REMOTE FIRMWARE IMAGE UPDATE ' reconfig.enableRemoteFirmwareBlock(dev, bus, False) reconfig.enableRemoteFirmwareBlock(dev, bus, True) print '\n***************************\n' clearApplicationImage(dev, bus, TARGET_START_ADDR, FILEMAP_END_ADDR) #dat = readEPCQBlock(dev, bus, TARGET_START_ADDR) #for i in range(len(dat)): # if dat[i] != 0xFF: # print 'clear error', i, dat[i] print '\n***************************\n' time.sleep(1) writeFirmwareToEPCQ(dev, bus, filename, FILEMAP_START_ADDR, FILEMAP_END_ADDR)
import nuphase import time import numpy NUM_TRIES = 100 sys = nuphase.Nuphase() sys.boardInit(verbose=False) sys.calPulser(True, readback=True) #turn on cal pulse feature num_tests=0 num_success=0 num_almost_success=0 for i in range(NUM_TRIES): sys.boardInit() #only deal with buffer 0 sys.calPulser(True) time.sleep(0.2) sys.softwareTrigger() time.sleep(0.001) data = sys.readSysEvent(save=False) print sys.getMetaData() location_of_peaks=[] for chan in range(len(data)): location_of_peaks.append(numpy.argmax(data[chan])) earliest_peak = min(location_of_peaks) latest_peak = max(location_of_peaks) #condition if peaks caught from multiple pulses
import nuphase import time import json d = nuphase.Nuphase() d.enablePhasedTrigger(verification_mode=True) d.externalTriggerInputConfig(enable=False) print d.readRegister(1, 75) for beam in range(15): d.setBeamThresholds(22000, beam) time.sleep(20) current_scalers = d.readScalers() print 'current scaler values:', current_scalers