Ejemplo n.º 1
0
    def test_properties(self):
        # Test setters/getters for cross class properties.
        # This implicitly tests to_ss() and to_zpk()

        # Getters
        s = TransferFunction([1, 0], [1, -1], dt=0.05)
        assert_equal(s.poles, [1])
        assert_equal(s.zeros, [0])
        with warnings.catch_warnings():
            warnings.simplefilter("ignore", DeprecationWarning)
            assert_equal(s.gain, 1)
            assert_equal(s.A, 1)
            assert_equal(s.B, 1)
            assert_equal(s.C, 1)
            assert_equal(s.D, 1)

        # state space setters
        s2 = TransferFunction([2, 3], [4, 5], dt=0.05)
        with warnings.catch_warnings():
            warnings.simplefilter("ignore", DeprecationWarning)
            s2.A = 1
            s2.B = 1
            s2.C = 1
            s2.D = 1
            self._compare_systems(s, s2)

        # zpk setters
        s2 = TransferFunction([2, 3], [4, 5], dt=0.05)
        with warnings.catch_warnings():
            warnings.simplefilter("ignore", DeprecationWarning)
            s2.poles = 1
            s2.zeros = 0
            s2.gain = 1
            self._compare_systems(s, s2)
Ejemplo n.º 2
0
    def test_properties(self):
        # Test setters/getters for cross class properties.
        # This implicitly tests to_ss() and to_zpk()

        # Getters
        s = TransferFunction([1, 0], [1, -1], dt=0.05)
        assert_equal(s.poles, [1])
        assert_equal(s.zeros, [0])
        with warnings.catch_warnings():
            warnings.simplefilter("ignore", DeprecationWarning)
            assert_equal(s.gain, 1)
            assert_equal(s.A, 1)
            assert_equal(s.B, 1)
            assert_equal(s.C, 1)
            assert_equal(s.D, 1)

        # state space setters
        s2 = TransferFunction([2, 3], [4, 5], dt=0.05)
        with warnings.catch_warnings():
            warnings.simplefilter("ignore", DeprecationWarning)
            s2.A = 1
            s2.B = 1
            s2.C = 1
            s2.D = 1
            self._compare_systems(s, s2)

        # zpk setters
        s2 = TransferFunction([2, 3], [4, 5], dt=0.05)
        with warnings.catch_warnings():
            warnings.simplefilter("ignore", DeprecationWarning)
            s2.poles = 1
            s2.zeros = 0
            s2.gain = 1
            self._compare_systems(s, s2)