cq.bc.fe_pulse_param(delay=delay, period=period, width=0xa00) chns = cq.get_adcdata(PktNum=(period*avg_n + 1000) ) poft = 0 chn_tmp = [] for i in range(0,avg_n): for j in [1]: if i == 0: avg_chns = (np.array(chns[j][poft+200*i:poft+200+200*i])&0xffff) else: avg_chns = avg_chns + (np.array(chns[j][poft+200*i:poft+200+200*i])&0xffff) avg_chns = avg_chns//avg_n for i in range(len(avg_chns)): if (avg_chns[i] >= 0xfff0): avg_chns[i] = 0 chn1_p.append(np.max(avg_chns)) pk_dly = np.where( chn1_p == np.max(chn1_p))[0][0] print ("Peak %d with delay = %d"%(np.max(chn1_p), pk_dly)) cq.bc.fe_pulse_param(delay=pk_dly, period=period, width=0xa00) chns = cq.get_adcdata_raw(PktNum=(period*avg_n + 1000) ) fn = rawdir + "Gain_Test%02d_"%testno + tp + sg_str + snc_str + sbf_str + sdc_str + "_asicdac%02d"%asic_dac +".bin" print (fn) with open(fn, 'wb') as f: pickle.dump(chns, f)
asic_dac = 0 rawdir = "D:/ColdADC/" rawdir = rawdir + "D2_noise_acq_LN/" if (os.path.exists(rawdir)): pass else: try: os.makedirs(rawdir) except OSError: print("Error to create folder ") sys.exit() cq.fe_cfg(sts=sts, snc=snc, sg=sg, st=st, sbf=sbf, sdc=sdc, sdacsw=sdacsw, fpga_dac=fpga_dac, asic_dac=asic_dac) chns = cq.get_adcdata_raw(PktNum=2000000) for i in range(len(chns)): print(np.mean(chns[i]), np.std(chns[i])) fn = rawdir + "Noise_Test%02d_" % testno + tp + sg_str + snc_str + sbf_str + sdc_str + env + ".bin" print(fn) with open(fn, 'wb') as f: pickle.dump(chns, f)