modules/utils.py
def psnr(x, xhat):
    ''' Compute Peak Signal to Noise Ratio in dB

        Inputs:
            x: Ground truth signal
            xhat: Reconstructed signal

        Outputs:
            snrval: PSNR in dB
    '''
    err = x - xhat
    denom = np.mean(pow(err, 2)) + 1e-12

    snrval = 10*np.log10(np.max(x)/denom)

    return snrval
 Compute Peak Signal to Noise Ratio in dB

        Inputs:
            x: Ground truth signal
            xhat: Reconstructed signal

        Outputs:
            snrval: PSNR in dB
    
Compute Peak Signal to Noise Ratio in dB
Inputs:
x: Ground truth signal
xhat: Reconstructed signal

PSNR in dB
Compute Peak Signal to Noise Ratio in dB Inputs : x : Ground truth signal xhat : Reconstructed signal PSNR in dB
def psnr(x, xhat):
    err = x - xhat
    denom = np.mean(pow(err, 2)) + 1e-12
    snrval = 10*np.log10(np.max(x)/denom)
    return snrval
def psnr ( x , xhat ) : err = x - xhat denom = np . mean ( pow ( err , 2 ) ) + 1e-12 snrval = 10 * np . log10 ( np . max ( x ) / denom ) return snrval
Compute Peak Signal to Noise Ratio in dB
Inputs:
x: Ground truth signal
xhat: Reconstructed signal
Compute Peak Signal to Noise Ratio in dB Inputs : x : Ground truth signal xhat : Reconstructed signal
''' Compute Peak Signal to Noise Ratio in dB

        Inputs:
            x: Ground truth signal
            xhat: Reconstructed signal

        Outputs:
            snrval: PSNR in dB
    '''
x
xhat