Thursday, August 8, 2019

Analysis of Hexoskin binary RR interval and respiratory .wav data

The Hexoskin device has been discussed on this blog may times over the past year.  It is capable of accelerometry,  single lead ECG, as well as measuring thoracic and abdominal respiration.  Usually the extracted data is downloaded as a .csv file containing the processed final output such as heart rate, total ventilation rate and motion.  However, there may be times when you would like to see the actual raw recordings of each parameter.  Initially, I felt this was too difficult to do but on a closer look, it is fairly easy.  In addition, looking at or analyzing the raw data may provide you with insights not possible from the processed totals.  This post will review how to download, sort through, process and display the raw "binary" files from the Hexoskin web site.

Let's start with the download:
Go to the "record" of the session of interest on the Hexoskin website and choose download.  The type of file is "binary".

After downloading the zip file, open it.  This is a listing of the contents:

I have highlighted the files of interest.
The activity.wav will give us an idea of where the intervals are to align with a cycling power record.  The ECG_1 is the single lead ECG, respiration_thoracic and abdominal are the raw records of each part of the ventilation data.

RR intervals
As reviewed in the last post, the Hexoskin is a great method to get artifact free ECG tracings for HRV studies.  Here is a tutorial how to get the RR intervals into Kubios.

Start by extracting then opening the RR_interval file in a spreadsheet program:
We have - time (in seconds column A) and a strange number in column B.  The number in B needs to be divided by 256 to get the proper RR interval.  
From the Hexoskin api (ignore the typo 205/256 - it should be 207/256):
You also need to delete the first row with a zero in column B.

Then create a function (see the post on data processing) to divide by 256:

Then copy and paste the formula the entire way down to the last value to get a full RR output computation (remember to delete the row with a zero in it):



Getting this into Kubios:
Open Kubios, select "open file" but don't choose anything yet.  We will need to open our file of course but must alert Kubios to handle this output appropriately.

  
Here is the open dialog of Kubios and yes, I want to open the RR_interval file but make sure you choose "Custom ASCI file" in the drop down menu just above the open button (in yellow).

When you open the file (Custom ASCI file) the Kubios gives you options on where each data field is:

With the way we saved the RR_interval file, the time is column 1 and the RR intervals are column 3.  The time units are in seconds.
After the correct choices are made we are ready to open:
Here we go.  I did highlight (in yellow) an artifact during the selected interval (in blue, top).  Notice the DFA a1 complexity shift on the bottom panel as discussed in the last post.

Wav files
Some of the Hexoskin files are presented as .wav records.  Before getting too overwhelmed with yet another format, recall that a .wav file is simply a lossless method of audio recording.  So these files should be able to be visualized by any software designed to display audio signals.  A good free software tool that I will use is called Audacity.  Download and install it before the next step.

Raw activity data.
The activity file is helpful to see where in time the interval occurred.  We can eventually match this up with power intervals.

Open Audacity and open the activity.wav file from the binary download.
This is what it will look like:

Right now it's not much to look at.  First drag the bottom window bar to the bottom of the page to expand the view.

Next, we need to magnify the signal and zoom in the time for a more realistic look:

Right clicking in the left axis will zoom the amplitude of the wave and pressing the + button on top (in red) will zoom time.

Here I have zoomed to my 3 minute interval:




With a further zoom gets even better definition:
We also want to get the time of the interval, look at the time display at the bottom (in yellow):

We will need this time to review and analyze the respiratory and raw ECG data.


ECG raw:
Open the ECG_1 file from the binary download in Audacity:
The tracing will seem pretty worthless when first opened -

Remember to drag the window down to the bottom of the page, right click the Left axis to amplify the signal and then click the zoom button on the top menu bar.

Here is what the raw ECG looks like at full cycling power during my selected interval:
  • The R waves are quite sharp, relatively free of noise with no artifacts.

Here is a section of the ride when I was cruising at low power.  The waveform is so clean the P, QRS and T waves are well delineated:

This type of detail could be helpful in looking at RR interval quality, arrhythmias and even ischemic changes (to some extent).


Abdominal and thoracic respiration:
Extract the abdominal and thoracic wav files from the binary zip.  Open them as in the examples above and increase the signal amplitude.
Here is an example of the abdominal wav file. The large dark area in the middle is the interval I'm interested in.


If I drag over the area of interest and select the expand selection tool, the area is zoomed to the window width:

 We then have a nice look at the interval's abdominal motion:
  •  Each cycle up and down is one inhalation - exhalation cycle.

Amplitude of each sub-unit of the respiratory cycle:
There may be times when comparing the abdominal vs thoracic portion of total ventilation may be desired.  To do this we need some index of wave amplitude.  Here is a simple rough measurement technique.
We are able to get an idea of the wave amplitude if we treat it like an audio signal.  There is an Audacity plugin called ACX that will calculate the peak and RMS amplitude of a chosen selection.  You will need to download the ACX plugin and place it in the Plugin folder of Audacity (c:/program files/audacity/plugins).

Here is a measurement of the RMS/peak of the 30 seconds after a one minute max effort for instance:
I have installed the ACX plugin, and triggered the analysis by choosing it under the Analyze menu (in red).  The RMS, peak are in yellow.

Zooming in further shows each respiratory cycle in greater detail:


Is this of any benefit?
On that subject, I'm not sure yet.  I did go back to look at some 3 minute VO2 peak intervals done before and after starting abdominal strength training to see if the ratio of thoracic to abdominal motion was altered.  Here is a listing of the RMS of every 30 seconds during the 3 minute intervals of both abdominal and thoracic motion files:

As you can see the percent of abdominal to total motion is remarkably stable from 10/8/18 to 8//19.  Although my diaphragm strength is substantially better and there is an improvement in lactate threshold testing, I don't see a difference in this particular metric.
However, if you have an interest in thoracic and abdominal respiratory testing, the above method may be of some use. 

Summary:
  • The raw binary files of the Hexoskin system can be used for multiple purposes.
  • These include RR interval quality, ECG waveform review, activity timestamping, separate abdominal and thoracic respiratory motion.
  • RR intervals need to be converted to be read by Kubios.
  • Wav files are readable in Audacity.
  • Signal RMS and peak strength can be roughly measured by the ACX plugin.
  • The usefulness of separate abdominal and thoracic motion analysis is something to think about.


2 comments:

  1. I have a question. Why does my Hexoskin vest show a recording duration of 58:46, but after importing the data into Kubios HRV Scientific, it displays 58:36? Additionally, when I export the Kubios results in CSV format, the first recorded time is 00:01:05, and the end time is 57:40. Could you explain why this is happening? I would really appreciate your help. Thank you!

    ReplyDelete
  2. I'm not sure why the times are off by 10 secs, but that should not matter to the calculations much. If you are selecting Kubios measurement windows of 2 minutes, then the first "time varying" data will be at 1 minute, since it time stamps the center of the window. That same window (0 to 2 min) will be the same as the manually selected interval ending at 2 min.

    ReplyDelete