def calculateJumpData(self,
                          stackpartid,
                          reconrunid=None,
                          multimodelrunid=None,
                          sym='d7'):
        if reconrunid is None and multimodelrunid is None:
            return None
        else:
            #apDisplay.printMsg("calculating jump data for "+str(stackpartid))
            jumpdata = {}
            if multimodelrunid is None:
                eulers = self.getEulersForParticle(stackpartid, reconrunid)
            else:
                eulers = self.getEulersForParticle_MMrun(
                    stackpartid, multimodelrunid)
            if eulers is None:
                return None
            eulers.sort(self.sortByIteration)
            distances = []
            for i in range(len(eulers) - 1):
                #calculate distance (in degrees) for D7 symmetry
                dist = apEulerCalc.eulerCalculateDistanceSym(eulers[i],
                                                             eulers[i + 1],
                                                             sym=sym,
                                                             inplane=True)
                distances.append(dist)
                #f.write('%3.3f\t' % (dist))
            distarray = numpy.asarray(distances, dtype=numpy.float32)
            jumpdata['median'] = numpy.median(distarray)
            jumpdata['mean'] = distarray.mean()
            jumpdata['stdev'] = distarray.std()
            jumpdata['min'] = distarray.min()
            jumpdata['max'] = distarray.max()

            return jumpdata
	def calculateJumpData(self, stackpartid, reconrunid=None, multimodelrunid=None, sym='d7'):
		if reconrunid is None and multimodelrunid is None:
			return None
		else:
			#apDisplay.printMsg("calculating jump data for "+str(stackpartid))
			jumpdata = {}
			if multimodelrunid is None:
				eulers = self.getEulersForParticle(stackpartid, reconrunid)
			else:
				eulers = self.getEulersForParticle_MMrun(stackpartid, multimodelrunid)
			if eulers is None:
				return None
			eulers.sort(self.sortByIteration)
			distances = []
			for i in range(len(eulers)-1):
				#calculate distance (in degrees) for D7 symmetry
				dist = apEulerCalc.eulerCalculateDistanceSym(eulers[i], eulers[i+1], sym=sym, inplane=True)
				distances.append(dist)
				#f.write('%3.3f\t' % (dist))
			distarray = numpy.asarray(distances, dtype=numpy.float32)
			jumpdata['median'] = numpy.median(distarray)
			jumpdata['mean'] = distarray.mean()
			jumpdata['stdev'] = distarray.std()
			jumpdata['min'] = distarray.min()
			jumpdata['max'] = distarray.max()

			return jumpdata
	def calc3dRotationalDifference(self, eulerpair):
		e1 = { "euler1": eulerpair['part1']['euler1'],
			"euler2": eulerpair['part1']['euler2'],
			"euler3": eulerpair['part1']['euler3'] }
		e2 = { "euler1": eulerpair['part1']['euler1'],
			"euler2": eulerpair['part1']['euler2'],
			"euler3": eulerpair['part2']['euler3'] }
		rotdist = apEulerCalc.eulerCalculateDistanceSym(e1, e2, sym=self.params['symmname'], inplane=True)
		return rotdist
 def calc3dRotationalDifference(self, eulerpair):
         e1 = { "euler1": eulerpair['part1']['euler1'],
                 "euler2": eulerpair['part1']['euler2'],
                 "euler3": eulerpair['part1']['euler3'] }
         e2 = { "euler1": eulerpair['part1']['euler1'],
                 "euler2": eulerpair['part1']['euler2'],
                 "euler3": eulerpair['part2']['euler3'] }
         rotdist = apEulerCalc.eulerCalculateDistanceSym(e1, e2, sym=self.params['symmname'], inplane=True)
         return rotdist
