def binAndAddCTFlabel(self, image, ht, rpixelsize, binning=1, defocus=None): pow = imagefun.power(image) binned = imagefun.bin(pow, binning) # No ctf estimation until it works better so that this node does not # depend on coma beam-tilt calibration s = None ctfdata = None ''' try: ctfdata = fftfun.fitFirstCTFNode(pow,rpixelsize['x'], defocus, ht) except Exception, e: self.logger.error("ctf fitting failed: %s" % e) ctfdata = None if ctfdata: self.logger.info('z0 %.3f um, zast %.3f um (%.0f ), angle= %.1f deg' % (ctfdata[0]*1e6,ctfdata[1]*1e6,ctfdata[2]*100, ctfdata[3]*180.0/math.pi)) s = '%d' % int(ctfdata[0]*1e9) #elif self.ace2exe: elif False: ctfdata = self.estimateCTF(imagedata) z0 = (ctfdata['defocus1'] + ctfdata['defocus2']) / 2 s = '%d' % (int(z0*1e9),) ''' if s: t = numpil.textArray(s) t = ndimage.zoom(t, (min(binned.shape)-40.0)*0.08/(t.shape)[0]) minvalue = arraystats.min(binned) maxvalue = arraystats.max(binned) t = minvalue + t * (maxvalue-minvalue) imagefun.pasteInto(t, binned, (20,20)) return binned, ctfdata
def binAndAddCTFlabel(self, image, ht, cs, rpixelsize, binning=1, defocus=None): pow = imagefun.power(image) binned = imagefun.bin(pow, binning) # No ctf estimation until it works better so that this node does not # depend on coma beam-tilt calibration s = None ctfdata = None ''' try: ctfdata = fftfun.fitFirstCTFNode(pow,rpixelsize['x'], defocus, ht, cs) except Exception, e: self.logger.error("ctf fitting failed: %s" % e) ctfdata = None if ctfdata: self.logger.info('z0 %.3f um, zast %.3f um (%.0f ), angle= %.1f deg' % (ctfdata[0]*1e6,ctfdata[1]*1e6,ctfdata[2]*100, ctfdata[3]*180.0/math.pi)) s = '%d' % int(ctfdata[0]*1e9) #elif self.ace2exe: elif False: ctfdata = self.estimateCTF(imagedata) z0 = (ctfdata['defocus1'] + ctfdata['defocus2']) / 2 s = '%d' % (int(z0*1e9),) ''' if s: t = numpil.textArray(s) t = ndimage.zoom(t, (min(binned.shape) - 40.0) * 0.08 / (t.shape)[0]) minvalue = arraystats.min(binned) maxvalue = arraystats.max(binned) t = minvalue + t * (maxvalue - minvalue) imagefun.pasteInto(t, binned, (20, 20)) return binned, ctfdata
s = None try: ctfdata = fftfun.fitFirstCTFNode(pow,rpixelsize['x'], defocus, ht) except Exception, e: self.logger.error("ctf fitting failed: %s" % e) ctfdata = None if ctfdata: self.logger.info('z0 %.3f um, zast %.3f um (%.0f ), angle= %.1f deg' % (ctfdata[0]*1e6,ctfdata[1]*1e6,ctfdata[2]*100, ctfdata[3]*180.0/math.pi)) s = '%d' % int(ctfdata[0]*1e9) #elif self.ace2exe: elif False: ctfdata = self.estimateCTF(imagedata) z0 = (ctfdata['defocus1'] + ctfdata['defocus2']) / 2 s = '%d' % (int(z0*1e9),) if s: t = numpil.textArray(s) t = ndimage.zoom(t, (min(binned.shape)-40.0)*0.08/(t.shape)[0]) minvalue = arraystats.min(binned) maxvalue = arraystats.max(binned) t = minvalue + t * (maxvalue-minvalue) imagefun.pasteInto(t, binned, (20,20)) return binned, ctfdata def estimateCTF(self, imagedata): mag = imagedata['scope']['magnification'] tem = imagedata['scope']['tem'] cam = imagedata['camera']['ccdcamera'] pixelsize = self.btcalclient.getPixelSize(mag, tem, cam) inputparams = { 'input': os.path.join(imagedata['session']['image path'],imagedata['filename']+".mrc"), 'cs': 2.0,