Beispiel #1
0
        if wavelet == 'db1':
            coeff_shapes = [(4, 5, 5), (4, 5, 5), (8, 9, 9)]
        elif wavelet == 'sym2':
            if pad_mode == 'constant':
                coeff_shapes = [(6, 6, 6), (6, 6, 6), (9, 10, 10)]
            elif pad_mode == 'pywt_periodic':
                coeff_shapes = [(4, 5, 5), (4, 5, 5), (8, 9, 9)]
            else:
                raise RuntimeError
    else:
        raise RuntimeError

    return wavelet, pad_mode, nlevels, image_shape, coeff_shapes


wave_impl_params = [skip_if_no_pywavelets('pywt')]
wave_impl_ids = [" wave_impl='{}' ".format(impl.args[1])
                 for impl in wave_impl_params]


@pytest.fixture(scope='module', params=wave_impl_params, ids=wave_impl_ids)
def wave_impl(request):
    return request.param


def test_wavelet_transform(wave_impl, shape_setup, floating_dtype):
    # Verify that the operator works as expected
    wavelet, pad_mode, nlevels, shape, _ = shape_setup
    ndim = len(shape)

    space = odl.uniform_discr([-1] * ndim, [1] * ndim, shape,
Beispiel #2
0
from future import standard_library
standard_library.install_aliases()

import pytest
import numpy as np

import odl
from odl.util.testutils import (all_almost_equal, noise_element,
                                skip_if_no_pywavelets, simple_fixture)

# --- pytest fixtures --- #
wavelet = simple_fixture('wavelet', ['db1', 'sym2'])
pad_mode = simple_fixture('pad_mode', ['constant', 'pywt_periodic'])
ndim = simple_fixture('ndim', [1, 2, 3])
nlevels = simple_fixture('nlevels', [1, 3])
wave_impl = simple_fixture('wave_impl', [skip_if_no_pywavelets('pywt')])


@pytest.fixture(scope='module')
def shape_setup(ndim, wavelet, pad_mode):
    nlevels = 2

    if ndim == 1:
        image_shape = (16, )
        if wavelet == 'db1':
            coeff_shapes = [(4, ), (4, ), (8, )]
        elif wavelet == 'sym2':
            if pad_mode == 'constant':
                coeff_shapes = [(6, ), (6, ), (9, )]
            elif pad_mode == 'pywt_periodic':
                coeff_shapes = [(4, ), (4, ), (8, )]
Beispiel #3
0
standard_library.install_aliases()

import pytest
import numpy as np

import odl
from odl.util.testutils import (all_almost_equal, noise_element,
                                skip_if_no_pywavelets, simple_fixture)


# --- pytest fixtures --- #
wavelet = simple_fixture('wavelet', ['db1', 'sym2'])
pad_mode = simple_fixture('pad_mode', ['constant', 'pywt_periodic'])
ndim = simple_fixture('ndim', [1, 2, 3])
nlevels = simple_fixture('nlevels', [1, 3])
wave_impl = simple_fixture('wave_impl', [skip_if_no_pywavelets('pywt')])


@pytest.fixture(scope='module')
def shape_setup(ndim, wavelet, pad_mode):
    nlevels = 2

    if ndim == 1:
        image_shape = (16,)
        if wavelet == 'db1':
            coeff_shapes = [(4,), (4,), (8,)]
        elif wavelet == 'sym2':
            if pad_mode == 'constant':
                coeff_shapes = [(6,), (6,), (9,)]
            elif pad_mode == 'pywt_periodic':
                coeff_shapes = [(4,), (4,), (8,)]