Beispiel #5
0
    def processEulers(self, eulertree):
        t0 = time.time()
        #angdistlist = []
        totdistlist = []
        rotdistlist = []
        t0 = time.time()
        apDisplay.printMsg("Begin processing " + str(len(eulertree)) +
                           " euler distances")
        count = 0
        for eulerpair in eulertree:
            count += 1
            if count % 500 == 0:
                sys.stderr.write(".")
            #eulerpair['angdist'] = apEulerCalc.eulerCalculateDistanceSym(eulerpair['part1'],
            #	eulerpair['part2'], sym=self.params['symmname'], inplane=False)
            eulerpair['totdist'] = apEulerCalc.eulerCalculateDistanceSym(
                eulerpair['part1'],
                eulerpair['part2'],
                sym=self.params['symmname'],
                inplane=True)
            eulerpair['rotdist'] = self.calc2dRotationalDifference(eulerpair)
            ### ignore rejected particles
            #if eulerpair['part1']['reject'] == 0 or eulerpair['part2']['reject'] == 0:
            #print eulerpair['part1']['mirror'],eulerpair['part2']['mirror'],eulerpair['totdist']
            #angdistlist.append(eulerpair['angdist'])
            totdistlist.append(eulerpair['totdist'])
            rotdistlist.append(eulerpair['rotdist'])
        apDisplay.printMsg("Processed " + str(len(eulertree)) + " eulers in " +
                           apDisplay.timeString(time.time() - t0))

        self.writeRawDataFile(eulertree)
        self.writeKeepFiles(eulertree)
        #self.writeScatterFile(eulertree)

        print "ANGLE EULER DATA:"
        #D-symmetry goes to 90, all other 180
        #self.analyzeList(angdistlist, tuple((0,None,self.params['stepsize'])), "angdata"+self.datastr+".dat")

        print "PLANE ROTATION DATA:"
        self.analyzeList(rotdistlist,
                         tuple((None, None, self.params['stepsize'])),
                         "rotdata" + self.datastr + ".dat")

        print "TOTAL EULER DATA:"
        #D-symmetry goes to 90, all other 180
        self.analyzeList(totdistlist, tuple(
            (0, None, self.params['stepsize'])),
                         "totaldata" + self.datastr + ".dat")

        apDisplay.printMsg("Processed " + str(len(eulertree)) + " eulers in " +
                           apDisplay.timeString(time.time() - t0))
	def processEulers(self, eulertree):
		t0 = time.time()
		#angdistlist = []
		totdistlist = []
		rotdistlist = []
		t0 = time.time()
		apDisplay.printMsg("Begin processing "+str(len(eulertree))+" euler distances")
		count = 0
		for eulerpair in eulertree:
			count += 1
			if count % 500 == 0:
				sys.stderr.write(".")
			#eulerpair['angdist'] = apEulerCalc.eulerCalculateDistanceSym(eulerpair['part1'],
			#	eulerpair['part2'], sym=self.params['symmname'], inplane=False)
			eulerpair['totdist'] = apEulerCalc.eulerCalculateDistanceSym(eulerpair['part1'],
				eulerpair['part2'], sym=self.params['symmname'], inplane=True)
			eulerpair['rotdist'] = self.calc2dRotationalDifference(eulerpair)
			### ignore rejected particles
			#if eulerpair['part1']['reject'] == 0 or eulerpair['part2']['reject'] == 0:
			#print eulerpair['part1']['mirror'],eulerpair['part2']['mirror'],eulerpair['totdist']
			#angdistlist.append(eulerpair['angdist'])
			totdistlist.append(eulerpair['totdist'])
			rotdistlist.append(eulerpair['rotdist'])
		apDisplay.printMsg("Processed "+str(len(eulertree))+" eulers in "
			+apDisplay.timeString(time.time()-t0))

		self.writeRawDataFile(eulertree)
		self.writeKeepFiles(eulertree)
		#self.writeScatterFile(eulertree)

		print "ANGLE EULER DATA:"
		#D-symmetry goes to 90, all other 180
		#self.analyzeList(angdistlist, tuple((0,None,self.params['stepsize'])), "angdata"+self.datastr+".dat")

		print "PLANE ROTATION DATA:"
		self.analyzeList(rotdistlist, tuple((None,None,self.params['stepsize'])), "rotdata"+self.datastr+".dat")

		print "TOTAL EULER DATA:"
		#D-symmetry goes to 90, all other 180
		self.analyzeList(totdistlist, tuple((0,None,self.params['stepsize'])), "totaldata"+self.datastr+".dat")

		apDisplay.printMsg("Processed "+str(len(eulertree))+" eulers in "+apDisplay.timeString(time.time()-t0))