def runLeastSquares(self):
		#SET XSCALE
		xscale = numpy.array((1,1,1,0,1,1), dtype=numpy.float32)
		#GET TARGETS
		a1 = numpy.asarray(self.currentpicks1, dtype=numpy.float32)
		a2 = numpy.asarray(self.currentpicks2, dtype=numpy.float32)
		if len(a1) > len(a2):
			apDisplay.printWarning("shorten a1")
			a1 = a1[0:len(a2),:]
		elif len(a2) > len(a1):
			apDisplay.printWarning("shorten a2")
			a2 = a2[0:len(a1),:]
		lsfit = apTiltTransform.willsq(a1, a2, self.data['theta'], self.data['gamma'],
			self.data['phi'], 1.0, self.data['shiftx'], self.data['shifty'], xscale)
		if lsfit['rmsd'] < 30:
			self.data['theta']  = lsfit['theta']
			self.data['gamma']  = lsfit['gamma']
			self.data['phi']    = lsfit['phi']
			self.data['shiftx'] = lsfit['shiftx']
			self.data['shifty']	= lsfit['shifty']
		return lsfit
Example #2
0
 def onRunLeastSquares(self, evt):
     theta = self.thetavalue.GetValue()
     gamma = self.gammavalue.GetValue()
     phi = self.phivalue.GetValue()
     scale = self.scalevalue.GetValue()
     shiftx = self.shiftxvalue.GetValue()
     shifty = self.shiftyvalue.GetValue()
     #SET XSCALE
     xscale = numpy.array((
         not self.thetatog.GetValue(),
         not self.gammatog.GetValue(),
         not self.phitog.GetValue(),
         not self.scaletog.GetValue(),
         not self.shifttog.GetValue(),
         not self.shifttog.GetValue(),
     ),
                          dtype=numpy.float32)
     #GET TARGETS
     targets1 = self.parent.panel1.getTargets('Picked')
     a1 = self.parent.targetsToArray(targets1)
     targets2 = self.parent.panel2.getTargets('Picked')
     a2 = self.parent.targetsToArray(targets2)
     if len(a1) > len(a2):
         print "shorten a1"
         a1 = a1[0:len(a2), :]
     elif len(a2) > len(a1):
         print "shorten a2"
         a2 = a2[0:len(a1), :]
     self.lsfit = apTiltTransform.willsq(a1, a2, theta, gamma, phi, scale,
                                         shiftx, shifty, xscale)
     #pprint.pprint(self.lsfit)
     self.thetavalue.SetValue(round(self.lsfit['theta'], 5))
     self.gammavalue.SetValue(round(self.lsfit['gamma'], 5))
     self.phivalue.SetValue(round(self.lsfit['phi'], 5))
     self.scalevalue.SetValue(round(self.lsfit['scale'], 5))
     self.shiftxvalue.SetValue(round(self.lsfit['shiftx'], 5))
     self.shiftyvalue.SetValue(round(self.lsfit['shifty'], 5))
     self.rmsdlabel.SetLabel(str(round(self.lsfit['rmsd'], 5)))
     self.iterlabel.SetLabel(str(self.lsfit['iter']))
 def runLeastSquares(self):
     #SET XSCALE
     xscale = numpy.array((1, 1, 1, 0, 1, 1), dtype=numpy.float32)
     #GET TARGETS
     a1 = numpy.asarray(self.currentpicks1, dtype=numpy.float32)
     a2 = numpy.asarray(self.currentpicks2, dtype=numpy.float32)
     if len(a1) > len(a2):
         apDisplay.printWarning("shorten a1")
         a1 = a1[0:len(a2), :]
     elif len(a2) > len(a1):
         apDisplay.printWarning("shorten a2")
         a2 = a2[0:len(a1), :]
     lsfit = apTiltTransform.willsq(a1, a2, self.data['theta'],
                                    self.data['gamma'], self.data['phi'],
                                    1.0, self.data['shiftx'],
                                    self.data['shifty'], xscale)
     if lsfit['rmsd'] < 30:
         self.data['theta'] = lsfit['theta']
         self.data['gamma'] = lsfit['gamma']
         self.data['phi'] = lsfit['phi']
         self.data['shiftx'] = lsfit['shiftx']
         self.data['shifty'] = lsfit['shifty']
     return lsfit
 def onRunLeastSquares(self, evt):
         theta  = self.thetavalue.GetValue()
         gamma  = self.gammavalue.GetValue()
         phi    = self.phivalue.GetValue()
         scale  = self.scalevalue.GetValue()
         shiftx = self.shiftxvalue.GetValue()
         shifty = self.shiftyvalue.GetValue()
         #SET XSCALE
         xscale = numpy.array((
                 not self.thetatog.GetValue(),
                 not self.gammatog.GetValue(),
                 not self.phitog.GetValue(),
                 not self.scaletog.GetValue(),
                 not self.shifttog.GetValue(),
                 not self.shifttog.GetValue(),
                 ), dtype=numpy.float32)
         #GET TARGETS
         targets1 = self.parent.panel1.getTargets('Picked')
         a1 = self.parent.targetsToArray(targets1)
         targets2 = self.parent.panel2.getTargets('Picked')
         a2 = self.parent.targetsToArray(targets2)
         if len(a1) > len(a2):
                 print "shorten a1"
                 a1 = a1[0:len(a2),:]
         elif len(a2) > len(a1):
                 print "shorten a2"
                 a2 = a2[0:len(a1),:]
         self.lsfit = apTiltTransform.willsq(a1, a2, theta, gamma, phi, scale, shiftx, shifty, xscale)
         #pprint.pprint(self.lsfit)
         self.thetavalue.SetValue(round(self.lsfit['theta'],5))
         self.gammavalue.SetValue(round(self.lsfit['gamma'],5))
         self.phivalue.SetValue(round(self.lsfit['phi'],5))
         self.scalevalue.SetValue(round(self.lsfit['scale'],5))
         self.shiftxvalue.SetValue(round(self.lsfit['shiftx'],5))
         self.shiftyvalue.SetValue(round(self.lsfit['shifty'],5))
         self.rmsdlabel.SetLabel(str(round(self.lsfit['rmsd'],5)))
         self.iterlabel.SetLabel(str(self.lsfit['iter']))