def uwt_align_d4(X, inverse=False):
"""UWT d4 coefficients aligment.
If inverse = True performs the misalignment
for a correct reconstruction.
"""
J = X.shape[0] / 2
w_shifts = np.asarray([(3 * 2 ** j) - 1 for j in range(J)])
v_shifts = np.asarray([1] + [(2 ** (j + 1) - 1) for j in range(1, J)])
if not inverse:
w_shifts *= -1
v_shifts *= -1
for j in range(J):
X[j] = np.roll(X[j], w_shifts[j])
X[j + J] = np.roll(X[j + J], v_shifts[j])
评论列表
文章目录