Do you want to get started in biosignals feature extraction and analysis?
👉If yes, this article can be a good start for you.
It is very likely that you have an ECG data set or have just recorded an ECG signal, and don’t know what to do next. Now it is time to extract the features from the signal and interpret the data.
If you do not know how to acquire an ECG signal or what an ECG looks like, we suggest you take a step back and read our articles on ECG signal acquisition and ECG signal filtering (i.e. signal pre-processing).
The ECG signal plays an essential role in the diagnosis of various heart diseases, so it is very important to know how to interpret it correctly. Through mathematical models and programming techniques, it is possible to extract some signal features (i.e., parameters) and correlate them with human biology to make a biomedical and medical conclusion about cardiac function. There are several temporal and statistical parameters that can be analyzed when working with ECG signals.
Let us take a look at the main parameters analyzed in the clinical context, namely R-peak detection and heart rate variability (HRV).
✋How can I detect the R-peaks?
The detection of R peaks provides relevant information about overall cardiac health, and their detection is associated with the determination of cardiac cycle variability or heart rate variability (HRV). HRV is the variation (usually measured in milliseconds) between two heartbeats or the R-R interval, i.e., the interval between successive R peaks detected in the QRS complex, depending on the specific ECG lead being measure. An example of R - Peaks detection is illustrated below, where the green circles identify the R-peaks.
Open the next notebook to perform your first R-peak detection
Be aware that you have different algorithms that are embedded in different code sources and have different complexity. The notebook we have provided is an example of detecting R peaks in the ECG by applying the Pan-Tompkins algorithm (Pan & Tompkins, 1985).
✋Why are Heart Rate Variability (HRV) parameters so important?
Well, HRV parameters are indicators that can be measured to determine an individual's overall capacity to effectively adapt to social and environmental demands (Shaffer F., McCraty R., and Zerr C.L., 2014).
For example, at rest your body uses fewer resources (e.g., oxygen), your heart rate (HR) is low, and consequently it supplies a smaller amount of resources. Now imagine that you are late for work and need to hurry to leave. When you start running, rest is over, because your body definitely needs more resources (e.g. oxygen) to adapt to the hurried state. In this case, your heart rate is higher and it beats faster because it has to provide a larger amount of resources.
If you are healthy, your heart is capable of adapting to your body's needs in any situation, i.e., at rest and while running (during heavier physical exertion). Otherwise, if something is wrong with your heart, it will not be able to handle these changes. This is why it is so important to evaluate HRV when looking for abnormal heart symptoms in a patient.
There are some parameters you should consider when analyzing HRV. We have prepared a Python notebook to show how to approach HRV analysis with Python. To help you get started, we have provided some code snippets that cover a list of important HRV analysis parameters in both the time and frequency domains.
Open the next notebook to perform your first HRV analysis
✋What will I learn with this notebook?
In this notebook we will show you how to generate the following elements, for your ECG analysis:
is a structural element of the whole HRV analysis, i.e. the distribution of the R-R peak interval in a certain period of time. If you observe a high variability of the R-R peak interval, it means that your cardiovascular system is able to manage the environmental challenges;
Is the distribution of the duration of the R-R peak interval to better understand your heart health (i.e., you can consider a range of values between 0.6 and 1.2 seconds as a normal interval);
Power Spectral Density function:
Is the power spectrum representing the distribution of your HR frequency elements;
Is a scattergram by plotting each R-R peak interval against the previous one. This plot can be analyzed, for example by fitting an ellipse to the drawn shape. You can then extract some non-linear parameters from it;
The sequence of time parameters:
You will learn about the time parameters that a biomedical scientist looks at when analyzing an ECG, such as the minimum, maximum and average duration of RR intervals.
You now have a very basic idea of the hidden data in an ECG signal. You have also learned that ECG data can be represented in a variety of formats, both graphically and numerically.
However, applying mathematical algorithms to extract the relevant features from the signal can sometimes be very time-consuming and complex. For this reason, we have also invested our time in preparing some tools for our customers and users, namely HRV analysis software that can be used in conjunction with our OpenSignals platform.
We also encourage you to look at some open-source toolboxes for signal processing if you just want to analyze your collected ECG data without investing much time in signal processing.
Want more learning tips from us?
And that’s it, folks. Keep tuned, keep your heart beating p😎
If you’re getting started don’t forget to read: