def drawGraph(filename): data = stfio.read(filename) img_filename = filename.rsplit('.',1) print img_filename clamp = data[0][0] voltage = data[0][2] limit = data[0][0].asarray().shape[0] time = np.arange(0.0, limit, 1.0) * data.dt STIM = -1 stim = [] stim_t = [] for i in range(len(voltage)): if(voltage[i]>0.2): stim.append(STIM) stim_t.append(time[i]) #print time[i] fig = plt.figure(figsize=(10,4),dpi=400) plt.plot(time,clamp,'k',linewidth=0.5,color="#3d3d3d") #plt.plot(time,voltage,'r') fig.patch.set_alpha(0.0) plt.axis('off') plt.plot(stim_t,stim,'k',linewidth=8) img_filename="%s.png"%(img_filename[0]) print img_filename plt.savefig(img_filename)
def testWrite(self): """ testWrite() Returns False if file format to write is not supported""" # should raise an StfException if filetype is not supported rec = stfio.read('test.h5') res = rec.write('new.abf', 'abf') self.assertEquals(False, res)
def read_2channel_ATF(filename, current_factor=1, voltage_factor=1): rec = stfio.read(filename) rec.current = [ rec[0][k].asarray() * current_factor for k in range(0, len(rec[0]), 2) ] rec.voltage = [ rec[0][k].asarray() * voltage_factor for k in range(1, len(rec[0]), 2) ] return rec
def testReadH5(self): """ testReadH5() Read HDF5 file system """ try: rec = stfio.read('test.h5') except SyntaxError: rec = None # test if Recording object was created self.assertTrue(True, isinstance(rec, stfio.Recording))
def read(self, _FILENAME_): self.rec = stfio.read(_FILENAME_) self.volt = self.rec[0][0] self.volt = np.array(self.volt) self.stim = self.rec[0][2] self.steps= self.rec[0][0].asarray().shape[0] self.dt = self.rec.dt self.time = np.arange(0.0,self.steps,1.0)*self.dt """
def loadTraces(self): record = stfio.read(self.abfFile) time_scale_factor = 0.001 samp_rate= 1/(record.dt*time_scale_factor) #time_start = 0 #time_end = sum([len(record[0][i]) for i in xrange(len(record[0]))])*record.dt #self.times = np.arange(time_start,time_end,record.dt)*time_scale_factor #print self.times.size section_idx = xrange(len(record[0]))
def foo(): abf_file = 'data4/16n15003 0196 N1 ACSF baseline.abf' rec = stfio.read(abf_file) data = np.array(rec[0]) print data.shape for i in range(data.shape[0]): mpl.plot(data[i, :]) mpl.show()
def read_block(self, lazy=False, cascade=True): if self.filename is not None: self.stfio_rec = stfio.read(self.filename) bl = Block() bl.description = self.stfio_rec.file_description bl.annotate(comment=self.stfio_rec.comment) try: bl.rec_datetime = self.stfio_rec.datetime except: bl.rec_datetime = None if not cascade: return bl dt = np.round(self.stfio_rec.dt * 1e-3, 9) * pq.s # ms to s sampling_rate = 1.0 / dt t_start = 0 * pq.s # iterate over sections first: for j, recseg in enumerate(self.stfio_rec[0]): seg = Segment(index=j) length = len(recseg) # iterate over channels: for i, recsig in enumerate(self.stfio_rec): name = recsig.name unit = recsig.yunits try: pq.Quantity(1, unit) except: unit = '' if lazy: signal = pq.Quantity([], unit) else: signal = pq.Quantity(recsig[j], unit) anaSig = AnalogSignal(signal, sampling_rate=sampling_rate, t_start=t_start, name=str(name), channel_index=i) if lazy: anaSig.lazy_shape = length seg.analogsignals.append(anaSig) bl.segments.append(seg) t_start = t_start + length * dt bl.create_many_to_one_relationship() return bl
def read_block(self, lazy=False, cascade=True): if self.filename is not None: self.stfio_rec = stfio.read(self.filename) bl = Block() bl.description = self.stfio_rec.file_description bl.annotate(comment=self.stfio_rec.comment) try: bl.rec_datetime = self.stfio_rec.datetime except: bl.rec_datetime = None if not cascade: return bl dt = np.round(self.stfio_rec.dt * 1e-3, 9) * pq.s # ms to s sampling_rate = 1.0/dt t_start = 0 * pq.s # iterate over sections first: for j, recseg in enumerate(self.stfio_rec[0]): seg = Segment(index=j) length = len(recseg) # iterate over channels: for i, recsig in enumerate(self.stfio_rec): name = recsig.name unit = recsig.yunits try: pq.Quantity(1, unit) except: unit = '' if lazy: signal = pq.Quantity([], unit) else: signal = pq.Quantity(recsig[j], unit) anaSig = AnalogSignal(signal, sampling_rate=sampling_rate, t_start=t_start, name=str(name), channel_index=i) if lazy: anaSig.lazy_shape = length seg.analogsignals.append(anaSig) bl.segments.append(seg) t_start = t_start + length * dt bl.create_many_to_one_relationship() return bl
def load_data(abf_file='data2/16o27060.abf', offset=False, norm=True): rec = stfio.read(abf_file) data = np.array(rec[0]) t = rec.dt * np.arange(data.shape[1]) if offset: t0 = 327.88 if re.search('stim.abf', abf_file): t0 = 0.215 if re.search('CAP.abf', abf_file): t0 = 0.215 + 0.31 t = t - t0 if norm: g = np.where((t >= -0.20) * (t <= -0.05))[0] for i in range(data.shape[0]): data[i, :] = data[i, :] - np.mean(data[i, g]) return t, data
def stf_IO_function(folderName, bin_format, file_i=0): txtFolder = path.join(folderName, "bin2txtswps") for file in listdir(folderName): if file[-3:].lower() == bin_format: if not path.exists(txtFolder): makedirs(txtFolder) fullPath = path.join(folderName, file) print fullPath # Open the file using stimfitio rec = stfio.read(str(fullPath)) for i in range(0, len(rec[0])): if (len(rec[0]) == 1): txtFileName = file[0:-4] + '.txt' else: txtFileName = file[0:-4] + "_" + str(i + 1).zfill(4) + '.txt' fullPathtxt = path.join(txtFolder, txtFileName) # Create NumPy array to write write_array = array([ rec[j][i].asarray() for j in range(0, len(rec)) ]).transpose() # Header string with sampling frequency header_string = "\t".join([ str(1000 / rec.dt) + "Hz" for j in range(0, write_array.shape[1]) ]) # Save to txt file savetxt(fullPathtxt, write_array, fmt=('%0.4f'), delimiter='\t', newline='\n', header=header_string) print "Wrote " + file + " to " + txtFileName file_i += 1 return file_i
def main(): searchpath = os.getcwd() exportdirectory = searchpath+'/ConvertedFiles/' # Make export directory if not os.path.exists(exportdirectory): os.makedirs(exportdirectory) # Walk through and find abf files pattern = '*.abf' datafilenames = glob.glob(pattern) if datafilenames: for filename in datafilenames: print 'Converting ',filename data = stfio.read(filename,ftype = "abf") x = data.aspandas() x = x.values numpy.save(exportdirectory+filename[0:-4],x)
def load_current_step(abf_file, filetype='abf', channels=[0, 1], min_voltage=-140): ''' Load current clamp recordings from pClamp .abf files filetype: one of ['abf', 'pkl'] 'pkl' is the pickle file converted from abf min_voltage: None or a number (e.g. -130), traces with min below this voltage are not loaded. ''' ch0, ch1 = channels[0], channels[1] use_pkl = False if filetype == 'abf': try: rec = stfio.read(abf_file) except: use_pkl = True if filetype == 'pkl' or use_pkl: try: with gzip.open(abf_file.strip('.' + filetype) + '.pkl', 'rb') as handle: # compressed pkl data = pickle.load( handle, encoding='bytes') # for files converted to .pkl except IOError: with open(abf_file.strip('.' + filetype) + '.pkl', 'rb') as handle: # non-compressed pkl data = pickle.load( handle, encoding='bytes') # for files converted to .pkl data = decode_bytes(data) return data assert ((rec[ch0].yunits in ['mV', 'pA']) and (rec[ch1].yunits in ['mV', 'pA'])) data = OrderedDict() data['file_id'] = os.path.basename(abf_file).strip('.' + filetype) data['file_directory'] = os.path.dirname(abf_file) data['record_date'] = rec.datetime.date() data['record_time'] = rec.datetime.time() data['dt'] = rec.dt / 1000 data['hz'] = 1. / rec.dt * 1000 data['time_unit'] = 's' data['n_channels'] = len(rec) data['channel_names'] = [rec[x].name for x in channels] data['channel_units'] = [rec[x].yunits for x in channels] data['n_sweeps'] = len(rec[ch0]) data['sweep_length'] = len(rec[ch0][0]) data['t'] = np.arange(0, data['sweep_length']) * data['dt'] if rec[ch0].yunits == 'mV' and rec[ch1].yunits == 'pA': data['voltage'] = rec[ch0] data['current'] = rec[ch1] elif rec[ch1].yunits == 'mV' and rec[ch0].yunits == 'pA': data['voltage'] = rec[ch1] data['current'] = rec[ch0] else: raise ValueError("channel y-units must be 'mV' or 'pA'.") data['voltage'] = [x.asarray() for x in data['voltage']] data['current'] = [x.asarray() for x in data['current']] if not min_voltage is None: to_pop = [] for i, x in enumerate(data['voltage']): if np.min(x) < min_voltage: to_pop.append(i) data['voltage'] = [ x for i, x in enumerate(data['voltage']) if not i in to_pop ] data['current'] = [ x for i, x in enumerate(data['current']) if not i in to_pop ] data['n_sweeps'] -= len(to_pop) return data
def data_analysis(string) : filename, starttime = string.split(' ') rec = stfio.read(filename) #rec = stfio.read("300ng.atf") print 'filename '+filename+' start time '+ starttime writename = filename.rstrip('.atf') print writename, filename f = open(writename + '.dat','w') histogram = open(writename + 'histogram.dat','w') # To make histogram, it will record top point of spike freqdata = open(writename + 'ifreq.dat','w') clamp = rec[0][0] voltage = rec[0][2] limit = rec[0][0].asarray().shape[0] time = np.arange(0.0, limit, 1.0) * rec.dt threshold_c = 0.75 #for cclamp threshold_v = 0.2 #for voltage IN2 spike_cnt = 0 #spike number counter bs_cnt = 0 #before stimulus spike number counter as_cnt = 0 #after stimulus spike number counter s_start = 0 # start of stimulation by Voltage s_end = 0 # end of stimulation by Voltage s_flg = 0 in_spike = False spikelist = [] #time of the spike will be recorded. spikelist.x[i]*dt = Spike time spikelist2 = [] #length of this list is same as clamp and voltage, if spike: spikelist2[i]=1; if not spike:spikelist2[i]=0 rs_start = 0 # real start of stimulation calcuate by spike frequency rs_start_flg = 0 if_2 = [] #instantaneus frequency, 2 spike if_2t = [] #instantaneus frequency time if_3 = [] #instantaneus frequency, 3 spike if_3t = [] #instantaneus frequency time if_4 = [] #instantaneus frequency, 4 spike if_4t = [] #instantaneus frequency time sec1spike = 0 sec2spike = 0 print rec.dt print "time " print rec.dt * limit f.writelines('#Whole time :'+repr(rec.dt * limit)+'\n') for i in range(limit): if i ==0: pass elif (voltage[i-1]-threshold_v)*(voltage[i]-threshold_v)<0: if s_flg == 0: # print(i) s_start = i s_flg +=1 elif s_flg > 0: s_end = i print 's_start : ' + repr(s_start) + ' s_end : ' +repr(s_end) + ' i : ' + repr(i) print (limit) i = 0 spikelist2 =[0 for _ in range(limit)] for i in range(limit): if i == 0: pass elif (clamp[i-1] - threshold_c) * (clamp[i] - threshold_c) < 0: spike_cnt +=1 if in_spike == True: in_spike = False elif in_spike == False: in_spike = True if (in_spike == True) & (i != limit-1): if(clamp[i-1]<clamp[i]) & (clamp[i]>clamp[i+1]): spikelist.append(i) spikelist2[i] = 1 # print(i) # print (i) i=0 for i in range(limit): if (i <limit-1) &(i>0) : if(clamp[i-1]-clamp[i]) * (clamp[i]-clamp[i+1]) < 0: histogram.writelines(repr(clamp[i])+'\n') histogram.close() print s_start print spike_cnt f.writelines('#Number of Spike :'+repr(spike_cnt/2)+'\n') for j in range(len(spikelist)): if spikelist[j]>s_start: if j< len(spikelist)-3 : if (spikelist[j+3]-spikelist[j])<10000: if rs_start_flg ==0 : rs_start = spikelist[j] rs_start_flg +=1 print 'rs_start : ' + repr(rs_start) +' '+ repr(rs_start*rec.dt)+'s' f.writelines('#Start time of stimulation : ' + repr(rs_start)+'\n') i=0 for i in range(len(spikelist)): if i<len(spikelist)-1: if spikelist[i]-rs_start==0: bs_cnt = i f.writelines('#bs_cnt :' + repr(bs_cnt)+'\n') for j in range(len(spikelist)): if (spikelist[j]-rs_start>=0)&(spikelist[j]-rs_start<(1/rec.dt)): sec1spike += 1 for j in range(len(spikelist)): if (spikelist[j]-rs_start>=0)&(spikelist[j]-rs_start<(2/rec.dt)): sec2spike += 1 f.writelines('#1sec spike : ' + repr(sec1spike)+'\n') f.writelines('#2sec spike : ' + repr(sec2spike)+'\n') i=0 freqdata.writelines(repr(len(spikelist)-1-bs_cnt)+'\n') for i in range(len(spikelist)): if i< len(spikelist)-1: a = 1 / ((spikelist[i+1]-spikelist[i])*rec.dt) at = (spikelist[i+1]+spikelist[i])*0.5*rec.dt #print repr(a) """ if a>200: a=200 """ f.writelines(repr(i)+'\t'+repr(spikelist[i])+'\t'+repr(spikelist[i+1])+'\t') f.writelines(repr(at)+ '\t'+repr(a)+'\n') if bs_cnt<=i: freqdata.writelines(repr(at)+ '\t'+repr(a)+'\n') if_2.append(a) if_2t.append(at) i=0 for i in range(len(spikelist)): if i< len(spikelist)-2: b = 2/ ((spikelist[i+2] - spikelist[i])*rec.dt) bt = (spikelist[i+2]+spikelist[i+1]+spikelist[i])/3*rec.dt """ if b>200: b=200 """ f.writelines(repr(bt)+'\t'+repr(b)+'\n') if_3.append(b) if_3t.append(bt) f.writelines('\n\n') i=0 for i in range(len(spikelist)): if i< len(spikelist)-3: c = 3/ ((spikelist[i+3] - spikelist[i])*rec.dt) ct = (spikelist[i+3]+spikelist[i+2]+spikelist[i+1]+spikelist[i])/4*rec.dt """ if c>200: c=200 """ f.writelines(repr(ct)+'\t'+repr(c)+'\n') if_4.append(c) if_4t.append(ct) for i in range(len(spikelist)): if i< len(spikelist)-5: d = 5/ ((spikelist[i+5] - spikelist[i])*rec.dt) dt = (spikelist[i+5]+spikelist[i+4]+spikelist[i+3]+spikelist[i+2]+spikelist[i+1]+spikelist[i])/6*rec.dt if bs_cnt<=i: wholedata.writelines(repr(dt)+ '\t'+repr(d)+'\n') Bin = int(DATABIN/rec.dt) steps = int(limit/Bin) delay = int(starttime.strip('\n')) print 'delay ' +repr(delay) analysis_by_bin(writename, spikelist2,Bin,steps,delay,rec.dt, limit) f.close() flg = plt.figure() plt.subplot(311) plt.plot(if_2t,if_2) plt.ylim(0,300) plt.subplot(312) plt.plot(if_3t,if_3) plt.ylim(0,300) plt.subplot(313) plt.plot(if_4t,if_4) plt.ylim(0,300) plt.savefig(writename+"instantaneusFrequency.png") flg2__ = plt.figure() plt.plot(if_2t,if_2) plt.ylim(0,300) plt.xlim(0,15) plt.xlabel('Time[s]') plt.ylabel('Frequency[Hz]') plt.title('Instantaneus Frequency') plt.savefig(writename+"if.png")
def data_analysis(filename) : rec = stfio.read(filename.strip('\n')) #rec = stfio.read("300ng.atf") print filename writename = filename.rstrip('.atf\n') print writename, filename f = open(writename + '.dat','w') histogram = open(writename + 'histogram.dat','w') # To make histogram, it will record top point of spike clamp = rec[0][0] voltage = rec[0][2] limit = rec[0][0].asarray().shape[0] time = np.arange(0.0, limit, 1.0) * rec.dt threshold_c = 0.75 #for cclamp threshold_v = 0.2 #for voltage IN2 spike_cnt = 0 #spike number counter bs_cnt = 0 #before stimulus spike number counter as_cnt = 0 #after stimulus spike number counter s_start = 0 # start of stimulation by Voltage s_end = 0 # end of stimulation by Voltage s_flg = 0 in_spike = False spikelist = [] #time of the spike will be recorded. spikelist.x[i]*dt = Spike time rs_start = 0 # real start of stimulation calcuate by spike frequency rs_start_flg = 0 if_2 = [] #instantaneus frequency, 2 spike if_2t = [] #instantaneus frequency time if_3 = [] #instantaneus frequency, 3 spike if_3t = [] #instantaneus frequency time if_4 = [] #instantaneus frequency, 4 spike if_4t = [] #instantaneus frequency time print rec.dt for i in range(limit): if i ==0: pass elif (voltage[i-1]-threshold_v)*(voltage[i]-threshold_v)<0: if s_flg == 0: # print(i) s_start = i s_flg +=1 elif s_flg > 0: s_end = i print 's_start : ' + repr(s_start) + ' s_end : ' +repr(s_end) + ' i : ' + repr(i) print (limit) i = 0 for i in range(limit): if i == 0: pass elif (clamp[i-1] - threshold_c) * (clamp[i] - threshold_c) < 0: spike_cnt +=1 if in_spike == True: in_spike = False else: in_spike = True if (in_spike == True) & (i != limit-1): if(clamp[i-1]-clamp[i]) * (clamp[i]-clamp[i+1]) < 0: spikelist.append(i) # print(i) # print (i) i=0 for i in range(limit): if (i <limit-1) &(i>0) : if(clamp[i-1]-clamp[i]) * (clamp[i]-clamp[i+1]) < 0: histogram.writelines(repr(clamp[i])+'\n') histogram.close() print s_start f.writelines('#Number of Spike :'+repr(spike_cnt/2)+'\n') print len(spikelist) print spikelist j=0 for j in range(len(spikelist)): if s_start < spikelist[j]: s_start_spikelist = j for s_start_spikelist in range(len(spikelist)): i=s_start if i< len(spikelist)-3 : if (spikelist[i+3]-spikelist[i])<10000: if rs_start_flg ==0 : rs_start = spikelist[i] rs_start_flg +=1 print 'rs_start : ' + repr(rs_start) f.writelines('#Start time of stimulation : ' + repr(rs_start)+'\n') i=0 for i in range(len(spikelist)): if i<len(spikelist)-1: if spikelist[i]-rs_start==0: bs_cnt = i f.writelines('#bs_cnt :' + repr(bs_cnt)+'\n') i=0 for i in range(len(spikelist)): if i< len(spikelist)-1: a = 1 / ((spikelist[i+1]-spikelist[i])*rec.dt) at = (spikelist[i+1]+spikelist[i])*0.5*rec.dt # print repr(a) """ if a>200: a=200 """ f.writelines(repr(i)+'\t'+repr(spikelist[i])+'\t'+repr(spikelist[i+1])+'\t') f.writelines(repr(at)+ '\t'+repr(a)+'\n') if_2.append(a) if_2t.append(at) i=0 for i in range(len(spikelist)): if i< len(spikelist)-2: b = 2/ ((spikelist[i+2] - spikelist[i])*rec.dt) bt = (spikelist[i+2]+spikelist[i+1]+spikelist[i])/3*rec.dt """ if b>200: b=200 """ f.writelines(repr(bt)+'\t'+repr(b)+'\n') if_3.append(b) if_3t.append(bt) f.writelines('\n\n') i=0 for i in range(len(spikelist)): if i< len(spikelist)-3: c = 3/ ((spikelist[i+3] - spikelist[i])*rec.dt) ct = (spikelist[i+3]+spikelist[i+2]+spikelist[i+1]+spikelist[i])/4*rec.dt """ if c>200: c=200 """ f.writelines(repr(ct)+'\t'+repr(c)+'\n') if_4.append(c) if_4t.append(ct) f.close() flg = plt.figure() plt.subplot(311) plt.plot(if_2t,if_2) plt.ylim(0,300) plt.subplot(312) plt.plot(if_3t,if_3) plt.ylim(0,300) plt.subplot(313) plt.plot(if_4t,if_4) plt.ylim(0,300) plt.savefig(writename+"instantaneusFrequency.png")
def run(dt_nrn, tstop, mean_f): module_dir = os.path.dirname(__file__) if os.path.exists("%s/dat/events.h5" % module_dir): rec = stfio.read("%s/dat/events.h5" % module_dir) spiketimes = np.load("%s/dat/spiketimes.npy" % module_dir) return rec, spiketimes if os.path.exists("%s/dat/events_nonoise.npy" % module_dir): mrec = np.load("%s/dat/events_nonoise.npy" % module_dir) spiketimes = np.load("%s/dat/spiketimes.npy" % module_dir) else: from neuron import h h.load_file('stdrun.hoc') soma, dend = ball_and_stick(h) h.tstop = tstop trange = np.arange(0, tstop + dt_nrn, dt_nrn) spiketimes = generate_events(trange, mean_f) np.save("%s/dat/spiketimes.npy" % module_dir, spiketimes) syn_AMPA, spiketimes_nrn, vecstim, netcon = [], [], [], [] for spike in spiketimes: loc = 0.8 * np.random.normal(1.0, 0.03) if loc < 0: loc = 0 if loc > 1: loc = 1 syn_AMPA.append(h.Exp2Syn(dend(loc), sec=dend)) spiketimes_nrn.append(h.Vector([spike])) vecstim.append(h.VecStim()) netcon.append(h.NetCon(vecstim[-1], syn_AMPA[-1])) syn_AMPA[-1].tau1 = 0.2 * np.random.normal(1.0, 0.3) if syn_AMPA[-1].tau1 < 0.05: syn_AMPA[-1].tau1 = 0.05 syn_AMPA[-1].tau2 = 2.5 * np.random.normal(1.0, 0.3) if syn_AMPA[-1].tau2 < syn_AMPA[-1].tau1 * 1.5: syn_AMPA[-1].tau2 = syn_AMPA[-1].tau1 * 1.5 syn_AMPA[-1].e = 0 vecstim[-1].play(spiketimes_nrn[-1]) netcon[-1].weight[0] = np.random.normal(1.0e-3, 1.0e-4) if netcon[-1].weight[0] < 0: netcon[-1].weight[0] = 0 netcon[-1].threshold = 0.0 vclamp = h.SEClamp(soma(0.5), sec=soma) vclamp.dur1 = tstop vclamp.amp1 = -80.0 vclamp.rs = 5.0 mrec = h.Vector() mrec.record(vclamp._ref_i) h.dt = dt_nrn # ms h.steps_per_ms = 1.0 / h.dt h.v_init = -80.0 h.run() mrec = np.array(mrec) np.save("%s/dat/events_nonoise.npy" % module_dir, mrec) plt.plot(np.arange(len(mrec), dtype=np.float) * dt_nrn, mrec) peak_window_i = 20.0 / dt_nrn amps_i = np.array([ int(np.argmin(mrec[onset_i:onset_i + peak_window_i]) + onset_i) for onset_i in spiketimes / dt_nrn ], dtype=np.int) plt.plot(amps_i * dt_nrn, mrec[amps_i], 'o') mean_amp = np.abs(mrec[amps_i].mean()) print(mean_amp) mrec = add_noise(mrec, dt_nrn, mean_amp) plt.plot(np.arange(len(mrec), dtype=np.float) * dt_nrn, mrec) seclist = [ stfio.Section(mrec), ] chlist = [ stfio.Channel(seclist), ] chlist[0].yunits = "pA" rec = stfio.Recording(chlist) rec.dt = dt_nrn rec.xunits = "ms" rec.write("%s/dat/events.h5" % module_dir) return rec, spiketimes
test.dat These files correspond to the same recording with different file extensions; the recording contains the following properties: Number of channels = 4 Number of traces = 3 Sampling interval = 0.05 """ import numpy as np import unittest import stfio rec = stfio.read('test.h5') class DataListTest(unittest.TestCase): def testReadH5(self): """ testReadH5() Read HDF5 file system """ try: rec = stfio.read('test.h5') except SyntaxError: rec = None # test if Recording object was created self.assertTrue(True, isinstance(rec, stfio.Recording)) # def testReadCFS(self): # """ testReadCFS() Read CED filling system files""" # try:
test.dat These files correspond to the same recording with different file extensions; the recording contains the following properties: Number of channels = 4 Number of traces = 3 Sampling interval = 0.05 """ import numpy as np import unittest import stfio rec = stfio.read('test.h5') class DataListTest(unittest.TestCase): def testReadH5(self): """ testReadH5() Read HDF5 file system """ try: rec = stfio.read('test.h5') except SyntaxError: rec = None # test if Recording object was created self.assertTrue(True, isinstance(rec, stfio.Recording)) # def testReadCFS(self): # """ testReadCFS() Read CED filling system files"""