Example #1
0
    def setUp(self):
        self.n_ports = 2
        self.wg = WG
        wg = self.wg
        self.Xf = wg.random(n_ports=2, name='Xf')
        self.Yf = wg.random(n_ports=2, name='Yf')

        #No leakage
        self.If = wg.match(n_ports=1, name='If')
        self.Ir = wg.match(n_ports=1, name='Ir')

        ideals = [
            wg.short(nports=2, name='short'),
            wg.open(nports=2, name='open'),
            wg.match(nports=2, name='load'),
            wg.random(2, name='rand1'),
            wg.random(2, name='rand2'),
        ]

        measured = [self.measure(k) for k in ideals]

        self.cal = TwoPortOnePath(
            ideals=ideals,
            measured=measured,
            source_port=1,
            #n_thrus=2,
        )
 def setUp(self):
     self.n_ports = 2
     self.wg = rf.RectangularWaveguide(rf.F(75,100,NPTS), a=100*rf.mil,z0=50)
     wg  = self.wg
     self.Xf = wg.random(n_ports =2, name = 'Xf')
     self.Yf = wg.random(n_ports =2, name='Yf')
     
     ideals = [
         wg.short(nports=2, name='short'),
         wg.open(nports=2, name='open'),
         wg.match(nports=2, name='load'),
         wg.thru(name='thru'),
         ]
     
 
     measured = [ self.measure(k) for k in ideals]
     
     self.cal = TwoPortOnePath(
         ideals = ideals,
         measured = measured,
         source_port=1,
         )
     self.cal2 = EnhancedResponse(
         ideals = ideals,
         measured = measured,
         source_port=1,
         )
Example #3
0
    def setUp(self):
        self.n_ports = 2
        self.wg =WG
        wg  = self.wg
        self.Xf = wg.random(n_ports =2, name = 'Xf')
        self.Yf = wg.random(n_ports =2, name='Yf')

        #No leakage
        self.If = wg.match(n_ports =1, name='If')
        self.Ir = wg.match(n_ports =1, name='Ir')
        
        
        ideals = [
            wg.short(nports=2, name='short'),
            wg.open(nports=2, name='open'),
            wg.match(nports=2, name='load'),
            wg.random(2,name='rand1'),
            wg.random(2,name='rand2'),
            ]
        
    
        measured = [ self.measure(k) for k in ideals]
        self.cal = TwoPortOnePath(
            ideals = ideals,
            measured = measured,
            source_port=1,
            #n_thrus=2,
            )
class TwoPortOnePathIsEnhancedResponseTest(unittest.TestCase):
    def setUp(self):
        self.n_ports = 2
        self.wg = rf.RectangularWaveguide(rf.F(75,100,NPTS), a=100*rf.mil,z0=50)
        wg  = self.wg
        self.Xf = wg.random(n_ports =2, name = 'Xf')
        self.Yf = wg.random(n_ports =2, name='Yf')
        
        ideals = [
            wg.short(nports=2, name='short'),
            wg.open(nports=2, name='open'),
            wg.match(nports=2, name='load'),
            wg.thru(name='thru'),
            ]
        
    
        measured = [ self.measure(k) for k in ideals]
        
        self.cal = TwoPortOnePath(
            ideals = ideals,
            measured = measured,
            source_port=1,
            )
        self.cal2 = EnhancedResponse(
            ideals = ideals,
            measured = measured,
            source_port=1,
            )
    def measure(self,ntwk):
        r= self.wg.random(2)
        m = ntwk.copy()
        mf = self.Xf**ntwk**self.Yf
        m.s[:,1,0] = mf.s[:,1,0]
        m.s[:,0,0] = mf.s[:,0,0]
        m.s[:,1,1] = r.s[:,1,1]
        m.s[:,0,1] = r.s[:,0,1]
        return m
        
    def test_equivalence(self):
        a = self.wg.random(n_ports=self.n_ports, name = 'actual')
        f = self.measure(a)
        
        c = self.cal.apply_cal(f)
        c2 = self.cal2.apply_cal(f)
        
        self.assertEqual(c,c2)        
