@@ -486,9 +486,7 @@ def test_step_pole_cancellation(self, tsystem):
486486 @pytest .mark .parametrize (
487487 "tsystem, kwargs" ,
488488 [("siso_ss2" , {}),
489- ("siso_ss2" , {'X0' : 0 }),
490- ("siso_ss2" , {'X0' : np .array ([0 , 0 ])}),
491- ("siso_ss2" , {'X0' : 0 , 'return_x' : True }),
489+ ("siso_ss2" , {'return_x' : True }),
492490 ("siso_dtf0" , {})],
493491 indirect = ["tsystem" ])
494492 def test_impulse_response_siso (self , tsystem , kwargs ):
@@ -567,9 +565,9 @@ def test_initial_response_mimo(self, tsystem):
567565 yref = tsystem .yinitial
568566 yref_notrim = np .broadcast_to (yref , (2 , len (t )))
569567
570- _t , y_00 = initial_response (sys , T = t , X0 = x0 , input = 0 , output = 0 )
568+ _t , y_00 = initial_response (sys , T = t , X0 = x0 , output = 0 )
571569 np .testing .assert_array_almost_equal (y_00 , yref , decimal = 4 )
572- _t , y_11 = initial_response (sys , T = t , X0 = x0 , input = 0 , output = 1 )
570+ _t , y_11 = initial_response (sys , T = t , X0 = x0 , output = 1 )
573571 np .testing .assert_array_almost_equal (y_11 , yref , decimal = 4 )
574572 _t , yy = initial_response (sys , T = t , X0 = x0 )
575573 np .testing .assert_array_almost_equal (yy , yref_notrim , decimal = 4 )
@@ -874,7 +872,8 @@ def test_time_vector(self, tsystem, fun, squeeze):
874872 kw ['U' ] = np .vstack ([np .sin (t ) for i in range (sys .ninputs )])
875873 elif fun == forced_response and isctime (sys , strict = True ):
876874 pytest .skip ("No continuous forced_response without time vector." )
877- if hasattr (sys , "nstates" ) and sys .nstates is not None :
875+ if hasattr (sys , "nstates" ) and sys .nstates is not None and \
876+ fun != impulse_response :
878877 kw ['X0' ] = np .arange (sys .nstates ) + 1
879878 if sys .ninputs > 1 and fun in [step_response , impulse_response ]:
880879 kw ['input' ] = 1
@@ -1047,8 +1046,9 @@ def test_squeeze(self, fcn, nstate, nout, ninp, squeeze, shape1, shape2):
10471046 _ , yvec , xvec = ct .initial_response (
10481047 sys , tvec , 1 , squeeze = squeeze , return_x = True )
10491048 assert xvec .shape == (sys .nstates , 8 )
1050- else :
1051- _ , yvec = ct .initial_response (sys , tvec , 1 , squeeze = squeeze )
1049+ elif isinstance (sys , TransferFunction ):
1050+ with pytest .warns (UserWarning , match = "may not be consistent" ):
1051+ _ , yvec = ct .initial_response (sys , tvec , 1 , squeeze = squeeze )
10521052 assert yvec .shape == shape2
10531053
10541054 # Forced response (only indexed by output)
@@ -1090,7 +1090,11 @@ def test_squeeze(self, fcn, nstate, nout, ninp, squeeze, shape1, shape2):
10901090 if squeeze is not True or sys .ninputs > 1 or sys .noutputs > 1 :
10911091 assert yvec .shape == (sys .noutputs , sys .ninputs , 8 )
10921092
1093- _ , yvec = ct .initial_response (sys , tvec , 1 )
1093+ if isinstance (sys , TransferFunction ):
1094+ with pytest .warns (UserWarning , match = "may not be consistent" ):
1095+ _ , yvec = ct .initial_response (sys , tvec , 1 )
1096+ else :
1097+ _ , yvec = ct .initial_response (sys , tvec , 1 )
10941098 if squeeze is not True or sys .noutputs > 1 :
10951099 assert yvec .shape == (sys .noutputs , 8 )
10961100
0 commit comments