Giter VIP home page Giter VIP logo

bme590hrm's Introduction

Heart Rate Monitor Module Build Status

heart_rate_monitor.py is a module housing the HeartRateMonitor class. This class accepts a path to a local CSV file that contains time, voltage pairs.

Test data is housed in test_data/test_data1.csv

More test data can be found here.

HeartRateMonitor class analyzes the ECG input signal and creates the following attributes:

  • mean_hr_bpm: average heart rate over a user specified number of minutes (defaults to average rate over entire CSV). Users can update this value by calling the HeartRateMonitor.calc_mean_hr_bpm(start_ts, end_ts) method.
  • voltage_extremes: tuple of min and max lead voltages. Format (min_voltage, max_voltage)
  • duration: duration of the ECG data
  • num_beats: number of detected beats in ECG data
  • beats: numpy array of times when beats occurred

Upon successful creation of a HeartRateMonitor class instance, a JSON file with the above attributes is saved in the output_json_files directory. The JSON file will have the same name as the source CSV file test_data.csv -> test_data.json

Creating an instance of the HeartRateMonitor class

First, ensure that you're in a virtual environment and have installed all of the packages listed in requirements.txt. More information on virtual environement here.

Import the class:

from heart_rate_monitor import HeartRateMonitor

Next, create an instance of the class (and pass in a local CSV):

a = HeartRateMonitor('test_data/test_data1.csv')

Notice that a JSON file with the attributes described above has been created in the output_json_files directory.

Additionally, users can access any of the attributes within their python code like so:

ecg_duration = a.duration

For a complete list of available attributes, see the documentation.

Extra features

Users can generate plots of the raw ECG data and the detected heart beats using:

HeartRateMonitor.plot_ecg_and_beats()

Example plot:

plot.png

Mac OSX Users Note:

The matplotlib doesn't work well with all virtual environments. If you're seeing errors, please make sure that you're using venv instead of virtualenv to create your virtual environment. More here.

Note on peak detection

Signal processing is NOT my strong suit. To detect peaks in ECG data, I'm using the peakutils python module. Documentation can be found here.

Logging

Detailed logs can be found in the logs directory.

Documentation

Documentation can be found here.

Travis CI

Status: Build Status

bme590hrm's People

Contributors

vertikoff avatar

Watchers

James Cloos avatar  avatar Suyash Kumar avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.