def assert_snr(actual, desired, tol):
 from nose.tools import assert_true
 snr = (linalg.norm(desired, ord='fro') / linalg.norm((desired - actual), ord='fro'))
 assert_true((snr >= tol), msg=('%f < %f' % (snr, tol)))

def assert_snr ( actual , desired , tol ) : from nose . tools import assert_true snr = ( linalg . norm ( desired , ord = 'fro' ) / linalg . norm ( ( desired - actual ) , ord = 'fro' ) ) assert_true ( ( snr >= tol ) , msg = ( '%f < %f' % ( snr , tol ) ) )
assert actual and desired arrays are within some snr tolerance .