def test_strictly_proper(self, strictly_proper): """Test that the strictly_proper argument returns a correct D.""" for i in range(100): # The probability that drss(..., strictly_proper=False) returns an # all zero D 100 times in a row is 0.5**100 = 7.89e-31 sys = rss(1, 1, 1, strictly_proper=strictly_proper) if np.all(sys.D == 0.) == strictly_proper: break assert np.all(sys.D == 0.) == strictly_proper
def test_latex_repr_testsize(editsdefaults): # _repr_latex_ returns None when size > maxsize from control import set_defaults maxsize = defaults['statesp.latex_maxsize'] nstates = maxsize // 2 ninputs = maxsize - nstates noutputs = ninputs assert nstates > 0 assert ninputs > 0 g = rss(nstates, ninputs, noutputs) assert isinstance(g._repr_latex_(), str) set_defaults('statesp', latex_maxsize=maxsize - 1) assert g._repr_latex_() is None set_defaults('statesp', latex_maxsize=-1) assert g._repr_latex_() is None gstatic = ss([], [], [], 1) assert gstatic._repr_latex_() is None
def test_pole(self, states, outputs, inputs): """Test that the poles of rss outputs have a negative real part.""" sys = rss(states, outputs, inputs) p = sys.poles() for z in p: assert z.real < 0
def test_shape(self, states, outputs, inputs): """Test that rss outputs have the right state, input, and output size.""" sys = rss(states, outputs, inputs) assert sys.nstates == states assert sys.ninputs == inputs assert sys.noutputs == outputs