Exemple #1
0
 def test_signal_edges(self):
     """Test if correct behavior on signal edges."""
     x1 = np.array([1., 0, 2])
     assert_equal(_argmaxima1d(x1), np.array([]))
     x2 = np.array([3., 3, 0, 4, 4])
     assert_equal(_argmaxima1d(x2), np.array([]))
     x3 = np.array([5., 5, 5, 0, 6, 6, 6])
     assert_equal(_argmaxima1d(x3), np.array([]))
Exemple #2
0
 def test_signal_edges(self):
     """Test if correct behavior on signal edges."""
     x1 = np.array([1., 0, 2])
     assert_equal(_argmaxima1d(x1), np.array([]))
     x2 = np.array([3., 3, 0, 4, 4])
     assert_equal(_argmaxima1d(x2), np.array([]))
     x3 = np.array([5., 5, 5, 0, 6, 6, 6])
     assert_equal(_argmaxima1d(x3), np.array([]))
Exemple #3
0
 def test_simple(self):
     """Test with simple signal."""
     x = np.linspace(-10, 10, 50)
     x[2::3] += 1
     maxima = _argmaxima1d(x)
     assert_equal(maxima, np.arange(2, 50, 3))
     assert_(maxima.base is None)
Exemple #4
0
 def test_simple(self):
     """Test with simple signal."""
     x = np.linspace(-10, 10, 50)
     x[2::3] += 1
     maxima = _argmaxima1d(x)
     assert_equal(maxima, np.arange(2, 50, 3))
     assert_(maxima.base is None)
Exemple #5
0
 def test_exceptions(self):
     """Test input validation and raised exceptions."""
     with raises(ValueError, match="wrong number of dimensions"):
         _argmaxima1d(np.ones((1, 1)))
     with raises(ValueError, match="expected 'float64_t'"):
         _argmaxima1d(np.ones(1, dtype=int))
     with raises(TypeError, match="list"):
         _argmaxima1d([1., 2.])
     with raises(TypeError, match="'x' must not be None"):
         _argmaxima1d(None)
Exemple #6
0
 def test_exceptions(self):
     """Test input validation and raised exceptions."""
     with raises(ValueError, match="wrong number of dimensions"):
         _argmaxima1d(np.ones((1, 1)))
     with raises(ValueError, match="expected 'float64_t'"):
         _argmaxima1d(np.ones(1, dtype=int))
     with raises(TypeError, match="list"):
         _argmaxima1d([1., 2.])
     with raises(TypeError, match="'x' must not be None"):
         _argmaxima1d(None)
Exemple #7
0
 def test_empty(self):
     """Test with empty signal."""
     x = np.array([], dtype=np.float64)
     maxima = _argmaxima1d(x)
     assert_equal(maxima, np.array([]))
     assert_(maxima.base is None)
Exemple #8
0
 def test_flat_maxima(self):
     """Test if flat maxima are detected correctly."""
     x = np.array([-1.3, 0, 1, 0, 2, 2, 0, 3, 3, 3, 0, 4, 4, 4, 4, 0, 5])
     maxima = _argmaxima1d(x)
     assert_equal(maxima, np.array([2, 4, 8, 12]))
     assert_(maxima.base is None)
Exemple #9
0
 def test_signal_edges(self, x):
     """Test if correct behavior on signal edges."""
     maxima = _argmaxima1d(x)
     assert_equal(maxima, np.array([]))
     assert_(maxima.base is None)
Exemple #10
0
 def test_simple(self):
     """Test with simple signal."""
     x = np.linspace(-10, 10, 50)
     x[2::3] += 1
     assert_equal(_argmaxima1d(x), np.arange(2, 50, 3))
Exemple #11
0
 def test_flat_maxima(self):
     """Test if flat maxima are detected correctly."""
     x = np.array([-1.3, 0, 1, 0, 2, 2, 0, 3, 3, 3, 0, 4, 4, 4, 4, 0, 5])
     maxima = _argmaxima1d(x)
     assert_equal(maxima, np.array([2, 4, 8, 12]))
     assert_(maxima.base is None)
Exemple #12
0
 def test_linear(self):
     """Test with linear signal."""
     x = np.linspace(0, 100)
     assert_equal(_argmaxima1d(x), np.array([]))
Exemple #13
0
 def test_linear(self):
     """Test with linear signal."""
     x = np.linspace(0, 100)
     maxima = _argmaxima1d(x)
     assert_equal(maxima, np.array([]))
     assert_(maxima.base is None)
Exemple #14
0
 def test_linear(self):
     """Test with linear signal."""
     x = np.linspace(0, 100)
     maxima = _argmaxima1d(x)
     assert_equal(maxima, np.array([]))
     assert_(maxima.base is None)
Exemple #15
0
 def test_signal_edges(self, x):
     """Test if correct behavior on signal edges."""
     maxima = _argmaxima1d(x)
     assert_equal(maxima, np.array([]))
     assert_(maxima.base is None)
Exemple #16
0
 def test_empty(self):
     """Test with empty signal."""
     x = np.array([], dtype=np.float64)
     assert_equal(_argmaxima1d(x), np.array([]))
Exemple #17
0
 def test_simple(self):
     """Test with simple signal."""
     x = np.linspace(-10, 10, 50)
     x[2::3] += 1
     assert_equal(_argmaxima1d(x), np.arange(2, 50, 3))
Exemple #18
0
 def test_linear(self):
     """Test with linear signal."""
     x = np.linspace(0, 100)
     assert_equal(_argmaxima1d(x), np.array([]))
Exemple #19
0
 def test_empty(self):
     """Test with empty signal."""
     x = np.array([], dtype=np.float64)
     maxima = _argmaxima1d(x)
     assert_equal(maxima, np.array([]))
     assert_(maxima.base is None)
Exemple #20
0
 def test_empty(self):
     """Test with empty signal."""
     x = np.array([], dtype=np.float64)
     assert_equal(_argmaxima1d(x), np.array([]))