예제 #1
0
파일: test_xfm1.py 프로젝트: xiaoxwxw/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], dtype=np.int32)
    Yl, Yh = dtwavexfm(A)
    B = dtwaveifm(Yl, Yh)
    assert np.max(np.abs(A - B)) < 1e-12
예제 #2
0
파일: test_xfm1.py 프로젝트: ghisvail/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], dtype=np.int32)
    Yl, Yh = dtwavexfm(A)
    B = dtwaveifm(Yl, Yh)
    assert np.max(np.abs(A-B)) < 1e-12
예제 #3
0
def test_float32_input():
    # Check that an float32 input is correctly output as float32
    Yl, Yh = dtwavexfm(np.array([1, 2, 3, 4]).astype(np.float32))
    assert np.issubsctype(Yl.dtype, np.float32)
    assert np.all(list(np.issubsctype(x.dtype, np.complex64) for x in Yh))

    recon = dtwaveifm(Yl, Yh)
    assert np.issubsctype(recon.dtype, np.float32)
예제 #4
0
파일: test_ifm1.py 프로젝트: ghisvail/dtcwt
def test_float32_input():
    # Check that an float32 input is correctly output as float32
    Yl, Yh = dtwavexfm(np.array([1, 2, 3, 4]).astype(np.float32))
    assert np.issubsctype(Yl.dtype, np.float32)
    assert np.all(list(np.issubsctype(x.dtype, np.complex64) for x in Yh))

    recon = dtwaveifm(Yl, Yh)
    assert np.issubsctype(recon.dtype, np.float32)
예제 #5
0
파일: test_xfm1.py 프로젝트: ghisvail/dtcwt
def test_simple_custom_filter():
    vec = np.random.rand(630)
    Yl, Yh = dtwavexfm(vec, 4, biort('legall'), qshift('qshift_06'))
    vec_recon = dtwaveifm(Yl, Yh, biort('legall'), qshift('qshift_06'))
    assert np.max(np.abs(vec_recon - vec)) < TOLERANCE
예제 #6
0
파일: test_xfm1.py 프로젝트: ghisvail/dtcwt
def test_simple_with_scale_and_no_levels():
    vec = np.random.rand(630)
    Yl, Yh, Yscale = dtwavexfm(vec, 0, include_scale=True)
    assert len(Yh) == 0
    assert len(Yscale) == 0
예제 #7
0
파일: test_xfm1.py 프로젝트: ghisvail/dtcwt
def test_perfect_recon():
    vec = np.random.rand(630)
    Yl, Yh = dtwavexfm(vec)
    vec_recon = dtwaveifm(Yl, Yh)
    assert np.max(np.abs(vec_recon - vec)) < TOLERANCE
예제 #8
0
파일: test_xfm1.py 프로젝트: ghisvail/dtcwt
def test_simple_with_no_levels():
    vec = np.random.rand(630)
    Yl, Yh = dtwavexfm(vec, 0)
    assert len(Yh) == 0
예제 #9
0
파일: test_xfm1.py 프로젝트: ghisvail/dtcwt
def test_simple_with_scale():
    vec = np.random.rand(630)
    Yl, Yh, Yscale = dtwavexfm(vec, 3, include_scale=True)
    assert len(Yh) == 3
    assert len(Yscale) == 3
예제 #10
0
파일: test_xfm1.py 프로젝트: xiaoxwxw/dtcwt
def test_simple_custom_filter():
    vec = np.random.rand(630)
    Yl, Yh = dtwavexfm(vec, 4, biort('legall'), qshift('qshift_06'))
    vec_recon = dtwaveifm(Yl, Yh, biort('legall'), qshift('qshift_06'))
    assert np.max(np.abs(vec_recon - vec)) < TOLERANCE
예제 #11
0
파일: test_ifm1.py 프로젝트: ghisvail/dtcwt
def test_reconstruct():
    # Reconstruction up to tolerance
    vec = np.random.rand(630)
    Yl, Yh = dtwavexfm(vec)
    vec_recon = dtwaveifm(Yl, Yh)
    assert np.all(np.abs(vec_recon - vec) < TOLERANCE)
