def read_edf(cls, path): raise NotImplementedError # TODO: adapt # the following is copied from elsewhere and won't work as is import pyedflib with pyedflib.EdfReader(str(path)) as f: labels = f.getSignalLabels() for label in labels: index = labels.index(label) wav = Wave(f.readSignal(index), f.getSampleFrequency(index)) wav.label = label wav.path = f.with_name(f.stem + "-" + label + ".wav") wav.min = f.getPhysicalMinimum(index) wav.max = f.getPhysicalMaximum(index) wav.unit = f.getPhysicalDimension(index)
def read_xdf(cls, path): raise NotImplementedError import openxdf # TODO: below is a place holder and needs to be finalize xdf = openxdf.OpenXDF(path) signals = openxdf.Signal(xdf, path.with_suffix(".nkamp")) # TODO: automate this, why are the xdf.header names different from signals.list_channels? for label in ["ECG", "Chin"]: # logger.info(f'reading {label} channel') sig = signals.read_file(label)[label] wav = Wave(sig.ravel(), 200) wav.label = label # wav.path = file.with_name(file.stem + '-' + label + '.wav') wav.min = -3200 wav.max = 3200 wav.unit = "1"