def tffmax(ds, usamp=True):
	ftt.scanForTFValues(ds, window=.2, minFreq=4.9, maxFreq = 250.0)
	tfv = ds.getSubData('/ftvals')
	tf = _cleanupTFV(tfv.getData())
	if tf.shape[0]==0:
		print("No values in fmax tf")
		return None
	if usamp:
		sv = tf[:,0].min()
		tf = uniformsample(tf, 1.0)
		dat = mdat.newData(tf, {'SampleType':'timeseries', 'SamplesPerSecond':1.0, "StartTime":sv})
	else:
		dat = mdat.newData(tf, {'SampleType':'function'})
	return dat
Esempio n. 2
0
def getTF(vidfn, mffn):
	mff=os.path.join(os.path.split(ftt.__file__)[0], 'MicroflownCalib.ncl')
	doc = io.read(mffn)
	mfds = doc.getElements('Data')[0]
	mfds.delChans([z for z in range(mfds.data.shape[1]) if not z==MFCHAN])
	fd = io.read(mff)
	fd = fd.getElements('Data')[0]
	mfds.newElement(fd)
	fd.setName('filter')
	cal.applyFilterToSignal(mfds, dpathSig='/', dpathFilt="/filter", channel=0, newpath='velocity')
	vdoc = io.read(vidfn)
	vds = vdoc.getElements('Data')[0]
	vds.newElement(mfds.getSubData('velocity'))
	combine(vds, '/', '/velocity', False)
	ftt.scanForTFValues(vds)
	tfv = vds.getSubData('/ftvals')
	tf = _cleanupTFV(tfv.getData())
	f=open('trans_func.txt', 'w')
	for i in range(tf.shape[0]):
		f.write(" ".join(map(str, tf[i]))+"\n")
	f.close()