Example #1
0
    def test_consecutive_index_all_equal(self):
        """Test for helper function to find consecutive index with identical numbers."""
        vec = np.array([1, 1, 1, 1, 1, 1])
        ref_inds = np.array([True, False, False, False, False, True], dtype=bool)

        inds = waveform._find_consecutive_index(vec, resolution=1e-6)

        np.testing.assert_array_equal(inds, ref_inds)
Example #2
0
    def test_consecutive_index_tiny_diff(self):
        """Test for helper function to find consecutive index with vector with tiny change."""
        eps = 1e-10
        vec = np.array([0.5, 0.5+eps, 0.5-eps, 0.5+eps, 0.5-eps, 0.5])
        ref_inds = np.array([True, False, False, False, False, True], dtype=bool)

        inds = waveform._find_consecutive_index(vec, resolution=1e-6)

        np.testing.assert_array_equal(inds, ref_inds)