def cadzow_single(x, M, K, min_var=False):
    # variable names based upon Chen et al, JMR 1994 109A 46
    # form the Hankel data matrix X
    N = len(x)
    L = N - M + 1
    X = scipy.linalg.hankel(x[:L], x[L - 1:])

    # Compute the SVD of X
    U, s, Vh = scipy.linalg.svd(X)

    # correct the singular values and truncate the rank K
    Ul = np.mat(U[:, :K])
    Vlh = np.mat(Vh[:K, :])     # first K columns of V are first K rows of Vh
    sl = s[:K]

    if min_var:  # adjust singular values using minimum variance method
        # estimate variance of noise singular values
        s2 = (1. / (M - K)) * np.power(s[K:], 2).sum()
        sl = np.array([l - s2 / l for l in sl])

    Sl = np.mat(np.diag(sl))

    # compute enhanced data vector for rank-reduced data matrix
    Xp = Ul * Sl * Vlh

    xp = np.empty_like(x)
    for i, v in enumerate(range(M - 1, -L, -1)):
        # the anti-diagonal is the diagonal with rows reversed
        xp[i] = np.diag(Xp[:, ::-1], v).mean()
    return xp


###################################################
# Linear Prediction parametric modeling functions #
###################################################
Perform a single iteration of Cadzow signal enhancement on a 1D vector
dataset/ETHPy150Open jjhelmus/nmrglue/nmrglue/process/proc_lp.py/cadzow_single