Пример #1
0
import numpy as np
from numpy.testing import assert_allclose

from scipy import ndimage
from scipy.ndimage import _ctest
from scipy.ndimage import _ctest_oldapi
from scipy.ndimage import _cytest
from scipy._lib._ccallback import LowLevelCallable

FILTER1D_FUNCTIONS = [
    lambda filter_size: _ctest.filter1d(filter_size),
    lambda filter_size: _ctest_oldapi.filter1d(filter_size),
    lambda filter_size: _cytest.filter1d(filter_size, with_signature=False),
    lambda filter_size: LowLevelCallable(
        _cytest.filter1d(filter_size, with_signature=True)),
    lambda filter_size: LowLevelCallable.from_cython(
        _cytest, "_filter1d", _cytest.filter1d_capsule(filter_size)),
]

FILTER2D_FUNCTIONS = [
    lambda weights: _ctest.filter2d(weights),
    lambda weights: _ctest_oldapi.filter2d(weights),
    lambda weights: _cytest.filter2d(weights, with_signature=False),
    lambda weights: LowLevelCallable(
        _cytest.filter2d(weights, with_signature=True)),
    lambda weights: LowLevelCallable.from_cython(
        _cytest, "_filter2d", _cytest.filter2d_capsule(weights)),
]

TRANSFORM_FUNCTIONS = [
    lambda shift: _ctest.transform(shift),
Пример #2
0
from __future__ import division, print_function, absolute_import

import numpy as np
from numpy.testing import assert_allclose

from scipy import ndimage
from scipy.ndimage import _ctest
from scipy.ndimage import _ctest_oldapi
from scipy.ndimage import _cytest
from scipy._lib._ccallback import LowLevelCallable

FILTER1D_FUNCTIONS = [
    lambda filter_size: _ctest.filter1d(filter_size),
    lambda filter_size: _ctest_oldapi.filter1d(filter_size),
    lambda filter_size: _cytest.filter1d(filter_size, with_signature=False),
    lambda filter_size: LowLevelCallable(_cytest.filter1d(filter_size, with_signature=True)),
    lambda filter_size: LowLevelCallable.from_cython(_cytest, "_filter1d",
                                                     _cytest.filter1d_capsule(filter_size)),
]

FILTER2D_FUNCTIONS = [
    lambda weights: _ctest.filter2d(weights),
    lambda weights: _ctest_oldapi.filter2d(weights),
    lambda weights: _cytest.filter2d(weights, with_signature=False),
    lambda weights: LowLevelCallable(_cytest.filter2d(weights, with_signature=True)),
    lambda weights: LowLevelCallable.from_cython(_cytest, "_filter2d", _cytest.filter2d_capsule(weights)),
]

TRANSFORM_FUNCTIONS = [
    lambda shift: _ctest.transform(shift),
    lambda shift: _ctest_oldapi.transform(shift),