class TestGeneral(unittest.TestCase): def setUp(self): #run before each test self.FSW = VSA().jav_OpenTest(host) self.FSW.Init_IQ() def tearDown(self): #Run after each test self.assertEqual(self.FSW.jav_Error()[0], '0') self.FSW.jav_Close() ############################################################################### ### <Test> ############################################################################### def test_FSW_IQ_Common(self): self.FSW.Set_IQ_BW(100e6) self.FSW.Set_IQ_SamplingRate(100e6) self.FSW.Set_IQ_RecLength(100) self.FSW.Set_IQ_Samples(100) self.FSW.Set_IQ_Time(1e-3) getVal = self.FSW.Get_IQ_RecLength() getVal = self.FSW.Get_IQ_SamplingRate() def test_FSW_Get_IQData(self): self.FSW.Set_IQ_RecLength(100) self.FSW.Set_SweepCont(0) getVal = self.FSW.Get_IQ_Data() getVal = self.FSW.Get_IQ_Data_Ascii(10) # Get 10IQ at a time # if self.FSW.connected == 1: getVal = self.FSW.Get_IQ_Data_Ascii(5) getVal = self.FSW.Get_IQ_Data_Ascii2() if self.FSW.connected == 1: getVal = self.FSW.Get_IQ_Data_Bin() def test_FSW_Set_IQ_ALCR(self): self.FSW.Set_IQ_ACLR(9e6, 10e6) self.FSW.Get_Mkr_BandACLR() def test_FSW_Set_IQ_Adv(self): self.FSW.Set_IQ_Adv_Mode(0) self.FSW.Set_IQ_Adv_Mode(1) self.FSW.Set_IQ_Adv_TransAlgo("AVER") self.FSW.Set_IQ_Adv_WindowLenth(101) self.FSW.Set_IQ_Adv_FFTLenth(4096 + 1) self.FSW.Set_IQ_Adv_Window('P5') self.FSW.Set_IQ_WideBandMax(80e6) def test_FSW_Set_IQSpectrum(self): self.FSW.Set_IQ_SpectrumWindow()
OFile.write('Model ,Iter,Freq,RBW,SwpTime,SMWPwr,ALType,ALTime,TotTime,Attn,PreAmp,RefLvl,SwpTime,SwpPts,SwpType,SwpOpt,TxPwr,Adj-,Adj+,Alt-,Alt+,ChSpace') for i in range(Repeat): for autoMeth in range(len(meth)): for pwr in range(PwrSweep): ### <\thing we are timing> VSG.write(f':POW:AMPL {-50 + pwr}dbm') ### VSG Power tick = datetime.now() ### <AUTOLEVEL> ### eval(meth[autoMeth]) # Dynamically call tockA = datetime.now() ### <AUTOLEVEL> ### VSA.write(':INIT:CONT OFF') # Single Sweep VSA.query(':INIT:IMM;*OPC?') # Take Sweep ACLR = VSA.Get_Mkr_BandACLR() ### <\thing we are timing> tockB = datetime.now() SwpParam = VSA.Get_SweepParams() AmpSet = VSA.Get_AmpSettings() ALTime = tockA - tick TotTime = tockB - tick OutStr = f'{VSA.Model},{i},{Freq},{RBW},{MeasTim},{-50+pwr},{meth[autoMeth]},{ALTime.seconds:3d}.{ALTime.microseconds:06d},{TotTime.seconds:3d}.{TotTime.microseconds:06d},{AmpSet},{SwpParam},{ACLR},{ChSpace}' OFile.write (OutStr) ############################################################################### ### Cleanup Automation ############################################################################### OFile.write("\n") VSA.jav_Close()