예제 #12
0
파일: test_xfm1.py 프로젝트: ghisvail/dtcwt
def test_2d():
    Yl, Yh = dtwavexfm(np.random.rand(10,10))
예제 #13
0
파일: test_xfm1.py 프로젝트: xiaoxwxw/dtcwt
def test_simple_with_scale():
    vec = np.random.rand(630)
    Yl, Yh, Yscale = dtwavexfm(vec, 3, include_scale=True)
    assert len(Yh) == 3
    assert len(Yscale) == 3
예제 #14
0
파일: test_xfm1.py 프로젝트: xiaoxwxw/dtcwt
def test_integer_input():
    # Check that an integer input is correctly coerced into a floating point
    # array
    Yl, Yh = dtwavexfm([1, 2, 3, 4])
    assert np.any(Yl != 0)
예제 #15
0
파일: test_xfm1.py 프로젝트: xiaoxwxw/dtcwt
def test_simple_with_scale_and_no_levels():
    vec = np.random.rand(630)
    Yl, Yh, Yscale = dtwavexfm(vec, 0, include_scale=True)
    assert len(Yh) == 0
    assert len(Yscale) == 0
예제 #16
0
파일: test_xfm1.py 프로젝트: xiaoxwxw/dtcwt
def test_2d():
    Yl, Yh = dtwavexfm(np.random.rand(10, 10))
예제 #17
0
파일: test_xfm1.py 프로젝트: xiaoxwxw/dtcwt
def test_non_multiple_of_two():
    vec = np.random.rand(631)
    with raises(ValueError):
        Yl, Yh = dtwavexfm(vec, 1)
예제 #18
0
파일: test_xfm1.py 프로젝트: xiaoxwxw/dtcwt
def test_single_level():
    vec = np.random.rand(630)
    Yl, Yh = dtwavexfm(vec, 1)
예제 #19
0
파일: test_xfm1.py 프로젝트: ghisvail/dtcwt
def test_single_level():
    vec = np.random.rand(630)
    Yl, Yh = dtwavexfm(vec, 1)
예제 #20
0
파일: test_xfm1.py 프로젝트: xiaoxwxw/dtcwt
def test_simple_with_no_levels():
    vec = np.random.rand(630)
    Yl, Yh = dtwavexfm(vec, 0)
    assert len(Yh) == 0
예제 #21
0
파일: test_xfm1.py 프로젝트: ghisvail/dtcwt
def test_non_multiple_of_two():
    vec = np.random.rand(631)
    with raises(ValueError):
        Yl, Yh = dtwavexfm(vec, 1)
예제 #22
0
파일: test_xfm1.py 프로젝트: xiaoxwxw/dtcwt
def test_perfect_recon():
    vec = np.random.rand(630)
    Yl, Yh = dtwavexfm(vec)
    vec_recon = dtwaveifm(Yl, Yh)
    assert np.max(np.abs(vec_recon - vec)) < TOLERANCE
예제 #23
0
파일: test_xfm1.py 프로젝트: ghisvail/dtcwt
def test_integer_input():
    # Check that an integer input is correctly coerced into a floating point
    # array
    Yl, Yh = dtwavexfm([1,2,3,4])
    assert np.any(Yl != 0)
예제 #24
0
def test_reconstruct():
    # Reconstruction up to tolerance
    vec = np.random.rand(630)
    Yl, Yh = dtwavexfm(vec)
    vec_recon = dtwaveifm(Yl, Yh)
    assert np.all(np.abs(vec_recon - vec) < TOLERANCE)
예제 #25
0
파일: test_xfm1.py 프로젝트: ghisvail/dtcwt
def test_simple():
    vec = np.random.rand(630)
    Yl, Yh = dtwavexfm(vec, 3)
    assert len(Yh) == 3
예제 #26
0
파일: test_xfm1.py 프로젝트: xiaoxwxw/dtcwt
def test_simple():
    vec = np.random.rand(630)
    Yl, Yh = dtwavexfm(vec, 3)
    assert len(Yh) == 3