def get_data(self, state_of_interest=None, start=None, end=None, duration=None): sampling_rate, X = recording.get_data(self, state_of_interest, start, end, duration, self.channelindices) return sampling_rate, np.dot(np.transpose(self.mixer[0]), X) # X[derivation, time] if __name__ == "__main__": import pylab md5 = read_md5(filename="../../../example/md5sum.txt") dx = derivation('../../../example/sample.edf', '../../../example/sample.mtg', md5checksum=md5) samplingrate, x = dx.get_data(start=0., duration=100.) t = np.arange(x.shape[1])/float(samplingrate) for i in xrange(x.shape[0]): pylab.plot(t, x[i]-30.*i) pylab.show()
except: print("Module test impossible:") print("Critical files not available.") print("File necessary :\n%s\n%s\n%s" % (sample_edf, sample_score, sample_md5)) print("exiting ..") exit(-1) ### print("\n###############") print("TEST : read_md5") print("###############\n") try: md5sum = read_md5(filename=sample_md5) print(TEST_PASSED) except: print(TEST_FAILED) print("#####################") print("TEST : edf_hdr_struct") print("#####################\n") #hdr = edf_hdr_struct.edf_hdr_struct(filename=sample_edf, md5checksum=md5sum['sample.edf']) #print(hdr.read_physical_samples([0], 0, 10)) #exit(0) try: hdr = edf_hdr_struct.edf_hdr_struct(filename=sample_edf, md5checksum=md5sum['sample.edf']) print("Some samples :", hdr.read_physical_samples([0], 0, 10))