def getSinTF(dname): dp = getDataPairs(dname) for exp in dp: dpl = dp[exp] print "Analyzing Sin Data for experiment %s" % exp dpl = [p for p in dpl if p[0][10]=='S' and not p[0][11]=='T'] ds = assemble(dpl, dname) dat = ds.getData() dat[:,1] = cal._applyfilter(dat[:,1], MFF) # dat[:,0] = smooth(dat[:,0]) #This now occurs in assemble BEFORE resampling ds.datinit(dat, {"SampleType":"timeseries", "StartTime":0.0, "Labels":["HairPosition","MicroFlownVelocity"], "SamplesPerSecond":SIGFS}) nfn = '%s_compositSinData.mdat' % exp io.write(ds, nfn, newdoc=True) tfds = ctf.tffmax(ds, False) if not tfds: continue tfds.data[:,2]+=pi tfds.data[:,2] = smoothphase(tfds.data[:,2]) io.write(tfds, "%s_SinTF_Function.mdat" % exp, newdoc=True) tf = tfds.getData() tf = row_stack( [array([[0,0,0]]), tf, array([[250,tf[-1,1],tf[-1,2]]])]) tf = ctf.uniformsample(tf, 1.0) tfds = miendata.newData(tf, {'Name':exp+"SinTF", 'SampleType':'timeseries', 'SamplesPerSecond':1.0, "StartTime":0}) io.write(tfds, "%s_SinTF_ResampledTimeseries.mdat" % exp, newdoc=True)
def getWNTF(dname): dp = getDataPairs(dname) for exp in dp: dpl = dp[exp] print "Analyzing all data (using FT) for experiment %s" % exp ds = assemble(dpl, dname) dat = ds.getData() dat[:,1] = cal._applyfilter(dat[:,1], MFF) # dat[:,0] = smooth(dat[:,0]) #This now occurs in assemble BEFORE resampling ds.datinit(dat, {"SampleType":"timeseries", "StartTime":0.0, "Labels":["HairPosition","MicroFlownVelocity"], "SamplesPerSecond":SIGFS}) nfn = '%s_compositData.mdat' % exp io.write(ds, nfn, newdoc=True) tfds = ctf.tf1ft(ds) if not tfds: continue tfds.data[:,1]+=pi tfds.data[:,1] = smoothphase(tfds.data[:,1]) io.write(tfds, "%s_FTTF.mdat" % exp, newdoc=True)
def process(doc, filt): ds = doc.getElements("Data", depth=1)[0] dat = ds.getData() dat[:,1] = cal._applyfilter(dat[:,1], filt) dat[:,0] = smooth(dat[:,0])