Python wrapper for CallibriECG library
Project description
Mathematical library for working with ECG data from the Callibri sensor.
The main functionality is the calculation of cardio-interval lengths, heart rate and Stress Index (SI).
During the first 10 seconds, the algorithm is trained if it is not found in the signal. 5 RR intervals, the training is repeated. In the future, work with the library takes place iteratively (adding new data, calculating indicators).
Initialization
Determine the basic parameters
- Raw signal sampling frequency. Integer type. The allowed values are 250 or 1000.
- Data processing window size. Integer type. Valid values of sampling_rate / 4 or sampling_rate / 2.
- Number of windows to calculate SI. Integer type. Allowable values [20...50].
- The averaging parameter of the IN calculation. Default value is 6.
- Network frequency. Integer type. Default value is 50Hz. Available values 50Hz or 60Hz.
Creating a library instance
Firstly you need to determine parameters and then put them to library. Tne next step is initialize the filters. In the current version the filters are built-in and clearly defined: Butterworth 2nd order BandPass 5_15 Hz.
You can initialize averaging for SI calculation. It is optional value.
# 1. Raw signal sampling frequency
samplingRate = 250
# 2. Data processing window size
dataWindow = samplingRate / 2
# 3. Number of windows to calculate SI
nwinsForPressureIndex = 30
callibri_math = CallibriMath(samplingRate, dataWindow, nwinsForPressureIndex)
callibri_math.init_filter()
# optional
# 4. The averaging parameter of the IN calculation. Default value is 6.
pressureIndexAverage = 6
callibri_math.set_pressure_average(pressureIndexAverage)
# optional
# 5. Your network frequency: 50Hz or 60Hz
callibri_math.set_network_frequency(NetworkFrequency.Hz50)
Initializing a data array for transfer to the library:
The size of the transmitted array has to be of a certain length:
- 25 values for a signal frequency of 250 Hz
- 100 values for a signal frequency of 1000 Hz
rawData = [float(x) for x in range(25)]
# or
rawData = [float(x) for x in range(100)]
Optional functions (not necessary for the library to work)
Check for initial signal corruption. This method should be used if you want to detect and notify of a distorted signal explicitly.
if callibri_math.initial_signal_corrupted():
# Signal corrupted!!!
Work with the library
- Adding and process data:
callibri_math.push_and_process_data(samples)
- Getting the results:
if callibri_math.rr_detected():
# check for a new peak in the signal
# RR-interval length
rr = math.get_rr()
# HR
hr = math.get_hr()
# last RP index
rpIdx = math.get_last_rpeak_idx()
# SI
pi = math.get_pressure_index()
# Moda
moda = math.get_moda()
# Amplitude of mode
amplModa = math.get_ampl_moda()
# Variation range
variationDist = math.get_variation_dist()
callibri_math.set_rr_checked()
Finishing work with the library:
del callibri_math
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file pycallibri_ecg-1.0.3.tar.gz.
File metadata
- Download URL: pycallibri_ecg-1.0.3.tar.gz
- Upload date:
- Size: 392.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2bb49816197cbaaf91aade3a5208ef80731609758a48deebd71a1bc127b9dad
|
|
| MD5 |
aaa8b99fe54ab722447dc269b64683d8
|
|
| BLAKE2b-256 |
2389d826d30d3ea97ad389dee5ca6ebf1d452f54d2cd8327f3b5d401ecd2ac2d
|