class TestGeneral(unittest.TestCase): def setUp(self): #run before each test self.FSW = VSA().jav_OpenTest(host) self.FSW.Init_ADemod() def tearDown(self): #Run after each test self.assertEqual(self.FSW.jav_Error()[0],'0') self.FSW.jav_Close() ############################################################################### ### <Test> ############################################################################### def test_FSW_ADemod(self): self.FSW.Set_Adem_dbw(3e6) self.FSW.Set_Adem_LPassStat('OFF') self.FSW.Set_Adem_LPassStat('ON') self.FSW.Set_Adem_LPassAbsolute('3kHz') self.FSW.Set_Adem_LPassManual(1e6) self.FSW.Set_Adem_LPassRelative('5PCT') getVal = self.FSW.Get_Adem_dbw() if self.FSW.connected: self.assertEqual(getVal, 3e6) def test_FSW_ADemod_PM(self): self.FSW.Set_Freq(28e9) # RF Freq self.FSW.Set_Adem_dbw(200e3) # Demod BW self.FSW.Set_Adem_Coupling('AC') # Coupling self.FSW.Set_Adem_PM_Unit('DEG') # Units self.FSW.Set_Adem_PM_Scale(4) # Y Scaling self.FSW.Set_Adem_PM_RefPos(50) # Phase Reference Position self.FSW.Set_Adem_PM_RefVal(1) # Phase Reference Value self.FSW.Set_In_YIG('ON') # YIG ON
class TestGeneral(unittest.TestCase): def setUp(self): #run before each test self.FSW = VSA().jav_OpenTest(host) self.FSW.Init_ADemod() def tearDown(self): #Run after each test self.assertEqual(self.FSW.jav_Error()[0],'0') self.FSW.jav_Close() ############################################################################### ### <Test> ############################################################################### def test_FSW_ADemod(self): self.FSW.Set_Adem_dbw(3e6) self.FSW.Set_Adem_LPassStat('OFF') self.FSW.Set_Adem_LPassStat('ON') self.FSW.Set_Adem_LPassAbsolute('3kHz') self.FSW.Set_Adem_LPassManual(1e6) self.FSW.Set_Adem_LPassRelative('5PCT') getVal = self.FSW.Get_Adem_dbw() if self.FSW.connected: self.assertEqual(getVal, 3e6)
FSW.Set_Adem_Coupling('AC') # Coupling FSW.Set_Adem_PM_Unit('DEG') # Units FSW.Set_Adem_PM_Scale(4) # Y Scaling FSW.Set_Adem_PM_RefPos(50) # Phase Reference Position FSW.Set_Adem_PM_RefVal(1) # Phase Reference Value FSW.Set_Trace_AvgCount(1) # Average Count FSW.Set_In_YIG('ON') # YIG ON FSW.write('CALC:FEED "XTIM:PM:TDOM"') ############################################################################### ### Loop ############################################################################### FSW.Set_Mkr_AllOff() # All markers off for mkr in range(NumMkrs): # Create markers FSW.Set_Mkr_On(mkr+1) FSW.Set_Mkr_Time((MkrOffset+mkr*Delay)/1000,mkr+1) for phaseAngle in range(1,3): phaseMeas = [] for numAvg in range(traceAvg): phaseMeas.append(MeasRelPhase(FSW, SMW, phaseAngle)) finalPhase = sum(phaseMeas) / float(len(phaseMeas)) OutStr = ("%6.1f,%2d,%6.3f"%(DemodBW,phaseAngle*10,finalPhase)) OFile.write(OutStr) ############################################################################### ### Close Nicely ############################################################################### FSW.jav_Close() SMW.jav_Close()