def find_max_abs_stack(stack, windowstack, couplingmatrix):
"""Find the location and value of the absolute maximum in this stack
:param stack: stack to be searched
:param windowstack: Window for the search
:param couplingmatrix: Coupling matrix between difference scales
:return: x, y, scale
"""
pabsmax = 0.0
pscale = 0
px = 0
py = 0
nscales = stack.shape[0]
assert nscales > 0
pshape = [stack.shape[1], stack.shape[2]]
for iscale in range(nscales):
if windowstack is not None:
resid = stack[iscale, :, :] * windowstack[iscale, :, :] / couplingmatrix[iscale, iscale]
else:
resid = stack[iscale, :, :] / couplingmatrix[iscale, iscale]
# Find the peak in the scaled residual image
mx, my = numpy.unravel_index(numpy.abs(resid).argmax(), pshape)
# Is this the peak over all scales?
thisabsmax = numpy.abs(resid[mx, my])
if thisabsmax > pabsmax:
px = mx
py = my
pscale = iscale
pabsmax = thisabsmax
return px, py, pscale
cleaners.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录