示例#1
0
filter_type = simple_fixture(
    'filter_type', ['Ram-Lak', 'Shepp-Logan', 'Cosine', 'Hamming', 'Hann'])
frequency_scaling = simple_fixture('frequency_scaling', [0.5, 0.9, 1.0])

# Find the valid projectors
# TODO: Add nonuniform once #671 is solved
projectors = [
    skip_if_no_astra('par2d astra_cpu uniform'),
    skip_if_no_astra('cone2d astra_cpu uniform'),
    skip_if_no_astra_cuda('par2d astra_cuda uniform'),
    skip_if_no_astra_cuda('cone2d astra_cuda uniform'),
    skip_if_no_astra_cuda('par3d astra_cuda uniform'),
    skip_if_no_astra_cuda('cone3d astra_cuda uniform'),
    skip_if_no_astra_cuda('helical astra_cuda uniform'),
    skip_if_no_skimage('par2d skimage uniform')
]

projector_ids = [
    'geom={}, impl={}, angles={}'
    ''.format(*p.args[1].split()) for p in projectors
]

# bug in pytest (ignores pytestmark) forces us to do this this
largescale = " or not pytest.config.getoption('--largescale')"
projectors = [
    pytest.mark.skipif(p.args[0] + largescale, p.args[1]) for p in projectors
]


@pytest.fixture(scope="module", params=projectors, ids=projector_ids)
示例#2
0
from pkg_resources import parse_version
import pytest

import odl
import odl.tomo as tomo
from odl.tomo.backends import ASTRA_VERSION
from odl.tomo.util.testutils import (skip_if_no_astra, skip_if_no_astra_cuda,
                                     skip_if_no_skimage)
from odl.util.testutils import almost_equal, all_almost_equal, simple_fixture

# --- pytest fixtures --- #

impl_params = [
    skip_if_no_astra('astra_cpu'),
    skip_if_no_astra_cuda('astra_cuda'),
    skip_if_no_skimage('skimage')
]
impl = simple_fixture('impl', impl_params, fmt=" {name} = '{value.args[1]}' ")

geometry_params = ['par2d', 'par3d', 'cone2d', 'cone3d', 'helical']
geometry_ids = [' geometry = {} '.format(p) for p in geometry_params]


@pytest.fixture(scope='module', ids=geometry_ids, params=geometry_params)
def geometry(request):
    geom = request.param
    m = 100
    n_angles = 100

    if geom == 'par2d':
        apart = odl.uniform_partition(0, np.pi, n_angles)