Ejemplo n.º 1
0
 def test_peak_type_error(self):
     with assert_raises_regexp(AssertionError,
                               'The `extrema` argument must be one'):
         out = tstoolbox.peak_detection(method='sine',
                                        points=9,
                                        input_ts=self.ats,
                                        print_input=True,
                                        extrema='booth')
     with assert_raises_regexp(AssertionError,
                               'The `method` argument must be one'):
         out = tstoolbox.peak_detection(method='sin',
                                        points=9,
                                        input_ts=self.ats,
                                        print_input=True,
                                        extrema='both')
Ejemplo n.º 2
0
 def test_peak_rel_direct(self):
     """Test peak detection API using the default method."""
     out = tstoolbox.peak_detection(input_ts=self.ats,
                                    print_input=True,
                                    extrema="both")
     self.maxDiff = None
     assert_frame_equal(out, self.compare)
Ejemplo n.º 3
0
 def test_peak_rel_direct(self):
     """Test peak detection API using the default method."""
     out = tstoolbox.peak_detection(input_ts=self.ats,
                                    print_input=True,
                                    extrema='both')
     self.maxDiff = None
     assert_frame_equal(out, self.compare)
Ejemplo n.º 4
0
    def test_peak_type_error(self):
        with pytest.raises(ValueError) as e_info:
            _ = tstoolbox.peak_detection(method='sine',
                                         points=9,
                                         input_ts=self.ats,
                                         print_input=True,
                                         extrema='booth')

        assert 'The `extrema` argument must be one' in str(e_info.value)
        with pytest.raises(ValueError) as e_info:
            _ = tstoolbox.peak_detection(method='sin',
                                         points=9,
                                         input_ts=self.ats,
                                         print_input=True,
                                         extrema='both')
        assert 'The `method` argument must be one' in str(e_info.value)
Ejemplo n.º 5
0
 def test_peak_sine_direct(self):
     """Test peak detection API using the 'sine' method."""
     out = tstoolbox.peak_detection(method="sine",
                                    points=9,
                                    input_ts=self.ats,
                                    print_input=True,
                                    extrema="both")
     self.maxDiff = None
     assert_frame_equal(out, self.compare)
Ejemplo n.º 6
0
 def test_peak_minmax_direct(self):
     """Test peak detection API using the minmax method."""
     out = tstoolbox.peak_detection(method='minmax',
                                    window=3,
                                    input_ts=self.ats,
                                    print_input=True,
                                    extrema='both')
     self.maxDiff = None
     assert_frame_equal(out, self.compare)
Ejemplo n.º 7
0
 def test_peak_minmax_direct(self):
     ''' Test peak detection API using the minmax method.
     '''
     out = tstoolbox.peak_detection(method='minmax',
                                    window=3,
                                    input_ts=self.ats,
                                    print_input=True,
                                    extrema='both')
     self.maxDiff = None
     assert_frame_equal(out, self.compare)
Ejemplo n.º 8
0
    def test_peak_type_error(self):
        with pytest.raises(ValueError) as e_info:
            _ = tstoolbox.peak_detection(
                method="sine",
                points=9,
                input_ts=self.ats,
                print_input=True,
                extrema="booth",
            )

        assert 'The argument "extrema" should be one' in str(e_info.value)
        with pytest.raises(ValueError) as e_info:
            _ = tstoolbox.peak_detection(
                method="sin",
                points=9,
                input_ts=self.ats,
                print_input=True,
                extrema="both",
            )
        assert 'The argument "method" should be one' in str(e_info.value)
Ejemplo n.º 9
0
 def test_peak_zero_crossing_direct(self):
     """Test peak detection API using the zero_crossing method."""
     out = tstoolbox.peak_detection(
         method="zero_crossing",
         window=3,
         input_ts=self.ats,
         print_input=True,
         extrema="both",
     )
     self.maxDiff = None
     assert_frame_equal(out, self.compare)
Ejemplo n.º 10
0
 def test_peak_zero_crossing_direct(self):
     """Test peak detection API using the zero_crossing method."""
     out = tstoolbox.peak_detection(method='zero_crossing',
                                    window=3,
                                    input_ts=self.ats,
                                    print_input=True,
                                    extrema='both')
     self.maxDiff = None
     fp = open('/tmp/tslog3.txt', 'w')
     fp.write('{0}'.format(out))
     fp.write('\n')
     fp.write('{0}'.format(self.compare))
     fp.close()
     assert_frame_equal(out, self.compare)
Ejemplo n.º 11
0
 def test_peak_zero_crossing_direct(self):
     ''' Test peak detection API using the zero_crossing method.
     '''
     out = tstoolbox.peak_detection(method='zero_crossing',
                                    window=3,
                                    input_ts=self.ats,
                                    print_input=True,
                                    extrema='both')
     self.maxDiff = None
     fp = open('/tmp/tslog3.txt', 'w')
     fp.write('{0}'.format(out))
     fp.write('\n')
     fp.write('{0}'.format(self.compare))
     fp.close()
     assert_frame_equal(out, self.compare)