예제 #1
0
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_scikit)
from odl.util.testutils import almost_equal, all_almost_equal


# Find the valid projectors
projectors = [skip_if_no_astra('par2d astra_cpu uniform'),
              skip_if_no_astra('par2d astra_cpu nonuniform'),
              skip_if_no_astra('par2d astra_cpu random'),
              skip_if_no_astra('cone2d astra_cpu uniform'),
              skip_if_no_astra('cone2d astra_cpu nonuniform'),
              skip_if_no_astra('cone2d astra_cpu random'),
              skip_if_no_astra_cuda('par2d astra_cuda uniform'),
              skip_if_no_astra_cuda('par2d astra_cuda half_uniform'),
              skip_if_no_astra_cuda('par2d astra_cuda nonuniform'),
              skip_if_no_astra_cuda('par2d astra_cuda random'),
              skip_if_no_astra_cuda('cone2d astra_cuda uniform'),
              skip_if_no_astra_cuda('cone2d astra_cuda nonuniform'),
              skip_if_no_astra_cuda('cone2d astra_cuda random'),
              skip_if_no_astra_cuda('par3d astra_cuda uniform'),
              skip_if_no_astra_cuda('par3d astra_cuda nonuniform'),
              skip_if_no_astra_cuda('par3d astra_cuda random'),
              skip_if_no_astra_cuda('cone3d astra_cuda uniform'),
              skip_if_no_astra_cuda('cone3d astra_cuda nonuniform'),
              skip_if_no_astra_cuda('cone3d astra_cuda random'),
              skip_if_no_astra_cuda('helical astra_cuda uniform'),
              skip_if_no_scikit('par2d scikit uniform'),
              skip_if_no_scikit('par2d scikit half_uniform')]
예제 #2
0

@pytest.fixture(scope="module", params=['float32', 'float64'],
                ids=[' dtype=float32 ', ' dtype=float64 '])
def dtype(request):
    return request.param


# Find the valid projectors
projectors = [skip_if_no_astra('par2d astra_cpu uniform'),
              skip_if_no_astra('par2d astra_cpu nonuniform'),
              skip_if_no_astra('par2d astra_cpu random'),
              skip_if_no_astra('cone2d astra_cpu uniform'),
              skip_if_no_astra('cone2d astra_cpu nonuniform'),
              skip_if_no_astra('cone2d astra_cpu random'),
              skip_if_no_astra_cuda('par2d astra_cuda uniform'),
              skip_if_no_astra_cuda('par2d astra_cuda nonuniform'),
              skip_if_no_astra_cuda('par2d astra_cuda random'),
              skip_if_no_astra_cuda('cone2d astra_cuda uniform'),
              skip_if_no_astra_cuda('cone2d astra_cuda nonuniform'),
              skip_if_no_astra_cuda('cone2d astra_cuda random'),
              skip_if_no_astra_cuda('par3d astra_cuda uniform'),
              skip_if_no_astra_cuda('par3d astra_cuda nonuniform'),
              skip_if_no_astra_cuda('par3d astra_cuda random'),
              skip_if_no_astra_cuda('cone3d astra_cuda uniform'),
              skip_if_no_astra_cuda('cone3d astra_cuda nonuniform'),
              skip_if_no_astra_cuda('cone3d astra_cuda random'),
              skip_if_no_astra_cuda('helical astra_cuda uniform'),
              skip_if_no_scikit('par2d scikit uniform')]

projector_ids = ['geom={}, impl={}, angles={}'
예제 #3
0
# Internal
import odl
from odl.tomo.backends.astra_cuda import (
    AstraCudaProjectorImpl, AstraCudaBackProjectorImpl)
from odl.tomo.util.testutils import skip_if_no_astra_cuda
from odl.util.testutils import simple_fixture


# TODO: test with CUDA implemented uniform_discr


use_cache = simple_fixture('use_cache', [False, True])

# Find the valid projectors
projectors = [skip_if_no_astra_cuda('par2d'),
              skip_if_no_astra_cuda('cone2d'),
              skip_if_no_astra_cuda('par3d'),
              skip_if_no_astra_cuda('cone3d'),
              skip_if_no_astra_cuda('helical')]


space_and_geometry_ids = ['geom = {}'.format(p.args[1]) for p in projectors]


@pytest.fixture(scope="module", params=projectors, ids=space_and_geometry_ids)
def space_and_geometry(request):
    dtype = 'float32'
    geom = request.param

    apart = odl.uniform_partition(0, 2 * np.pi, 8)
예제 #4
0
import odl
from odl.tomo.backends.astra_cuda import (AstraCudaProjectorImpl,
                                          AstraCudaBackProjectorImpl)
from odl.tomo.util.testutils import skip_if_no_astra_cuda
from odl.util.testutils import simple_fixture

# TODO: test with CUDA implemented uniform_discr

# --- pytest fixtures --- #

use_cache = simple_fixture('use_cache', [False, True])

# Find the valid projectors
projectors = [
    skip_if_no_astra_cuda('par2d'),
    skip_if_no_astra_cuda('cone2d'),
    skip_if_no_astra_cuda('par3d'),
    skip_if_no_astra_cuda('cone3d'),
    skip_if_no_astra_cuda('helical')
]

space_and_geometry_ids = ['geom = {}'.format(p.args[1]) for p in projectors]


@pytest.fixture(scope="module", params=projectors, ids=space_and_geometry_ids)
def space_and_geometry(request):
    dtype = 'float32'
    geom = request.param

    apart = odl.uniform_partition(0, 2 * np.pi, 8)
예제 #5
0
import odl
import odl.tomo as tomo
from odl.util.testutils import skip_if_no_largescale, simple_fixture
from odl.tomo.util.testutils import (skip_if_no_astra, skip_if_no_astra_cuda,
                                     skip_if_no_scikit)

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_scikit('par2d scikit 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]