def test_dtwavexfm2b(): Yl, Yh, Yscale = dtwavexfm2b(mandrill, 4, 'near_sym_b_bp', 'qshift_b_bp', include_scale=True) assert_almost_equal_to_summary(Yl, verif['mandrill_Ylb'], tolerance=TOLERANCE) for idx, a in enumerate(Yh): assert_almost_equal_to_summary(a, verif['mandrill_Yhb_{0}'.format(idx)], tolerance=TOLERANCE) for idx, a in enumerate(Yscale): assert_almost_equal_to_summary(a, verif['mandrill_Yscaleb_{0}'.format(idx)], tolerance=TOLERANCE)
def test_rescale_highpass(): # N.B we can only test bilinear rescaling since cpxinterb2b doesn't support Lanczos Yl, Yh = dtwavexfm2b(mandrill, 3, 'near_sym_a', 'qshift_a') X = Yh[2] Xrescale = rescale_highpass(X, (X.shape[0]*3, X.shape[1]*3), 'bilinear') # Almost equal in the rescale case is a hard thing to quantify. Due to the # slight differences in interpolation method the odd pixel can very by # quite an amount. Use a percentile approach to look at the bigger picture. assert_percentile_almost_equal_to_summary(Xrescale, verif['mandrill_upsample'], 60, tolerance=TOLERANCE)
def test_rescale_highpass(): # N.B we can only test bilinear rescaling since cpxinterb2b doesn't support Lanczos Yl, Yh = dtwavexfm2b(mandrill, 3, 'near_sym_a', 'qshift_a') X = Yh[2] Xrescale = rescale_highpass(X, (X.shape[0] * 3, X.shape[1] * 3), 'bilinear') # Almost equal in the rescale case is a hard thing to quantify. Due to the # slight differences in interpolation method the odd pixel can very by # quite an amount. Use a percentile approach to look at the bigger picture. assert_percentile_almost_equal_to_summary(Xrescale, verif['mandrill_upsample'], 60, tolerance=TOLERANCE)
def test_dtwavexfm2b(): Yl, Yh, Yscale = dtwavexfm2b(mandrill, 4, 'near_sym_b_bp', 'qshift_b_bp', include_scale=True) assert_almost_equal_to_summary(Yl, verif['mandrill_Ylb'], tolerance=TOLERANCE) for idx, a in enumerate(Yh): assert_almost_equal_to_summary(a, verif['mandrill_Yhb_{0}'.format(idx)], tolerance=TOLERANCE) for idx, a in enumerate(Yscale): assert_almost_equal_to_summary( a, verif['mandrill_Yscaleb_{0}'.format(idx)], tolerance=TOLERANCE)