Example #1
0
def makeVaricData_PF(i,l,s):
	'''Input:
	    l[0] is a tuple (length, id)
	Output:
	    If there is not a file
		Length.Id.10.all.l.mat in /rigs/gic/aff, creates this
		file, containing a matlab array named affdata
		returns [filename]
	'''
	sfn="/rigs/gic/aff/%s.%i.10.all.l.xml" % (l[0][0], l[0][1])
	tfn="/rigs/gic/aff/%s.%i.10.all.l.mat" % (l[0][0], l[0][1])
	modfn="/rigs/gic/aff/%s.%i.10.all.l_model.mat" % (l[0][0], l[0][1])
	if os.path.isfile(modfn):
		s["Abort"]=True
		return [modfn]
	if not os.path.isfile(sfn):
		s["Abort"]=True
		return ["no data"]
	import mien.nmpml
	from mien.datafiles.filewriters import hash2mat
	doc=mien.nmpml.readXML(sfn)
	pts=None
	for f in doc.getElements("Fiducial"):
		npts=f.points
		if pts==None:
			pts=npts[:,:4]
		else:
			pts=concatenate([pts, npts[:,:4]])
	hash2mat(tfn, {"affdata":pts})
	print "writing %s" % tfn
	return [tfn]
Example #2
0
def normalizeAll(fns):
	nmax=float(fns[0])
	a=matArray(fns[1])
	nfn=os.path.splitext(fns[1])[0]+'.normi%.4f.mat' % nmax
	omax=a.sum()
	a=a*nmax/omax
	hash2mat(nfn,  {"density":a})
Example #3
0
def subtractFiles(fns):
	efn=fns[0]
	if os.path.exists(efn):
		print "Refusing to overwrite %s" % efn
		exit()
	a=matArray(fns[1])
	b=matArray(fns[2])
	a=a-b
	a=maximum(a, zeros(a.shape))
	hash2mat(efn,  {"density":a})
Example #4
0
def addFiles(fns):
	efn=fns[0]
	if os.path.exists(efn):
		print "Refusing to overwrite %s" % efn
		exit()
	a=matArray(fns[1])
	for fn in fns[2:]:
		b=matArray(fn)
		a=a+b
	hash2mat(efn,  {"density":a})
Example #5
0
def makeEstimate(files):
	efn=files[0]
	if os.path.exists(efn):
		print "Refusing to overwrite %s" % efn
		exit()
	if files[1].endswith('.mat'):
		fc=readmat(files[1])
		dat=fc[-1]["affdata"]
	else:
		dat=getVaricosities(files[1:])
	est=densityEstimate(dat)
	hash2mat(efn,  {"density":est})
Example #6
0
def writeMatFile(files):
	if os.path.exists(files[0]):
		print "Refusing to overwrite %s" % files[0]
		exit()
	pts=getVaricosities(files[1:])
	hash2mat(files[0],  {"affdata":pts})