예제 #1
0
파일: base.py 프로젝트: gic888/MIEN
	def codingtest(self):
		self.prep()
		q=ones(self._np)*-32768
		print q
		print self._params.code16toPar(q)	
		q=ones(self._np)*32767
		print q
		print self._params.code16toPar(q)	
		q=zeros(self._np)
		print q
		print self._params.code16toPar(q)
		print self._params.indextoPar(q)
		q=ones(self._np)*self._params._bins
		q-=1
		print q
		print self._params.indextoPar(q)	
예제 #2
0
파일: gui.py 프로젝트: gic888/MIEN
	def getCondition(self):
		'''Return a 1D array of integers representing the unit IDs for which all specified conditions are met'''
		if not (self.ast or self.data):
			return None
		if not self.condition:
			return arange(self.nunits)
		inds=ones(self.nunits)
		for k in self.condition.keys():
			colid=self.parnames.index(k)
			if self.data:
				col=data.getData()[:,colid]
			else:	
				col=self.ast.getColumn(colid)
			mi, ma = self.condition[k]
			newinds=logical_and(col>=mi, col<=ma)
			inds=logical_and(inds, newinds)
		return nonzero1d(inds)
예제 #3
0
파일: datahash.py 프로젝트: gic888/MIEN
	elif os.path.isdir(dir):
		cont=[os.path.join(dir, x) for x in os.listdir(dir)]
		for q in cont:
			rmdashrf(q)
		os.unlink(dir)
			
def uniqueName(base, used):
	i=0
	name='%s%i' % (base, i)
	while name in used:
		i+=1
		name='%s%i' % (base, i)
	return name 	
			

DTS=ones(1).dtype.str[0]	

class DirDataHash:
	def __init__(self, fn):
		self.checkFile(fn)
		
	def checkFile(self, fn):
		if fn.endswith("index.datahash"):
			self.indexfile=fn
			self.dir=os.path.split(fn)[0]
		else:	
			self.dir=fn
			self.indexfile=os.path.join(fn, "index.datahash")
		self.index=None
		if not os.path.exists(self.dir):
			os.mkdir(self.dir)