def test_conversion(self): #Check the conversion functions s = ZerosPolesGain(1, 2, 3) assert_(isinstance(s.to_ss(), StateSpace)) assert_(isinstance(s.to_tf(), TransferFunction)) assert_(isinstance(s.to_zpk(), ZerosPolesGain)) # Make sure copies work assert_(ZerosPolesGain(s) is not s) assert_(s.to_zpk() is not s)
def test_properties(self): # Test setters/getters for cross class properties. # This implicitly tests to_ss() and to_tf() # Getters s = ZerosPolesGain(0, 1, 1) assert_equal(s.num, [1, 0]) assert_equal(s.den, [1, -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 = ZerosPolesGain([2], [6], 3) s2.A = 1 s2.B = 1 s2.C = 1 s2.D = 1 self._compare_systems(s, s2) # tf setters s2 = ZerosPolesGain([2], [5], 3) s2.num = [1, 0] s2.den = [1, -1] self._compare_systems(s, s2)
def test_initialization(self): # Check that all initializations work s = ZerosPolesGain(1, 1, 1) s = ZerosPolesGain([1], [2], 1) s = ZerosPolesGain(np.array([1]), np.array([2]), 1)