def test_heart_rate_power(self): window_data = window_sliding(self.rr_intervals.data, window_size=120, window_offset=60) test_window = list(window_data.items())[0] power, frequency_range = lomb(test_window[1], low_frequency=0.01, high_frequency=0.7) hr_hf = heart_rate_power(power, frequency_range, 0.15, 0.4) self.assertAlmostEqual(hr_hf, 14.143026468160871, delta=0.01)
def test_lomb(self): window_data = window_sliding(self.rr_intervals.data, window_size=120, window_offset=60) test_window = list(window_data.items())[0] result, frequency_range = lomb(test_window[1], low_frequency=0.01, high_frequency=0.7) self.assertAlmostEqual(result[0], 37.093948304468618, delta=0.01) self.assertEqual(frequency_range[-1], 0.7)