def main(): logging.basicConfig(filename="heart_rate_monitor.log", level=logging.INFO, format='%(asctime)s %(levelname)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p') logging.info('STARTED') file_to_read = input("Input a filename to read: ") times, voltages = load_csv(file_to_read) if times == 1 and voltages == 1: print("Error: File not found. Please try again.") return 1 else: times = amend_missing_data(times) voltages = amend_missing_data(voltages) metrics = create_and_fill_dict(times, voltages) convert_to_json(metrics, file_to_read) logging.info('FINISHED')
from analyze_data import beat_in_interval import pytest from fileReader import load_csv times, voltages = load_csv('./test_data/test_data1.csv') @pytest.mark.parametrize("times, voltage, end_interval, interval, expected", [ (times, voltages, 1.75, 0.5, False), (times, voltages, 1.25, 0.5, 1.028), ]) def test_beat_in_interval(times, voltage, end_interval, interval, expected): beat_result = beat_in_interval(times, voltage, end_interval, interval) assert beat_result == expected
def test_load_csv_voltage(candidate, index, expected): times, voltage = load_csv(candidate) assert voltage[index] == expected