Example #5
0
    def setUp(self):
        self.n_ports = 2
        self.wg = rf.RectangularWaveguide(rf.F(75, 100, NPTS), a=100 * rf.mil, z0=50)
        wg = self.wg
        self.Xf = wg.random(n_ports=2, name="Xf")
        self.Yf = wg.random(n_ports=2, name="Yf")

        ideals = [
            wg.short(nports=2, name="short"),
            wg.open(nports=2, name="open"),
            wg.match(nports=2, name="load"),
            wg.random(2, name="rand1"),
            wg.random(2, name="rand2"),
        ]

        measured = [self.measure(k) for k in ideals]

        self.cal = TwoPortOnePath(
            ideals=ideals,
            measured=measured,
            source_port=1,
            # n_thrus=2,
        )
class TwoPortOnePathTest(TwelveTermTest):
    def setUp(self):
        self.n_ports = 2
        self.wg = rf.RectangularWaveguide(rf.F(75,100,NPTS), a=100*rf.mil,z0=50)
        wg  = self.wg
        self.Xf = wg.random(n_ports =2, name = 'Xf')
        self.Yf = wg.random(n_ports =2, name='Yf')
        self.Xr = wg.random(n_ports =2, name = 'Xr')
        self.Yr = wg.random(n_ports =2, name='Yr')
        
        ideals = [
            wg.short(nports=2, name='short'),
            wg.open(nports=2, name='open'),
            wg.match(nports=2, name='load'),
            wg.random(2,name='rand1'),
            wg.random(2,name='rand2'),
            ]
        
    
        measured = [ self.measure(k) for k in ideals]
        
        self.cal = TwoPortOnePath(
            ideals = ideals,
            measured = measured,
            source_port=1,
            #n_thrus=2,
            )
    def measure(self,ntwk):
        r= self.wg.random(2)
        m = ntwk.copy()
        mf = self.Xf**ntwk**self.Yf
        
        m.s[:,1,0] = mf.s[:,1,0]
        m.s[:,0,0] = mf.s[:,0,0]
        m.s[:,1,1] = r.s[:,1,1]
        m.s[:,0,1] = r.s[:,0,1]
        return m
        
    def test_accuracy_of_dut_correction(self):
        a = self.wg.random(n_ports=self.n_ports, name = 'actual')
        f = self.measure(a)
        r = self.measure(a.flipped())
        c = self.cal.apply_cal((f,r))
        c.name = 'corrected'   
        self.assertEqual(c,a)
        
    def test_embed_then_apply_cal(self):
        
        a = self.wg.random(n_ports=self.n_ports)
        f = self.cal.embed(a)
        r = self.cal.embed(a.flipped())
        self.assertEqual(self.cal.apply_cal((f,r)),a)
        
    def test_embed_equal_measure(self):
        # measurment procedure is different so this test doesnt apply
        raise SkipTest()
    
    def test_from_coefs(self):
        cal_from_coefs = self.cal.from_coefs(self.cal.frequency, self.cal.coefs)
        ntwk = self.wg.random(n_ports=self.n_ports)
    
    def test_from_coefs_ntwks(self):
        cal_from_coefs = self.cal.from_coefs_ntwks(self.cal.coefs_ntwks)
    def test_reverse_source_match_accuracy(self):
        raise SkipTest()   
    
    def test_reverse_directivity_accuracy(self):
        raise SkipTest()      
    
    def test_reverse_load_match_accuracy(self):
        raise SkipTest()  
    
    def test_reverse_reflection_tracking_accuracy(self):
        raise SkipTest()  
    
    def test_reverse_transmission_tracking_accuracy(self):
        raise SkipTest()  
