def onImageClicked(self, evt): if not self.imagepanel.selectiontool.isDisplayed('Power'): return resolution = 1/math.sqrt(((evt.xy[0]-self.center['x'])*self.pixelsize['x'])**2+((evt.xy[1]-self.center['y'])*self.pixelsize['y'])**2) defocus = fftfun.calculateDefocus(self.hightension,1/resolution) self.node.increment = defocus self.settingsdialog.increment.SetValue(self.node.increment)
def valueString(self, x, y, value): if self.pixelsize and self.center: distance = math.sqrt((x-self.center['x'])**2+(y-self.center['y'])**2) resolution = 1/math.sqrt(((x-self.center['x'])*self.pixelsize['x'])**2+((y-self.center['y'])*self.pixelsize['y'])**2) defocus = fftfun.calculateDefocus(self.hightension,1/resolution) if resolution < 1e-6: resolutionstr = "%.2f nm" % (resolution*1e9,) else: resolutionstr = "%.1f um" % (resolution*1e6,) else: resolutionstr = "N/A" return 'r= %s,defocus=%.0f nm' % (resolutionstr,defocus*1e9)