def psf_recenter(stack, r_mask = 40, cy_ext = 1.5):
'''
find the center of the psf and
stack: the raw_psf
r_mask: the radius of the mask size
cy_ext: how far the background should extend to the outside
'''
nz, ny, nx = stack.shape
cy, cx = np.unravel_index(np.argmax(gf(stack,2)), (nz,ny,nx))[1:]
ny_shift = int(ny/2 - cy)
nx_shift = int(nx/2 - cx)
PSF = np.roll(stack, ny_shift, axis = 1)
PSF = np.roll(PSF, nx_shift, axis = 2)
return PSF
# Background estimation
评论列表
文章目录