FSW.Set_SweepCont(0) FSW.Set_InitImm() if 1: FSW.Set_Trig1_Source('Ext') ########################################################## ### Measure Time ########################################################## #sDate = datetime.now().strftime("%y%m%d-%H:%M:%S.%f") #Date String OFile.write('ACLR,CapTime,Iter,CmdTime') sumTime = 0 for mTime in MeasTim: FSW.Set_IQ_Time(mTime) FSW.Set_InitImm() for i in range(NumIter): tick = datetime.now() FSW.Set_InitImm() aclr = [] for i in range(1, 3 + 1): aclr = aclr + FSW.Get_Mkr_Band(i, 2) d = datetime.now() - tick sumTime = sumTime + d.microseconds / 1e6 OutStr = '%s,%.6f,%d,%3d.%06d' % (aclr, mTime, i, d.seconds, d.microseconds) OFile.write(OutStr) print('%f' % (sumTime / NumIter)) ########################################################## ### Cleanup Automation ########################################################## FSW.jav_Close()
else: VSA.query(':INIT:IMM;*OPC?') # Take Sweep ChPwr = VSA.queryFloatArry(':CALC:MARK:FUNC:POW:RES? MCAC')[0] VSA.Set_RefLevel(ChPwr + 5) if ChPwr > -20: VSA.write('INP:GAIN:STAT OFF') else: VSA.write('INP:GAIN:STAT ON') VSA.write('INP:GAIN:VAL 15') tockA = datetime.now() VSA.write(':INIT:CONT OFF') # Single Sweep VSA.query(':INIT:IMM;*OPC?') # Take Sweep ACLR = [] for i in range(1, 3 + 1): ACLR = ACLR + VSA.Get_Mkr_Band(i, 2) ### <\thing we are timing> tockB = datetime.now() SwpParam = VSA.Get_SweepParams() AmpSet = VSA.Get_AmpSettings() ALTime = tockA - tick TotTime = tockB - tick OutStr = f'{i},{RBW},{MeasTim},{-50+pwr},{ALTime.seconds:3d}.{ALTime.microseconds:06d},{TotTime.seconds:3d}.{TotTime.microseconds:06d},{AmpSet},{SwpParam},{ACLR}' OFile.write(OutStr) ########################################################## ### Cleanup Automation ########################################################## OFile.write("\n") VSA.jav_Close()