VSA.Set_Trace_Detector('RMS') VSA.Set_SweepOpt(SweMode) VSA.Set_SweepType(SweType) VSA.Set_In_YIG('OFF') # VSA.Set_Trig1_Source('Ext') ################################################################################ ### Measure Time ################################################################################ #sDate = timeit.default_timer().strftime("%y%m%d-%H:%M:%S.%f") #Date String LoopParam = 'Iter,Pwr' TimeParam = 'AlTime,MeasTime,TotalTIme' SwpParam = VSA.Get_Params_Sweep(1) AmpParam = VSA.Get_Params_Amp(1) TrcParam = VSA.Get_Params_Trace(1) SysParam = VSA.Get_Params_System(1) MeasData = 'TxPwr,Adj-,Adj+,Alt-,Alt+' OFile.write( f'{LoopParam},{TimeParam},{AmpParam},{SwpParam},{TrcParam},{SysParam},{MeasData}' ) # table = VSAL.ReadLevellingTables(Freq) tick0 = timeit.default_timer() for i in range(Repeat): for VSApwr in range(PwrSweep): tick = timeit.default_timer() ### <\thing we are timing> VSG.write(f':POW:AMPL {VSApwr - DUTGain}dbm') # VSG Power ################# ### AUTOLEVEL ###
class TestGeneral(unittest.TestCase): def setUp(self): #run before each test self.FSW = VSA().jav_OpenTest(host) self.FSW.Init_Spectral() def tearDown(self): #Run after each test self.assertEqual(self.FSW.jav_Error()[0],'0') self.FSW.jav_Close() ############################################################################### ### <Test> ############################################################################### def test_FSW_Autolevel(self): self.FSW.Set_Autolevel() self.FSW.Set_Autolevel_IFOvld() def test_FSW_ACLR(self): self.FSW.Init_ACLR() self.FSW.Set_ACLR_AdjBW(95e6) self.FSW.Set_ACLR_AdjSpace(100e6) self.FSW.Set_ACLR_CHBW(100e6) self.FSW.Set_ACLR_NumAdj(2) self.FSW.Get_ACLR() def test_FSW_ChannelManagement(self): if self.FSW.connected: getVal = self.FSW.Get_ChannelName() getVal = self.FSW.Get_Channels() self.FSW.Init_IQ() self.FSW.Set_ChannelName('IQ','IQ_Test') self.FSW.Set_ChannelSelect('Spectrum') def test_FSW_Connect(self): self.FSW.jav_IDN() if self.FSW.connected: self.assertEqual(self.FSW.Make,"Rohde&Schwarz") # Valuecompare def test_FSW_Ex_SpectralSettings(self): self.FSW.Set_Freq(1e6) self.FSW.Set_RefLevel(10) self.FSW.Set_ResBW(1e6) self.FSW.Set_VidBW(1e6) self.FSW.Set_Span(100e6) self.FSW.Set_AttnMech(10) self.FSW.Get_IFOvld() self.FSW.Get_ACLR() self.FSW.Set_DisplayUpdate('ON') self.FSW.Set_Ref_Source('INT') def test_FSW_Ex_SpectralSettings_Auto(self): self.FSW.Set_Freq(1e6) self.FSW.Set_ResBW(0) self.FSW.Set_VidBW(0) self.FSW.Set_Span(100e6) self.FSW.Set_Autolevel() self.FSW.Set_AttnAuto() self.FSW.Get_IFOvld() self.FSW.Get_ACLR() self.FSW.Set_DisplayUpdate('ON') def test_FSW_Equalizer(self): self.FSW.Set_EQ_File('Test') self.FSW.Set_EQ_State('ON') self.FSW.Set_EQ_State('OFF') def test_FSW_Freq(self): self.FSW.Set_FreqStart(10e6) self.FSW.Set_FreqStop(100e6) # self.FSW.Set_FreqStep(1e5) self.FSW.Set_Freq(100e6) rdStr = self.FSW.Get_Freq() #var = input("Please enter something: ") if self.FSW.connected: self.assertEqual(100e6,rdStr) # Valuecompare def test_FSW_GetParams(self): nullVal = self.FSW.Get_Params_Amp(1) nullVal = self.FSW.Get_Params_Amp() nullVal = self.FSW.Get_Params_Sweep(1) nullVal = self.FSW.Get_Params_Sweep() nullVal = self.FSW.Get_Params_Trace(1) nullVal = self.FSW.Get_Params_Trace() nullVal = self.FSW.Get_Params_System(1) nullVal = self.FSW.Get_Params_System() nullVal = self.FSW.Get_Params_MkrBand(1) nullVal = self.FSW.Get_Params_MkrBand() nullVal = self.FSW.Get_Params(1,1,1,1,0) def test_FSW_GetScreenshot(self): getVal = self.FSW.Get_Screenshot() def test_FSW_GetTrace(self): getVal = self.FSW.Get_Trace_Data() def test_FSW_Input(self): self.FSW.Set_Freq(1e9) self.FSW.Set_Input('RF') self.FSW.Set_In_YIG('ON') self.FSW.Set_In_YIG('OFF') self.FSW.Set_In_HPFilter('ON') def test_FSW_Marker_dB(self): self.FSW.Set_Mkr_AllOff() self.FSW.Set_Mkr_Peak() self.FSW.Set_Mkr_On(2) self.FSW.Set_Mkr_Next(2) getVal = self.FSW.Get_Mkr_Freq() getVal = self.FSW.Get_Mkr_XY() getVal = self.FSW.Get_Mkr_Y() def test_FSW_Marker_BanddB(self): self.FSW.Set_Mkr_AllOff() self.FSW.Set_Mkr_BandSetRef() self.FSW.Set_Mkr_BandDelta(1e9) self.FSW.Get_Mkr_Band() def test_FSW_Marker_Noise(self): self.FSW.Get_Mkr_Noise() def test_FSW_Marker_Time(self): self.FSW.Set_Span(0) self.FSW.Set_SweepTime(0.010) self.FSW.Set_Mkr_Time(0.001) rdStr = self.FSW.Get_Mkr_TimeDomain() if self.FSW.connected: self.assertEqual(rdStr, 0.001) self.FSW.Set_Span(900e6) self.FSW.Set_SweepTime(0) #Auto Sweeptime def test_FSW_Trigger(self): self.FSW.Set_Trig1_Source('IMM') self.FSW.Set_Trig2_Dir('OUT') self.FSW.Set_Trig2_OutType('DEV') def test_FSW_TraceAvg(self): self.FSW.Set_Trace_Avg('LIN') self.FSW.Set_Trace_AvgCount(10) self.FSW.Set_Trace_Detector('RMS') self.FSW.Set_Trace_Mode('WRIT') self.FSW.Set_Trace_AvgOff() def test_FSW_Sweep(self): self.FSW.Set_SweepPoints(1001) self.FSW.Set_SweepType('AUTO') self.FSW.Set_SweepOpt('AUTO') def test_FSW_Sys_Overload(self): getVal = self.FSW.Get_Ovld_Stat()