Example #7
0
class TwoPortOnePathTest(TwelveTermTest):
    @suppress_warning_decorator("divide by zero encountered in log10")
    @suppress_warning_decorator("n_thrus is None")
    def setUp(self):
        self.n_ports = 2
        self.wg = WG
        wg = self.wg
        self.Xf = wg.random(n_ports=2, name='Xf')
        self.Yf = wg.random(n_ports=2, name='Yf')

        #No leakage
        self.If = wg.match(n_ports=1, name='If')
        self.Ir = wg.match(n_ports=1, name='Ir')

        ideals = [
            wg.short(nports=2, name='short'),
            wg.open(nports=2, name='open'),
            wg.match(nports=2, name='load'),
            wg.random(2, name='rand1'),
            wg.random(2, name='rand2'),
        ]

        measured = [self.measure(k) for k in ideals]
        self.cal = TwoPortOnePath(
            ideals=ideals,
            measured=measured,
            source_port=1,
            #n_thrus=2,
        )

    def measure(self, ntwk):
        r = self.wg.random(2)
        m = ntwk.copy()
        mf = self.Xf**ntwk**self.Yf

        m.s[:, 1, 0] = mf.s[:, 1, 0]
        m.s[:, 0, 0] = mf.s[:, 0, 0]
        m.s[:, 1, 1] = r.s[:, 1, 1]
        m.s[:, 0, 1] = r.s[:, 0, 1]
        return m

    def test_accuracy_of_dut_correction(self):
        a = self.wg.random(n_ports=self.n_ports, name='actual')
        f = self.measure(a)
        r = self.measure(a.flipped())
        c = self.cal.apply_cal((f, r))
        c.name = 'corrected'
        self.assertEqual(c, a)

    def test_embed_then_apply_cal(self):
        a = self.wg.random(n_ports=self.n_ports)
        f = self.cal.embed(a)
        r = self.cal.embed(a.flipped())
        self.assertEqual(self.cal.apply_cal((f, r)), a)

    def test_embed_equal_measure(self):
        # measurment procedure is different so this test doesnt apply
        raise SkipTest()

    @suppress_warning_decorator("n_thrus is None")
    def test_from_coefs(self):
        cal_from_coefs = self.cal.from_coefs(self.cal.frequency,
                                             self.cal.coefs)
        ntwk = self.wg.random(n_ports=self.n_ports)

    @suppress_warning_decorator("n_thrus is None")
    def test_from_coefs_ntwks(self):
        cal_from_coefs = self.cal.from_coefs_ntwks(self.cal.coefs_ntwks)

    def test_reverse_source_match_accuracy(self):
        raise SkipTest()

    def test_reverse_directivity_accuracy(self):
        raise SkipTest()

    def test_reverse_load_match_accuracy(self):
        raise SkipTest()

    def test_reverse_reflection_tracking_accuracy(self):
        raise SkipTest()

    def test_reverse_transmission_tracking_accuracy(self):
        raise SkipTest()
Example #8
0
class TwoPortOnePathTest(TwelveTermTest):
    @suppress_warning_decorator("divide by zero encountered in log10")
    @suppress_warning_decorator("n_thrus is None")
    def setUp(self):
        self.n_ports = 2
        self.wg =WG
        wg  = self.wg
        self.Xf = wg.random(n_ports =2, name = 'Xf')
        self.Yf = wg.random(n_ports =2, name='Yf')

        #No leakage
        self.If = wg.match(n_ports =1, name='If')
        self.Ir = wg.match(n_ports =1, name='Ir')
        
        
        ideals = [
            wg.short(nports=2, name='short'),
            wg.open(nports=2, name='open'),
            wg.match(nports=2, name='load'),
            wg.random(2,name='rand1'),
            wg.random(2,name='rand2'),
            ]
        
    
        measured = [ self.measure(k) for k in ideals]
        self.cal = TwoPortOnePath(
            ideals = ideals,
            measured = measured,
            source_port=1,
            #n_thrus=2,
            )

    def measure(self,ntwk):
        r= self.wg.random(2)
        m = ntwk.copy()
        mf = self.Xf**ntwk**self.Yf
        
        m.s[:,1,0] = mf.s[:,1,0]
        m.s[:,0,0] = mf.s[:,0,0]
        m.s[:,1,1] = r.s[:,1,1]
        m.s[:,0,1] = r.s[:,0,1]
        return m

    def test_accuracy_of_dut_correction(self):
        a = self.wg.random(n_ports=self.n_ports, name = 'actual')
        f = self.measure(a)
        r = self.measure(a.flipped())
        c = self.cal.apply_cal((f,r))
        c.name = 'corrected'   
        self.assertEqual(c,a)
        
    def test_embed_then_apply_cal(self):
        a = self.wg.random(n_ports=self.n_ports)
        f = self.cal.embed(a)
        r = self.cal.embed(a.flipped())
        self.assertEqual(self.cal.apply_cal((f,r)),a)
        
    def test_embed_equal_measure(self):
        # measurment procedure is different so this test doesnt apply
        raise SkipTest()

    @suppress_warning_decorator("n_thrus is None")
    def test_from_coefs(self):
        cal_from_coefs = self.cal.from_coefs(self.cal.frequency, self.cal.coefs)
        ntwk = self.wg.random(n_ports=self.n_ports)
    
    @suppress_warning_decorator("n_thrus is None")
    def test_from_coefs_ntwks(self):
        cal_from_coefs = self.cal.from_coefs_ntwks(self.cal.coefs_ntwks)

    def test_reverse_source_match_accuracy(self):
        raise SkipTest()   
    
    def test_reverse_directivity_accuracy(self):
        raise SkipTest()      
    
    def test_reverse_load_match_accuracy(self):
        raise SkipTest()  
    
    def test_reverse_reflection_tracking_accuracy(self):
        raise SkipTest()  
    
    def test_reverse_transmission_tracking_accuracy(self):
        raise SkipTest()  
