I have never used the *.GDF format before, but if you are a Matlab/Octave user, there should be functions under the Biosig toolbox http://biosig.sourceforge.net/ that allow you to extract signals from files in that format.
Once you have your ECG signal, you can use the HRV toolkit https://sleepdata.org/tools/physionet-hrv-toolkit to perform HRV analysis. I also like this toolset: http://www.robots.ox.ac.uk/~gari/CODE/ECGtools/ for Matlab if you prefer.
I hope this helps!
I ran your same code using the function blockEdfLoad.m from here: https://github.com/DennisDean/BlockEdfLoad/blob/master/blockEdfLoad.m
and I obtain:
tranducer_type: 'ARES Insight Computed Signal'
Signal min: 0
Signal max: 6
Signal unique values:
I believe the function you used, (link: https://github.com/nsrr/edf-viewer) is an older version. Thank you for identifying the bug! We will make sure we update it. Please let us know if you find any further problems.
I am not entirely sure I understand your question correctly.
If the discontinuities you are mentioning are in the file itself, say, the sensor comes off, the recording is paused, and then it goes back on, so you have a gap in time in the signal, I have never encountered such a case for biomedical data. Usually if the electrode comes off you have just flat/no signal/noise for a certain time, or the recording is interrupted, the file is saved, and then a new file is recorded.
Also, an EDF can only contain a single time-stamp in the header (start of recording), so it wouldn’t seem possible to have an actual gap of time “in the middle” (so to speak) of a recording.
If instead you are asking, in a signal, how to detect the portions where the electrode came off or recording stops, then there are some signal processing techniques you could try, like power-based or entropy-based analysis to find noise/flat signal.
Please let us know if we can be of any help!
the model used was Nonin XPOD 3011. Although we were not able to find the exact specifics of that one, we did find the specifics of its "low power" version XPOD 3011LP, which we could reasonably assume would be the same? If that was the case, there would have been the option to average over 4 or 8 beats. This means that if 4 beats was chosen, and assuming a heart rate of 60 bpm, the delay would be 4 seconds. Also, looking at the power spectrum of the signal, a lowpass filter with a ~4 s window does look plausible. Let me know if this makes sense!
yours is a very good question, thank you for pointing out one of the "flaws" of the SHHS data. I do not know of other versions of the SHHS with different parameters, although I have noticed a certain heterogeneity in the signals quality, so you might find that some are more usable than others. As pointed out by collaborators who are familiar with this dataset, the SHHS was not originally collected with very advanced EEG analysis in mind, and the high-pass filter is applied at recording, causing a loss of the slow oscillations in the power spectrum. This, however, should not have affected the visual scoring, as the scoring rules are thresholded at 75 microvolts and the scoring does not care if the signals overwhelms the channel width.
I hope this is of help to you, and that you can still make use of other features of this database, e.g. the spindle power or other bands.
Dear fellow members of the NSRR Community,
The Complex Signals Core is an outreach project of the NHLBI-sponsored National Sleep Research Resource (NSRR) grant. As part of this effort, we are inaugurating a series of seminars with the aim of bringing HMS community members and others interested in the analysis, interpretation, and translational applications of biomedical signals.
The first of a series of seminars/workshops will be held on August 31st 2016 at 1 pm in the Zinner Board Room at Brigham and Women's Hospital, situated at 70 Francis Street, Boston, MA, 02115.
Ary L. Goldberger, MD, Professor of Medicine, HMS and Director, Margret and H.A. Rey Institute for Nonlinear Dynamics in Physiology and Medicine, BIDMC will talk on:
“Complex Signals in Sleep Medicine Seminar: Is the Heartbeat a Solo or Ensemble Player?”
The talk will be followed by a round-table discussion.
Please RSVP to Sara Mariani (firstname.lastname@example.org) if you would like to attend. Also if you would like to forward this on to colleagues, please do so.
Madalena D. Costa, PhD (Signals Core Director)
Sara Mariani, PhD, Daniel R. Mobley, RPSGT (Signals Core Coordinators)
Ary L. Goldberger, MD (Signals Core Faculty)
Susan Redline, MD, MPH (Signals Core Founder and NSRR, PI)
to answer your first question, yes, the EDF files contain a heart rate signal, that is named HR in SHHS1 and PR is SHHS2, is interpolated and sampled at 1 Hz and is in beats per minute (bpm).
To answer your second question, I believe there could be a mistake in the code you are using to open the EDF files, because I do not see these extreme values. The data are stored in double, not int16 format. I suggest you give our tool for reading EDF files a try: https://sleepdata.org/tools/block-edf-loader, it is very quick and easy to use.
Let us know how it goes!
SpectralTrainFig "wants" matched pairs of EDF and XML files for it to run. For example, if your EDF is named myfile.EDF and your corresponding XML file with the annotations is named myfile.XML, in the GUI you will have to select -XML in the "XML suffix" field. The XML annotation file is necessary because it contains the sleep stages, which the function needs to compute the summaries and plot the figures.
Assuming you have those annotations in a different format, you could try to write your own XML file using a function like this: http://www.mathworks.com/matlabcentral/fileexchange/28639-struct2xml. However, I do not know what your EDF files look like and I am not 100% sure the toolbox will work for your data, as different sleep scoring softwares generate EDF files with different header format.
If you are only interested in the artifact detection and epoch-by-epoch spectral analysis part, you will find the related code in lines ~888-1100 of the subfunction SpectralTrainClass.m, which you can apply to your data once you load them with the function BlockEdfLoadClass.m.
I hope this helps!
Hi! A possible solution, if you are happy with having a single Matlab file, would be using the short function I wrote for you and saved here:
after adding the following two Matlab functions to your directory:
It will save a Matlab struct file with one field per channel, plus one field named PSGAnnotation, which contains all the annotation events in its subfields. Let us know if this works for you.