modules/utils.py
def rsnr(x, xhat):
    '''
        Compute reconstruction SNR for a given signal and its reconstruction.

        Inputs:
            x: Ground truth signal (ndarray)
            xhat: Approximation of x

        Outputs:
            rsnr_val: RSNR = 20log10(||x||/||x-xhat||)
    '''
    xn = lin.norm(x.reshape(-1))
    en = lin.norm((x-xhat).reshape(-1)) + 1e-12
    rsnr_val = 20*np.log10(xn/en)

    return rsnr_val

        Compute reconstruction SNR for a given signal and its reconstruction.

        Inputs:
            x: Ground truth signal (ndarray)
            xhat: Approximation of x

        Outputs:
            rsnr_val: RSNR = 20log10(||x||/||x-xhat||)
    
Compute reconstruction SNR for a given signal and its reconstruction.
Inputs:
x: Ground truth signal (ndarray)
xhat: Approximation of x


Compute reconstruction SNR for a given signal and its reconstruction . Inputs : x : Ground truth signal ( ndarray ) xhat : Approximation of x
def rsnr(x, xhat):
    xn = lin.norm(x.reshape(-1))
    en = lin.norm((x-xhat).reshape(-1)) + 1e-12
    rsnr_val = 20*np.log10(xn/en)
    return rsnr_val
def rsnr ( x , xhat ) : xn = lin . norm ( x . reshape ( - 1 ) ) en = lin . norm ( ( x - xhat ) . reshape ( - 1 ) ) + 1e-12 rsnr_val = 20 * np . log10 ( xn / en ) return rsnr_val
Compute reconstruction SNR for a given signal and its reconstruction.
Compute reconstruction SNR for a given signal and its reconstruction .
'''
        Compute reconstruction SNR for a given signal and its reconstruction.

        Inputs:
            x: Ground truth signal (ndarray)
            xhat: Approximation of x

        Outputs:
            rsnr_val: RSNR = 20log10(||x||/||x-xhat||)
    '''
x
xhat