def testConversion_readChannel(self): #loadFiles() print("Reading the .sig file...") readerSIG = HarmonieReader(os.path.join(parentdir, "test.SIG")) print("Saving a copy in the BDF format...") readerSIG.saveAsEDF(os.path.join(parentdir, "test.bdf"), "BDF", annotationFileName=os.path.join( parentdir, "test Annotations.bdf")) print("Reading the saved BDF file...") readerEDF = EDFReader(os.path.join(parentdir, "test.bdf"), annotationFileName=os.path.join( parentdir, "test Annotations.bdf")) channelListSig = readerSIG.getChannelLabels() channelListEdf = readerEDF.getChannelLabels() for channelSig, channelEdf in zip(channelListSig, channelListEdf): data1 = readerSIG.readChannel(channelSig, False) Y1 = data1.signal T1 = readerSIG.getChannelTime(channelSig) #fsSIG = data.samplingRate data2 = readerEDF.readChannel(channelEdf) Y2 = data2.signal T2 = readerEDF.getChannelTime(channelEdf) #fsEDF = data.samplingRate print(("1:", np.mean(abs(Y1)), np.mean(abs(Y2))))
def testDoubleDetection(self): fpath = parentdir #u'C:/DATA/Vickie_spindles/' fileName = "/test.bdf" #'PETCHn1.bdf' channels = ["C4-A1"] print("Converting .sig file to .bdf file...") readerSIG = HarmonieReader(fpath + fileName[:-3] + 'SIG') readerSIG.saveAsEDF(fpath + fileName, "BDF", verbose=False) reader = EDFReader(fpath + fileName) data = reader.readChannel(channels[0], usePickled=False) signal = data.signal print(signal[[1, 100, 200, 300, 400, 500]]) data = reader.readChannel(channels[0], usePickled=False) signal = data.signal print(signal[[1, 100, 200, 300, 400, 500]])