def test_refines_multiple_peaks_bad_annotations_numpy_arrays(self):

        time = np.linspace(0, 4 * np.pi, 200)
        signal = np.sin(time)

        res = signals.refine_signal_peaks(
            time, signal, [np.array([[25]]), 50,
                           np.array([75]), 125, 150])
        exp = [
            {
                'peak_value': 1.0,
                'peak_index': 25,
                'peak_start_index': 0,
                'peak_end_index': 68,
                'total_wave_time': 4.29,
            },
            {
                'peak_value': 1.0,
                'peak_index': 125,
                'peak_start_index': 81,
                'peak_end_index': 167,
                'total_wave_time': 5.43,
            },
        ]
        assert len(res) == len(exp)
        for res_stats, exp_stats in zip(res, exp):
            for key, val in exp_stats.items():
                assert round(res_stats[key], 2) == round(exp_stats[key],
                                                         2), key
    def test_refines_empty_list(self):

        time = np.linspace(0, 2 * np.pi, 100)
        signal = np.sin(time)

        res = signals.refine_signal_peaks(time, signal, [])
        assert res == []
    def test_refines_single_peak_bad_annotation(self):

        time = np.linspace(0, 2 * np.pi, 100)
        signal = np.sin(time)

        res = signals.refine_signal_peaks(time, signal, [25, 50])
        assert len(res) == 1
        res = res[0]
        exp = {
            'peak_value': 1.0,
            'peak_index': 25,
            'peak_start_index': 0,
            'peak_end_index': 68,
            'total_wave_time': 4.32,
        }
        for key, val in exp.items():
            assert round(res[key], 2) == round(exp[key], 2), key