示例#1
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], dtype=np.int32)
    Yl, Yh = dtwavexfm(A)
    B = dtwaveifm(Yl, Yh)
    assert np.max(np.abs(A-B)) < 1e-12
示例#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], 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
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
def test_reconstruct_2d():
    # Reconstruction up to tolerance
    vec = np.random.rand(630, 20)
    Yl, Yh = dtwavexfm(vec)
    vec_recon = dtwaveifm(Yl, Yh)
    assert np.all(np.abs(vec_recon - vec) < TOLERANCE)
示例#6
0
def test_reconstruct_2d():
    # Reconstruction up to tolerance
    vec = np.random.rand(630, 20)
    Yl, Yh = dtwavexfm(vec)
    vec_recon = dtwaveifm(Yl, Yh)
    assert np.all(np.abs(vec_recon - vec) < TOLERANCE)
示例#7
0
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
示例#8
0
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
示例#9
0
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
示例#10
0
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