def __init__(self, roach=None, roach_name=None, zdok=0, gpib_addr=None, test=False, dir='.', now=None, config=False, bof=False, clockrate=None, snapshot=None): self.zdok = zdok self.test = test self.dir = dir self.clockrate = clockrate if clockrate is not None else 1500.0 self.config = 0 #config self.bof = bof # Removing this check because you may be using ADCCalibrate in a read-only # mode where gpib is not needed (since it is write-only, TBF) #if not test and gpib_addr is None: # raise Exception, "Must specify gpib_addr if ADCCalibrate is not in test mode." if not test and roach_name is None: raise Exception, "Must specify Roach if ADCCalibrate is not in test mode." self.roach_name = roach_name if not test else "noroach" if not test and roach is None: self.roach = corr.katcp_wrapper.FpgaClient(self.roach_name) time.sleep(3) if not self.roach.is_connected(): raise Exception, "%s did not work" % self.roach_name else: self.roach = roach self.now = datetime.now() if now is None else now self.time_frmt = '%Y-%m-%d-%H%M%S' self.current_time = self.now.strftime(self.time_frmt) #self.set_file_label() # helper classes #self.gpib = GPIB(gpib_addr, test = test) self.spi = SPI(zdok=zdok, test=test, roach=self.roach) self.adc = AdcSnapshot(zdok=zdok, snapshot=snapshot, test=test, roach=self.roach, clockrate=self.clockrate) # higher-level classes self.ogp = OGP(zdok=zdok, spi=self.spi, adc=self.adc, roach_name=roach_name, clockrate=self.clockrate, now=now, dir=dir) self.inl = INL(zdok=zdok, spi=self.spi, roach_name=roach_name, now=now, dir=dir) self.mmcm = MMCM(zdok=zdok, spi=self.spi, adc=self.adc) self.configFile = "%s-adc.conf" % roach_name self.configPath = "%s/%s" % (dir, self.configFile) #self.cf = ADCConfFile(self.configPath) self.n_cores = 4 self.cores = range(1, self.n_cores + 1) #self.clockrate = 1500.0 self.samp_freq = 2 * self.clockrate # file prefixes self.post_mmcm_ramp_check_name = "post_mmcm_ramp_check" self.post_ramp_check_raw_name = "post_ramp_check_raw" self.raw_startup_name = "raw_startup" self.loaded_files = []
if __name__ == "__main__": #myHandlers.timestamp = "_" import corr import time from SPI import SPI from AdcSnapshot import AdcSnapshot #logging.config.fileConfig('adc5g_logging_config.conf') #logger = logging.getLogger('adc5gLogging') #logger.info("Started") roach_name = "srbsr2-1" roach = corr.katcp_wrapper.FpgaClient(roach_name) time.sleep(3) print "connected: ", roach.is_connected() #bof = 'h1k_ver105_2013_Dec_02_1551.bof' #roach.progdev(bof) #time.sleep(5) test = False spi = SPI(roach=roach, test=test) adc = AdcSnapshot(roach=roach, test=test) mmcm = MMCM(spi=spi, adc=adc, test=test) mmcm.calibrate_mmcm_phase()