Example #1
0
    def test_adaptive_orient(self):
        """Test an adaptive orientation averaging case
        """
        tm = TMatrix(axi=2.0, lam=6.5, m=complex(1.5,0.5), eps=1.0/0.6,
            suppress_warning=True)
        tm.or_pdf = orientation.gaussian_pdf(20.0)
        tm.orient = orientation.orient_averaged_adaptive
        (S, Z) = tm.get_SZ()
        
        S_ref = np.array(
            [[complex(6.49005717e-02, -2.42488000e-01), 
              complex(-6.12697676e-16, -4.10602248e-15)],
             [complex(-1.50048180e-14, -1.64195485e-15), 
              complex(-9.54176591e-02, 2.84758322e-01)]])

        Z_ref = np.array(
            [[7.89677648e-02, -1.37631854e-02, -7.45412599e-15, 
             -9.23979111e-20],
            [-1.37631854e-02, 7.82165256e-02, 5.61975938e-15,
             -1.32888054e-15],
            [8.68047418e-15, 3.52110917e-15, -7.73358177e-02,
             5.14571155e-03],
            [1.31977116e-19, -3.38136420e-15, -5.14571155e-03, 
             -7.65845784e-02]])

        test_relative(self, S, S_ref)
        test_relative(self, Z, Z_ref)               
Example #2
0
    def test_single(self):
        """Test a single-orientation case
        """
        tm = TMatrix(axi=2.0, lam=6.5, m=complex(1.5,0.5), eps=1.0/0.6,
            suppress_warning=True)
        (S, Z) = tm.get_SZ()

        S_ref = np.array(
            [[complex(3.89338755e-02, -2.43467777e-01),
              complex(-1.11474042e-24, -3.75103868e-24)],
             [complex(1.11461702e-24, 3.75030914e-24),
              complex(-8.38637654e-02, 3.10409912e-01)]])

        Z_ref = np.array(
            [[8.20899248e-02, -2.12975199e-02, -1.94051304e-24,
              2.43057373e-25],
            [-2.12975199e-02, 8.20899248e-02, 2.00801268e-25,
             -1.07794906e-24],
            [1.94055633e-24, -2.01190190e-25, -7.88399525e-02,
             8.33266362e-03],
            [2.43215306e-25,  -1.07799010e-24,  -8.33266362e-03,
             -7.88399525e-02]])

        test_relative(self, S, S_ref)
        test_relative(self, Z, Z_ref)
Example #3
0
    def test_fixed_orient(self):
        """Test a fixed-point orientation averaging case
        """
        tm = TMatrix(axi=2.0, lam=6.5, m=complex(1.5,0.5), eps=1.0/0.6,
            suppress_warning=True)
        tm.or_pdf = orientation.gaussian_pdf(20.0)
        tm.orient = orientation.orient_averaged_fixed
        (S, Z) = tm.get_SZ()
        
        S_ref = np.array(
            [[complex(6.49006090e-02, -2.42487917e-01),
              complex(1.20257317e-11, -5.23022168e-11)],
             [complex(6.21754594e-12, 2.95662844e-11),
              complex(-9.54177082e-02, 2.84758158e-01)]])

        Z_ref = np.array(
            [[7.89748116e-02, -1.37649947e-02, -1.58053610e-11, 
                -4.56295798e-12],
             [-1.37649947e-02, 7.82237468e-02, -2.85105399e-11,
                -3.43475094e-12],
             [2.42108565e-11, -3.92054806e-11, -7.73426425e-02,
                5.14654926e-03],
             [4.56792369e-12, -3.77838854e-12, -5.14654926e-03,
                -7.65915776e-02]])

        test_relative(self, S, S_ref)
        test_relative(self, Z, Z_ref)
Example #4
0
    def test_single(self):
        """Test a single-orientation case
        """
        tm = TMatrix(axi=2.0,
                     lam=6.5,
                     m=complex(1.5, 0.5),
                     eps=1.0 / 0.6,
                     suppress_warning=True)
        (S, Z) = tm.get_SZ()

        S_ref = np.array([[
            complex(3.89338755e-02, -2.43467777e-01),
            complex(-1.11474042e-24, -3.75103868e-24)
        ],
                          [
                              complex(1.11461702e-24, 3.75030914e-24),
                              complex(-8.38637654e-02, 3.10409912e-01)
                          ]])

        Z_ref = np.array([
            [8.20899248e-02, -2.12975199e-02, -1.94051304e-24, 2.43057373e-25],
            [-2.12975199e-02, 8.20899248e-02, 2.00801268e-25, -1.07794906e-24],
            [1.94055633e-24, -2.01190190e-25, -7.88399525e-02, 8.33266362e-03],
            [
                2.43215306e-25, -1.07799010e-24, -8.33266362e-03,
                -7.88399525e-02
            ]
        ])

        test_relative(self, S, S_ref)
        test_relative(self, Z, Z_ref)
Example #5
0
    def test_fixed_orient(self):
        """Test a fixed-point orientation averaging case
        """
        tm = TMatrix(axi=2.0,
                     lam=6.5,
                     m=complex(1.5, 0.5),
                     eps=1.0 / 0.6,
                     suppress_warning=True)
        tm.or_pdf = orientation.gaussian_pdf(20.0)
        tm.orient = orientation.orient_averaged_fixed
        (S, Z) = tm.get_SZ()

        S_ref = np.array([[
            complex(6.49006090e-02, -2.42487917e-01),
            complex(1.20257317e-11, -5.23022168e-11)
        ],
                          [
                              complex(6.21754594e-12, 2.95662844e-11),
                              complex(-9.54177082e-02, 2.84758158e-01)
                          ]])

        Z_ref = np.array([[
            7.89748116e-02, -1.37649947e-02, -1.58053610e-11, -4.56295798e-12
        ], [-1.37649947e-02, 7.82237468e-02, -2.85105399e-11, -3.43475094e-12],
                          [
                              2.42108565e-11, -3.92054806e-11, -7.73426425e-02,
                              5.14654926e-03
                          ],
                          [
                              4.56792369e-12, -3.77838854e-12, -5.14654926e-03,
                              -7.65915776e-02
                          ]])

        test_relative(self, S, S_ref)
        test_relative(self, Z, Z_ref)
Example #6
0
    def test_adaptive_orient(self):
        """Test an adaptive orientation averaging case
        """
        tm = TMatrix(axi=2.0,
                     lam=6.5,
                     m=complex(1.5, 0.5),
                     eps=1.0 / 0.6,
                     suppress_warning=True)
        tm.or_pdf = orientation.gaussian_pdf(20.0)
        tm.orient = orientation.orient_averaged_adaptive
        (S, Z) = tm.get_SZ()

        S_ref = np.array([[
            complex(6.49005717e-02, -2.42488000e-01),
            complex(-6.12697676e-16, -4.10602248e-15)
        ],
                          [
                              complex(-1.50048180e-14, -1.64195485e-15),
                              complex(-9.54176591e-02, 2.84758322e-01)
                          ]])

        Z_ref = np.array([[
            7.89677648e-02, -1.37631854e-02, -7.45412599e-15, -9.23979111e-20
        ], [-1.37631854e-02, 7.82165256e-02, 5.61975938e-15, -1.32888054e-15],
                          [
                              8.68047418e-15, 3.52110917e-15, -7.73358177e-02,
                              5.14571155e-03
                          ],
                          [
                              1.31977116e-19, -3.38136420e-15, -5.14571155e-03,
                              -7.65845784e-02
                          ]])

        test_relative(self, S, S_ref)
        test_relative(self, Z, Z_ref)