def rampNorm(imgarray): """ normalize an image by subtracting a fit 2D plane and stdev of 1 in the edge """ imgarray = imagefilter.planeRegression(imgarray, msg=False) return edgeNorm(imgarray)
freq = 1.0/(powerspec.shape[0]*pixelsize) #poweravg = numpy.array(psdlist).mean(0) apDisplay.printMsg("Computing median of power spectra series") poweravg = numpy.median(psdlist, axis=0) if msg is True: apDisplay.printMsg("Compute PSD with fieldsize %d and %d images complete in %s" %(fieldsize, count, apDisplay.timeString(time.time()-t0))) return poweravg, freq #=================== #=================== #=================== if __name__ == "__main__": a = mrc.read("/home/vosslab/test.mrc") a = imagefilter.planeRegression(a) fullpower = imagefun.power(a) #imagestat.printImageInfo(a) t0 = time.time() x = numpy.arange(6, 13) N = 2**x print N for n in N: print "=====================================" b = power(a, n) b = imagefilter.frame_cut(b, numpy.array(b.shape)/2) imagefile.arrayToPng(b, "%04d-field.png"%(n)) imagestat.printImageInfo(b) bin = int(round(2**12/n)) b = imagefun.bin2(fullpower, bin)