How to use the pyedflib.data function in pyEDFlib

To help you get started, we’ve selected a few pyEDFlib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github holgern / pyedflib / demo / plotEDFFile.py View on Github external
#!/usr/bin/env python
from __future__ import division, print_function, absolute_import

import numpy as np

import pyedflib


from stacklineplot import stackplot


if __name__ == '__main__':
    f = pyedflib.data.test_generator()
    n = f.signals_in_file
    signal_labels = f.getSignalLabels()

    sigbufs = np.zeros((n, f.getNSamples()[0]))
    for i in np.arange(n):
        sigbufs[i, :] = f.readSignal(i)

    f._close()
    del f
    # stackplot(sigbufs,seconds=10.0, start_time=0.0, ylabels=signal_labels)

    stackplot(sigbufs[:, :2000], ylabels=signal_labels)
github holgern / pyedflib / demo / readEDFFile.py View on Github external
#!/usr/bin/env python
from __future__ import division, print_function, absolute_import

import os
import numpy as np

import pyedflib


if __name__ == '__main__':
    f = pyedflib.data.test_generator()
    print("\nlibrary version: %s" % pyedflib.version.version)

    print("\ngeneral header:\n")

    # print("filetype: %i\n"%hdr.filetype);
    print("edfsignals: %i" % f.signals_in_file)
    print("file duration: %i seconds" % f.file_duration)
    print("startdate: %i-%i-%i" % (f.getStartdatetime().day,f.getStartdatetime().month,f.getStartdatetime().year))
    print("starttime: %i:%02i:%02i" % (f.getStartdatetime().hour,f.getStartdatetime().minute,f.getStartdatetime().second))
    # print("patient: %s" % f.getP);
    # print("recording: %s" % f.getPatientAdditional())
    print("patientcode: %s" % f.getPatientCode())
    print("gender: %s" % f.getGender())
    print("birthdate: %s" % f.getBirthdate())
    print("patient_name: %s" % f.getPatientName())
    print("patient_additional: %s" % f.getPatientAdditional())