def _load_ictal_raw(self): self.f = h5py.File('ictal_file.hdf5', 'w') # only going to load a ndf with max of two seizures in it - will fail with three! for i in xrange(self.annotations.shape[0]): #for i in xrange(1): fname = self.annotations.iloc[i, 0] start = self.annotations.iloc[i, 1] end = self.annotations.iloc[i, 2] print fname, end, start ndf = NDFLoader(self.dir_path + 'ndf/' + fname, print_meta=True) ndf.load(8) ndf.glitch_removal(plot_glitches=False, print_output=True) ndf.correct_sampling_frequency() np.set_printoptions(precision=3, suppress=True) ictal_time = ndf.time[(ndf.time >= start) & (ndf.time <= end)] ictal_data = ndf.data[(ndf.time >= start) & (ndf.time <= end)] #print ictal_data.shape[0] #print ictal_time.shape try: self.fname_dset = self.f.create_dataset( fname, (ictal_data.shape[0], 2), dtype='float') except: self.fname_dset = self.f.create_dataset( fname + '_' + str(2), (ictal_data.shape[0], 2), dtype='float') self.fname_dset[:, 0] = ictal_time self.fname_dset[:, 1] = ictal_data