def test_dtype(self):
        imp = waveforms.unit_impulse(7)
        assert_(np.issubdtype(imp.dtype, np.floating))

        imp = waveforms.unit_impulse(5, 3, dtype=int)
        assert_(np.issubdtype(imp.dtype, np.integer))

        imp = waveforms.unit_impulse((5, 2), (3, 1), dtype=complex)
        assert_(np.issubdtype(imp.dtype, np.complexfloating))
Ejemplo n.º 2
0
    def test_dtype(self):
        imp = waveforms.unit_impulse(7)
        assert_(np.issubdtype(imp.dtype, np.floating))

        imp = waveforms.unit_impulse(5, 3, dtype=int)
        assert_(np.issubdtype(imp.dtype, np.integer))

        imp = waveforms.unit_impulse((5, 2), (3, 1), dtype=complex)
        assert_(np.issubdtype(imp.dtype, np.complexfloating))
    def test_index(self):
        assert_array_equal(waveforms.unit_impulse(10, 3),
                           [0, 0, 0, 1, 0, 0, 0, 0, 0, 0])
        assert_array_equal(waveforms.unit_impulse((3, 3), (1, 1)),
                           [[0, 0, 0], [0, 1, 0], [0, 0, 0]])

        # Broadcasting
        imp = waveforms.unit_impulse((4, 4), 2)
        assert_array_equal(
            imp,
            np.array([[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 1, 0], [0, 0, 0, 0]]))
Ejemplo n.º 4
0
    def test_index(self):
        assert_array_equal(waveforms.unit_impulse(10, 3),
                           [0, 0, 0, 1, 0, 0, 0, 0, 0, 0])
        assert_array_equal(waveforms.unit_impulse((3, 3), (1, 1)),
                           [[0, 0, 0], [0, 1, 0], [0, 0, 0]])

        # Broadcasting
        imp = waveforms.unit_impulse((4, 4), 2)
        assert_array_equal(imp, np.array([[0, 0, 0, 0],
                                          [0, 0, 0, 0],
                                          [0, 0, 1, 0],
                                          [0, 0, 0, 0]]))
 def test_mid(self):
     assert_array_equal(waveforms.unit_impulse((3, 3), 'mid'),
                        [[0, 0, 0], [0, 1, 0], [0, 0, 0]])
     assert_array_equal(waveforms.unit_impulse(9, 'mid'),
                        [0, 0, 0, 0, 1, 0, 0, 0, 0])
 def test_no_index(self):
     assert_array_equal(waveforms.unit_impulse(7), [1, 0, 0, 0, 0, 0, 0])
     assert_array_equal(waveforms.unit_impulse((3, 3)),
                        [[1, 0, 0], [0, 0, 0], [0, 0, 0]])
Ejemplo n.º 7
0
 def test_mid(self):
     assert_array_equal(waveforms.unit_impulse((3, 3), 'mid'),
                        [[0, 0, 0], [0, 1, 0], [0, 0, 0]])
     assert_array_equal(waveforms.unit_impulse(9, 'mid'),
                        [0, 0, 0, 0, 1, 0, 0, 0, 0])
Ejemplo n.º 8
0
 def test_no_index(self):
     assert_array_equal(waveforms.unit_impulse(7), [1, 0, 0, 0, 0, 0, 0])
     assert_array_equal(waveforms.unit_impulse((3, 3)),
                        [[1, 0, 0], [0, 0, 0], [0, 0, 0]])