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()
############################################################################### ### Code Overhead ############################################################################### from rssd.VSA.Common import VSA #pylint: disable=E0611,E0401 from rssd.yaVISA_socket import jaVisa #pylint: disable=E0611,E0401 from datetime import datetime from rssd.FileIO import FileIO #pylint: disable=E0611,E0401 OFile = FileIO().makeFile(__file__) VSA = VSA().jav_Open(VSA_IP,OFile) #Create VSA Object VSG = jaVisa().jav_Open(VSG_IP,OFile) #Create Object ############################################################################### ### Code Start ############################################################################### #VSA.jav_Reset() VSA.Init_IQ() #FSW ACLR Channel if 1: VSA.Set_Freq(Freq) VSA.Set_IQ_ACLR(ChBW, ChSpace) #VSA.Set_DisplayUpdate("OFF") VSA.Set_Param_Couple_All() VSA.Set_SweepTime(MeasTim) VSA.Set_Trace_Avg('LIN') VSA.Set_Trace_AvgCount(Avg) VSA.Set_YIG('OFF') if 0: VSA.Set_Trig1_Source('Ext') ############################################################################### ### Measure Time
################################################################################ ### Code Overhead: Import and create objects ################################################################################ from rssd.VSA.Common import VSA from rssd.FileIO import FileIO from datetime import datetime OFile = FileIO().makeFile(__file__) FSW = VSA().jav_Open(FSW_IP, OFile) #Create FSW Object ################################################################################ ### Code Start ################################################################################ FSW.jav_Reset() FSW.Init_IQ() #FSW IQ Channel FSW.Set_DisplayUpdate("OFF") FSW.Set_SweepTime(MeasTim) FSW.Set_SweepCont(0) ################################################################################ ### Measure Time ################################################################################ #sDate = datetime.now().strftime("%y%m%d-%H:%M:%S.%f") #Date String OFile.write('Fs,CapTime,Iter,CmdTime') for Fs in FsArry: print("Starting Fs: %f" % Fs) FSW.Set_IQ_SamplingRate(Fs) for i in range(numRepeat): tick = datetime.now() FSW.Set_InitImm()
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()