1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
import os
import numpy as np
from dtcwt.numpy.lowlevel import coldfilt
from pytest import raises
import tests.datasets as datasets
def setup_module():
global mandrill
mandrill = datasets.mandrill()
def test_mandrill_loaded():
assert mandrill.shape == (512, 512)
assert mandrill.min() >= 0
assert mandrill.max() <= 1
assert mandrill.dtype == np.float32
def test_odd_filter():
with raises(ValueError):
coldfilt(mandrill, (-1,2,-1), (-1,2,1))
def test_different_size():
with raises(ValueError):
coldfilt(mandrill, (-0.5,-1,2,1,0.5), (-1,2,-1))
def test_bad_input_size():
with raises(ValueError):
coldfilt(mandrill[:511,:], (-1,1), (1,-1))
def test_good_input_size():
coldfilt(mandrill[:,:511], (-1,1), (1,-1))
def test_good_input_size_non_orthogonal():
coldfilt(mandrill[:,:511], (1,1), (1,1))
def test_output_size():
Y = coldfilt(mandrill, (-1,1), (1,-1))
assert Y.shape == (mandrill.shape[0]/2, mandrill.shape[1])
# vim:sw=4:sts=4:et
|