コード例 #1
0
ファイル: testxfm2.py プロジェクト: timseries/dtcwt
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
コード例 #2
0
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
コード例 #3
0
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)
コード例 #4
0
ファイル: testifm2.py プロジェクト: timseries/dtcwt
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)
コード例 #5
0
ファイル: test_againstmatlab.py プロジェクト: ghisvail/dtcwt
def test_dtwavexfm2():
    Yl, Yh, Yscale = dtwavexfm2(mandrill, 4, 'near_sym_a', 'qshift_a', include_scale=True)
    assert_almost_equal_to_summary(Yl, verif['mandrill_Yl'], tolerance=TOLERANCE)

    for idx, a in enumerate(Yh):
        assert_almost_equal_to_summary(a, verif['mandrill_Yh_{0}'.format(idx)], tolerance=TOLERANCE)

    for idx, a in enumerate(Yscale):
        assert_almost_equal_to_summary(a, verif['mandrill_Yscale_{0}'.format(idx)], tolerance=TOLERANCE)
コード例 #6
0
ファイル: test_againstmatlab.py プロジェクト: xiaoxwxw/dtcwt
def test_dtwavexfm2():
    Yl, Yh, Yscale = dtwavexfm2(mandrill,
                                4,
                                'near_sym_a',
                                'qshift_a',
                                include_scale=True)
    assert_almost_equal_to_summary(Yl,
                                   verif['mandrill_Yl'],
                                   tolerance=TOLERANCE)

    for idx, a in enumerate(Yh):
        assert_almost_equal_to_summary(a,
                                       verif['mandrill_Yh_{0}'.format(idx)],
                                       tolerance=TOLERANCE)

    for idx, a in enumerate(Yscale):
        assert_almost_equal_to_summary(
            a, verif['mandrill_Yscale_{0}'.format(idx)], tolerance=TOLERANCE)
コード例 #7
0
def test_odd_rows_and_cols_w_scale():
    Yl, Yh, Yscale = dtwavexfm2(mandrill[:509,:509], include_scale=True)
コード例 #8
0
def test_odd_rows():
    Yl, Yh = dtwavexfm2(mandrill[:509,:])
コード例 #9
0
def test_3d():
    with raises(ValueError):
        Yl, Yh = dtwavexfm2(np.dstack((mandrill, mandrill)))
コード例 #10
0
def test_specific_wavelet():
    Yl, Yh = dtwavexfm2(mandrill, biort=biort('antonini'), qshift=qshift('qshift_06'))
コード例 #11
0
ファイル: test_xfm2.py プロジェクト: iceseismic/dtcwt
def test_1d():
    Yl, Yh = dtwavexfm2(mandrill[0, :])
コード例 #12
0
ファイル: testxfm2.py プロジェクト: timseries/dtcwt
def test_0_levels_w_scale():
    Yl, Yh, Yscale = dtwavexfm2(lena, nlevels=0, include_scale=True)
    assert np.all(np.abs(Yl - lena) < TOLERANCE)
    assert len(Yh) == 0
    assert len(Yscale) == 0
コード例 #13
0
ファイル: test_xfm2.py プロジェクト: iceseismic/dtcwt
def test_odd_rows_and_cols():
    Yl, Yh = dtwavexfm2(mandrill[:, :509])
コード例 #14
0
ファイル: testifm2.py プロジェクト: timseries/dtcwt
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)
コード例 #15
0
ファイル: testifm2.py プロジェクト: timseries/dtcwt
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)
コード例 #16
0
ファイル: testifm2.py プロジェクト: timseries/dtcwt
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)
コード例 #17
0
ファイル: test_ifm2.py プロジェクト: iceseismic/dtcwt
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)
コード例 #18
0
ファイル: test_ifm2.py プロジェクト: iceseismic/dtcwt
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)
コード例 #19
0
ファイル: test_ifm2.py プロジェクト: iceseismic/dtcwt
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)
コード例 #20
0
ファイル: test_xfm2.py プロジェクト: iceseismic/dtcwt
def test_0_levels():
    Yl, Yh = dtwavexfm2(mandrill, nlevels=0)
    assert np.all(np.abs(Yl - mandrill) < TOLERANCE)
    assert len(Yh) == 0
コード例 #21
0
def test_0_levels():
    Yl, Yh = dtwavexfm2(mandrill, nlevels=0)
    assert np.all(np.abs(Yl - mandrill) < TOLERANCE)
    assert len(Yh) == 0
コード例 #22
0
def test_integer_input():
    # Check that an integer input is correctly coerced into a floating point
    # array
    Yl, Yh = dtwavexfm2([[1,2,3,4], [1,2,3,4]])
    assert np.any(Yl != 0)
