예제 #1
0
import sys
import os

from numpy.testing import Tester
sys.path.insert(0, os.path.abspath('sharedmem'))

import sharedmem

from sys import argv

tester = Tester()
result = tester.test(extra_argv=['-w', 'tests'] + argv[1:])
if not result:
    raise Exception("Test Failed")
예제 #2
0
        if func is None:
            func = getattr(m2, func_name)
            func.module_name = m2_name
        else:
            func.module_name = m1_name
            if force_clapack and m1 is flapack:
                func2 = getattr(m2, func_name, None)
                if func2 is not None:
                    import new
                    exec(_colmajor_func_template % {'func_name': func_name})
                    func = new.function(func_code, {'clapack_func': func2},
                                        func_name)
                    func.module_name = m2_name
                    func.__doc__ = func2.__doc__
        func.prefix = required_prefix
        func.dtypechar = dtypechar
        funcs.append(func)
    return tuple(funcs)


_colmajor_func_template = '''\
def %(func_name)s(*args,**kws):
    if "rowmajor" not in kws:
        kws["rowmajor"] = 0
    return clapack_func(*args,**kws)
func_code = %(func_name)s.func_code
'''

from numpy.testing import Tester
test = Tester().test
예제 #3
0
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
"""DataLad aims to expose (scientific) data available online as a unified data
distribution with the convenience of git-annex repositories as a backend."""

from .version import __version__

from datalad.log import lgr
lgr.debug("Importing the rest of datalad.__init__")
from .config import ConfigManager
cfg = ConfigManager()

# be friendly on systems with ancient numpy -- no tests, but at least
# importable
try:
    from numpy.testing import Tester
    test = Tester().test
    bench = Tester().bench
    del Tester
except ImportError:
    def test(*args, **kwargs):
        lgr.warning('Need numpy >= 1.2 for datalad.tests().  Nothing is done')
    test.__test__ = False

# Following fixtures are necessary at the top level __init__ for fixtures which
# would cover all **/tests and not just datalad/tests/

def setup_package():
    import os

    # To overcome pybuild overriding HOME but us possibly wanting our
    # own HOME where we pre-setup git for testing (name, email)
예제 #4
0
 def test(*a, **kw):
     extra_argv = kw.pop('extra_argv', ())
     extra_argv = extra_argv + tests[1:]
     kw['extra_argv'] = extra_argv
     from numpy.testing import Tester
     return Tester(tests[0]).test(*a, **kw)
예제 #5
0
simplex containing a given point, and barycentric coordinate
computations.

Functions
---------

.. autosummary::
   :toctree: generated/

   tsearch
   distance_matrix
   minkowski_distance
   minkowski_distance_p

"""

from __future__ import division, print_function, absolute_import

from .kdtree import *
from .ckdtree import *
from .qhull import *
from ._plotutils import *

__all__ = [s for s in dir() if not s.startswith('_')]
__all__ += ['distance']

from . import distance
from numpy.testing import Tester
test = Tester().test
bench = Tester().bench
예제 #6
0
        for i in range(10):
            b.bench_run(np.random.uniform(0, 10, 2))
        b.print_results()

    def bench_beale(self):
        s = funcs.Beale()
        #    print "checking gradient", scipy.optimize.check_grad(s.fun, s.der, np.array([1.1, -2.3]))
        b = _BenchOptimizers("Beale's function",
                             fun=s.fun,
                             der=s.der,
                             hess=None)
        for i in range(10):
            b.bench_run(np.random.uniform(0, 10, 2))
        b.print_results()

    def bench_LJ(self):
        s = funcs.LJ()
        #    print "checking gradient", scipy.optimize.check_grad(s.get_energy, s.get_gradient, np.random.uniform(-2,2,3*4))
        natoms = 4
        b = _BenchOptimizers("%d atom Lennard Jones potential" % (natoms),
                             fun=s.fun,
                             der=s.der,
                             hess=None)
        for i in range(10):
            b.bench_run(np.random.uniform(-2, 2, natoms * 3))
        b.print_results()


if __name__ == "__main__":
    Tester().bench(extra_argv=dict())
예제 #7
0
def tests():
    Tester(testing).test(verbose=10)
예제 #8
0
import pkg_resources
from .info import __doc__
from .core import *
from . import extrapolation, limits, step_generators

from numpy.testing import Tester
try:
    __version__ = pkg_resources.get_distribution(__name__).version
except pkg_resources.DistributionNotFound:
    __version__ = 'unknown'


test = Tester(raise_warnings="release").test
예제 #9
0
파일: bench_cg.py 프로젝트: witcxc/scipy
                tm_dense = tm_end - tm_start

            # Optionally use the sparse conjugate gradient solver.
            if sparse_is_active:
                tm_start = time.clock()
                for i in range(repeats):
                    x_sparse, info = sparse.linalg.cg(P_sparse, b)
                tm_end = time.clock()
                tm_sparse = tm_end - tm_start

            # Check that the solutions are close to each other.
            if dense_is_active and sparse_is_active:
                assert_allclose(x_dense, x_sparse, rtol=1e-4)

            # Write the rows.
            shape = (n * n, n * n)
            if dense_is_active:
                print(fmt % (shape, repeats, 'dense solve', tm_dense))

            if sparse_is_active:
                print(fmt % (shape, repeats, 'sparse cg', tm_sparse))

            dense_is_active = (tm_dense < 5)
            sparse_is_active = (tm_sparse < 5)

        print()


if __name__ == '__main__':
    Tester().bench()
예제 #10
0
    from scipy.version import version as __version__
    from scipy._lib._version import NumpyVersion as _NumpyVersion
    if _NumpyVersion(__numpy_version__) < '1.8.2':
        import warnings
        warnings.warn(
            "Numpy 1.8.2 or above is recommended for this version of "
            "scipy (detected version %s)" % __numpy_version__, UserWarning)

    del _NumpyVersion

    from scipy._lib._ccallback import LowLevelCallable

    from numpy.testing import Tester

    def test(*a, **kw):
        # Nose never recurses into directories with underscores prefix, so we
        # need to list those explicitly. Note that numpy.testing.Tester inserts
        # the top-level package path determined from __file__ to argv unconditionally,
        # so we only need to add the part that is not otherwise recursed into.
        import os
        underscore_modules = ['_lib', '_build_utils']
        base_dir = os.path.abspath(os.path.dirname(__file__))
        underscore_paths = [
            os.path.join(base_dir, name) for name in underscore_modules
        ]
        kw['extra_argv'] = list(kw.get('extra_argv', [])) + underscore_paths
        return test._tester.test(*a, **kw)

    test._tester = Tester()
    test.__doc__ = test._tester.test.__doc__
test.__test__ = False  # Prevent nose from treating test() as a test
예제 #11
0
def test(level=1, verbosity=1):
    from numpy.testing import Tester
    return Tester().test(level, verbosity)
예제 #12
0
if sys.platform != 'cli':
    import scalarmath

from function_base import *
from machar import *

from getlimits import *

from shape_base import *

del nt

from fromnumeric import amax as max, amin as min, round_ as round

from numeric import absolute as abs

__all__ = ['char', 'rec', 'memmap']
__all__ += numeric.__all__
__all__ += fromnumeric.__all__
__all__ += rec.__all__
__all__ += ['chararray']
__all__ += function_base.__all__
__all__ += machar.__all__
__all__ += getlimits.__all__
__all__ += shape_base.__all__

from numpy.testing import Tester
test = Tester(__file__).test
bench = Tester(__file__).bench