Example #9
0
class TwoPortOnePathTest(TwelveTermTest):
    def setUp(self):
        self.n_ports = 2
        self.wg = rf.RectangularWaveguide(rf.F(75, 100, NPTS), a=100 * rf.mil, z0=50)
        wg = self.wg
        self.Xf = wg.random(n_ports=2, name="Xf")
        self.Yf = wg.random(n_ports=2, name="Yf")

        ideals = [
            wg.short(nports=2, name="short"),
            wg.open(nports=2, name="open"),
            wg.match(nports=2, name="load"),
            wg.random(2, name="rand1"),
            wg.random(2, name="rand2"),
        ]

        measured = [self.measure(k) for k in ideals]

        self.cal = TwoPortOnePath(
            ideals=ideals,
            measured=measured,
            source_port=1,
            # n_thrus=2,
        )

    def measure(self, ntwk):
        r = self.wg.random(2)
        m = ntwk.copy()
        mf = self.Xf ** ntwk ** self.Yf

        m.s[:, 1, 0] = mf.s[:, 1, 0]
        m.s[:, 0, 0] = mf.s[:, 0, 0]
        m.s[:, 1, 1] = r.s[:, 1, 1]
        m.s[:, 0, 1] = r.s[:, 0, 1]
        return m

    def test_accuracy_of_dut_correction(self):
        a = self.wg.random(n_ports=self.n_ports, name="actual")
        f = self.measure(a)
        r = self.measure(a.flipped())
        c = self.cal.apply_cal((f, r))
        c.name = "corrected"
        self.assertEqual(c, a)

    def test_embed_then_apply_cal(self):

        a = self.wg.random(n_ports=self.n_ports)
        f = self.cal.embed(a)
        r = self.cal.embed(a.flipped())
        self.assertEqual(self.cal.apply_cal((f, r)), a)

    def test_embed_equal_measure(self):
        # measurment procedure is different so this test doesnt apply
        raise SkipTest()

    def test_from_coefs(self):
        cal_from_coefs = self.cal.from_coefs(self.cal.frequency, self.cal.coefs)
        ntwk = self.wg.random(n_ports=self.n_ports)

    def test_from_coefs_ntwks(self):
        cal_from_coefs = self.cal.from_coefs_ntwks(self.cal.coefs_ntwks)

    def test_reverse_source_match_accuracy(self):
        raise SkipTest()

    def test_reverse_directivity_accuracy(self):
        raise SkipTest()

    def test_reverse_load_match_accuracy(self):
        raise SkipTest()

    def test_reverse_reflection_tracking_accuracy(self):
        raise SkipTest()

    def test_reverse_transmission_tracking_accuracy(self):
        raise SkipTest()