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
Metadata
Release files for pycallibri-ecg 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pycallibri_ecg-1.0.3.tar.gz | 392.3 kB | Without provenance | Details for pycallibri_ecg-1.0.3.tar.gz |
Release files / pycallibri_ecg-1.0.3.tar.gz
| Download URL | pycallibri_ecg-1.0.3.tar.gz |
|---|---|
| Size | 392.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b2bb49816197cbaaf91aade3a5208ef80731609758a48deebd71a1bc127b9dad
|
|
BLAKE2b-256 checksum How to use checksums |
2389d826d30d3ea97ad389dee5ca6ebf1d452f54d2cd8327f3b5d401ecd2ac2d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|
Security for pycallibri-ecg 1.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.