@@ -1648,7 +1648,9 @@ def test_interconnect_unused_output():
1648
1648
outputs = ['u' ],
1649
1649
name = 'k' )
1650
1650
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 :
1652
1654
h = ct .interconnect ([g ,s ,k ],
1653
1655
inputs = ['r' ],
1654
1656
outputs = ['y' ])
@@ -1679,13 +1681,17 @@ def test_interconnect_unused_output():
1679
1681
pytest .fail (f'Unexpected warning:{ r .message } ' )
1680
1682
1681
1683
# 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:" ):
1683
1687
h = ct .interconnect ([g ,s ,k ],
1684
1688
inputs = ['r' ],
1685
1689
outputs = ['y' ],
1686
1690
ignore_outputs = ['dy' ,'u' ])
1687
1691
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:" ):
1689
1695
h = ct .interconnect ([g ,s ,k ],
1690
1696
inputs = ['r' ],
1691
1697
outputs = ['y' ],
@@ -1697,3 +1703,25 @@ def test_interconnect_unused_output():
1697
1703
inputs = ['r' ],
1698
1704
outputs = ['y' ],
1699
1705
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 )