コード例 #23
0
ファイル: test_xfm2.py プロジェクト: iceseismic/dtcwt
def test_odd_rows():
    Yl, Yh = dtwavexfm2(mandrill[:509, :])
コード例 #24
0
ファイル: testxfm2.py プロジェクト: timseries/dtcwt
def test_0_levels():
    Yl, Yh = dtwavexfm2(lena, nlevels=0)
    assert np.all(np.abs(Yl - lena) < TOLERANCE)
    assert len(Yh) == 0
コード例 #25
0
ファイル: testxfm2.py プロジェクト: timseries/dtcwt
def test_simple():
    Yl, Yh = dtwavexfm2(lena)
コード例 #26
0
ファイル: testxfm2.py プロジェクト: timseries/dtcwt
def test_integer_input():
    # Check that an integer input is correctly coerced into a floating point
    # array
    Yl, Yh = dtwavexfm2([[1,2,3,4], [1,2,3,4]])
    assert np.any(Yl != 0)
コード例 #27
0
ファイル: testxfm2.py プロジェクト: timseries/dtcwt
def test_specific_wavelet():
    Yl, Yh = dtwavexfm2(lena, biort=biort('antonini'), qshift=qshift('qshift_06'))
コード例 #28
0
def test_simple():
    Yl, Yh = dtwavexfm2(mandrill)
コード例 #29
0
ファイル: testxfm2.py プロジェクト: timseries/dtcwt
def test_1d():
    Yl, Yh = dtwavexfm2(lena[0,:])
コード例 #30
0
def test_1d():
    Yl, Yh = dtwavexfm2(mandrill[0,:])
コード例 #31
0
ファイル: testxfm2.py プロジェクト: timseries/dtcwt
def test_3d():
    Yl, Yh = dtwavexfm2(np.dstack((lena, lena)))
コード例 #32
0
def test_simple_w_scale():
    Yl, Yh, Yscale = dtwavexfm2(mandrill, include_scale=True)

    assert len(Yscale) > 0
    for x in Yscale:
        assert x is not None
コード例 #33
0
ファイル: testxfm2.py プロジェクト: timseries/dtcwt
def test_simple_w_scale():
    Yl, Yh, Yscale = dtwavexfm2(lena, include_scale=True)

    assert len(Yscale) > 0
    for x in Yscale:
        assert x is not None
コード例 #34
0
def test_odd_rows_and_cols():
    Yl, Yh = dtwavexfm2(mandrill[:,:509])
コード例 #35
0
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)
コード例 #36
0
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')
コード例 #37
0
ファイル: test_xfm2.py プロジェクト: iceseismic/dtcwt
def test_3d():
    with raises(ValueError):
        Yl, Yh = dtwavexfm2(np.dstack((mandrill, mandrill)))
コード例 #38
0
def test_0_levels_w_scale():
    Yl, Yh, Yscale = dtwavexfm2(mandrill, nlevels=0, include_scale=True)
    assert np.all(np.abs(Yl - mandrill) < TOLERANCE)
    assert len(Yh) == 0
    assert len(Yscale) == 0
コード例 #39
0
ファイル: test_xfm2.py プロジェクト: iceseismic/dtcwt
def test_specific_wavelet():
    Yl, Yh = dtwavexfm2(mandrill, biort=biort("antonini"), qshift=qshift("qshift_06"))
コード例 #40
0
ファイル: testxfm2.py プロジェクト: timseries/dtcwt
def test_odd_rows():
    Yl, Yh = dtwavexfm2(lena[:509,:])
コード例 #41
0
ファイル: test_xfm2.py プロジェクト: iceseismic/dtcwt
def test_odd_cols_w_scale():
    Yl, Yh, Yscale = dtwavexfm2(mandrill[:509, :509], include_scale=True)
コード例 #42
0
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)
コード例 #43
0
ファイル: testxfm2.py プロジェクト: timseries/dtcwt
def test_odd_rows_and_cols():
    Yl, Yh = dtwavexfm2(lena[:,:509])
コード例 #44
0
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)
コード例 #45
0
ファイル: testxfm2.py プロジェクト: timseries/dtcwt
def test_odd_rows_and_cols_w_scale():
    Yl, Yh, Yscale = dtwavexfm2(lena[:509,:509], include_scale=True)
コード例 #46
0
ファイル: testxfm2.py プロジェクト: timseries/dtcwt
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')
コード例 #47
0
ファイル: test_xfm2.py プロジェクト: iceseismic/dtcwt
def test_simple():
    Yl, Yh = dtwavexfm2(mandrill)