def test_integer_perfect_recon(): # Check that an integer input is correctly coerced into a floating point # array and reconstructed A = np.array([[1,2,3,4], [5,6,7,8]], dtype=np.int32) Yl, Yh = dtwavexfm2(A) B = dtwaveifm2(Yl, Yh) assert np.max(np.abs(A-B)) < 1e-5
def test_integer_perfect_recon(): # Check that an integer input is correctly coerced into a floating point # array and reconstructed A = np.array([[1,2,3,4], [5,6,7,8]], dtype=np.int32) Yl, Yh = dtwavexfm2(A) B = dtwaveifm2(Yl, Yh) assert np.max(np.abs(A-B)) < 1e-5
def test_float32_input(): # Check that an float32 input is correctly output as float32 Yl, Yh = dtwavexfm2(mandrill.astype(np.float32)) assert np.issubsctype(Yl.dtype, np.float32) assert np.all(list(np.issubsctype(x.dtype, np.complex64) for x in Yh)) mandrill_recon = dtwaveifm2(Yl, Yh) assert np.issubsctype(mandrill_recon.dtype, np.float32)
def test_float32_input(): # Check that an float32 input is correctly output as float32 Yl, Yh = dtwavexfm2(lena.astype(np.float32)) assert np.issubsctype(Yl.dtype, np.float32) assert np.all(list(np.issubsctype(x.dtype, np.complex64) for x in Yh)) lena_recon = dtwaveifm2(Yl, Yh) assert np.issubsctype(lena_recon.dtype, np.float32)
def test_reconstruct_custom_filter(): # Reconstruction up to tolerance Yl, Yh = dtwavexfm2(mandrill, 4, biort('legall'), qshift('qshift_06')) mandrill_recon = dtwaveifm2(Yl, Yh, biort('legall'), qshift('qshift_06')) assert np.all(np.abs(mandrill_recon - mandrill) < TOLERANCE)
def test_reconstruct_crop(): # Reconstruction up to tolerance Yl_crop, Yh_crop = dtwavexfm2(mandrill_crop) mandrill_recon = dtwaveifm2( Yl_crop, Yh_crop)[:mandrill_crop.shape[0], :mandrill_crop.shape[1]] assert np.all(np.abs(mandrill_recon - mandrill_crop) < TOLERANCE)
def test_reconstruct(): # Reconstruction up to tolerance Yl, Yh = dtwavexfm2(mandrill) mandrill_recon = dtwaveifm2(Yl, Yh) assert np.all(np.abs(mandrill_recon - mandrill) < TOLERANCE)
def test_rot_symm_modified(): # This test only checks there is no error running these functions, not that they work Yl, Yh, Yscale = dtwavexfm2(mandrill, biort='near_sym_b_bp', qshift='qshift_b_bp', include_scale=True) Z = dtwaveifm2(Yl, Yh, biort='near_sym_b_bp', qshift='qshift_b_bp')
def test_rot_symm_modified(): # This test only checks there is no error running these functions, not that they work Yl, Yh, Yscale = dtwavexfm2(lena, biort='near_sym_b_bp', qshift='qshift_b_bp', include_scale=True) Z = dtwaveifm2(Yl, Yh, biort='near_sym_b_bp', qshift='qshift_b_bp')
def test_reconstruct_custom_filter(): # Reconstruction up to tolerance Yl, Yh = dtwavexfm2(lena, 4, biort('legall'), qshift('qshift_06')) lena_recon = dtwaveifm2(Yl, Yh, biort('legall'), qshift('qshift_06')) assert np.all(np.abs(lena_recon - lena) < TOLERANCE)
def test_reconstruct_crop(): # Reconstruction up to tolerance Yl_crop, Yh_crop = dtwavexfm2(lena_crop) lena_recon = dtwaveifm2(Yl_crop, Yh_crop)[:lena_crop.shape[0], :lena_crop.shape[1]] assert np.all(np.abs(lena_recon - lena_crop) < TOLERANCE)
def test_reconstruct(): # Reconstruction up to tolerance Yl, Yh = dtwavexfm2(lena) lena_recon = dtwaveifm2(Yl, Yh) assert np.all(np.abs(lena_recon - lena) < TOLERANCE)
def test_reconstruct_custom_filter(): # Reconstruction up to tolerance Yl, Yh = dtwavexfm2(mandrill, 4, biort("legall"), qshift("qshift_06")) mandrill_recon = dtwaveifm2(Yl, Yh, biort("legall"), qshift("qshift_06")) assert np.all(np.abs(mandrill_recon - mandrill) < TOLERANCE)
def test_reconstruct_crop(): # Reconstruction up to tolerance Yl_crop, Yh_crop = dtwavexfm2(mandrill_crop) mandrill_recon = dtwaveifm2(Yl_crop, Yh_crop)[: mandrill_crop.shape[0], : mandrill_crop.shape[1]] assert np.all(np.abs(mandrill_recon - mandrill_crop) < TOLERANCE)
def test_reconstruct(): # Reconstruction up to tolerance Yl, Yh = dtwavexfm2(mandrill) mandrill_recon = dtwaveifm2(Yl, Yh) assert np.all(np.abs(mandrill_recon - mandrill) < TOLERANCE)