@@ -1648,7 +1648,9 @@ def test_interconnect_unused_output():
16481648 outputs = ['u' ],
16491649 name = 'k' )
16501650
1651- with pytest .warns (UserWarning , match = r"Unused output\(s\) in InterconnectedSystem:" ) as record :
1651+ with pytest .warns (
1652+ UserWarning ,
1653+ match = r"Unused output\(s\) in InterconnectedSystem:" ) as record :
16521654 h = ct .interconnect ([g ,s ,k ],
16531655 inputs = ['r' ],
16541656 outputs = ['y' ])
@@ -1679,13 +1681,17 @@ def test_interconnect_unused_output():
16791681 pytest .fail (f'Unexpected warning: { r .message } ' )
16801682
16811683 # warn if explicity ignored output in fact used
1682- with pytest .warns (UserWarning , match = r"Output\(s\) specified as ignored is \(are\) used:" ):
1684+ with pytest .warns (
1685+ UserWarning ,
1686+ match = r"Output\(s\) specified as ignored is \(are\) used:" ):
16831687 h = ct .interconnect ([g ,s ,k ],
16841688 inputs = ['r' ],
16851689 outputs = ['y' ],
16861690 ignore_outputs = ['dy' ,'u' ])
16871691
1688- with pytest .warns (UserWarning , match = r"Output\(s\) specified as ignored is \(are\) used:" ):
1692+ with pytest .warns (
1693+ UserWarning ,
1694+ match = r"Output\(s\) specified as ignored is \(are\) used:" ):
16891695 h = ct .interconnect ([g ,s ,k ],
16901696 inputs = ['r' ],
16911697 outputs = ['y' ],
@@ -1697,3 +1703,25 @@ def test_interconnect_unused_output():
16971703 inputs = ['r' ],
16981704 outputs = ['y' ],
16991705 ignore_outputs = ['v' ])
1706+
1707+ def test_nonuniform_timepts ():
1708+ """Test non-uniform time points for simulations"""
1709+ sys = ct .LinearIOSystem (ct .rss (2 , 1 , 1 ))
1710+
1711+ # Start with a uniform set of times
1712+ unifpts = [0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ]
1713+ uniform = [1 , 2 , 3 , 2 , 1 , - 1 , - 3 , - 5 , - 7 , - 3 , 1 ]
1714+ t_unif , y_unif = ct .input_output_response (sys , unifpts , uniform )
1715+
1716+ # Create a non-uniform set of inputs
1717+ noufpts = [0 , 2 , 4 , 8 , 10 ]
1718+ nonunif = [1 , 3 , 1 , - 7 , 1 ]
1719+ t_nouf , y_nouf = ct .input_output_response (sys , noufpts , nonunif )
1720+
1721+ # Make sure the outputs agree at common times
1722+ np .testing .assert_almost_equal (y_unif [noufpts ], y_nouf , decimal = 6 )
1723+
1724+ # Resimulate using a new set of evaluation points
1725+ t_even , y_even = ct .input_output_response (
1726+ sys , noufpts , nonunif , t_eval = unifpts )
1727+ np .testing .assert_almost_equal (y_unif , y_even , decimal = 6 )
0 commit comments