Add Testcase for testing impulse response is pure dirac for perfect transmission line
@@ -92,6 +92,24 @@ class NetworkTestCase(unittest.TestCase):
self.assertEqual(len(y), num_points)
self.assertTrue(npy.isclose(t[1] - t[0], tps))
+ def test_impulse_response_dirac(self):
+ """
+ Test if the impulse response of a perfect transmission line is pure Dirac
+ """
+ f_points = 10
+ freq = rf.Frequency.from_f(npy.arange(f_points), unit='Hz')
+ s = npy.ones(10)
+ netw = rf.Network(frequency=freq, s=s)
+
+ n_lst = npy.arange(-1,2) + 2 * (f_points) - 2
+ for n in n_lst:
+ t,y = netw.impulse_response('boxcar', n=n)
+
+ y_true = npy.zeros_like(y)
+ y_true[t == 0] = 1
+ npy.testing.assert_almost_equal(y, y_true)
+
+
def test_time_transform_nonlinear_f(self):
netw_nonlinear_f = rf.Network(os.path.join(self.test_dir, 'ntwk_arbitrary_frequency.s2p'))
with self.assertRaises(NotImplementedError):
