annotate DEPENDENCIES/mingw32/Python27/Lib/site-packages/numpy/__init__.py @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2a2c65a20a8b
children
rev   line source
Chris@87 1 """
Chris@87 2 NumPy
Chris@87 3 =====
Chris@87 4
Chris@87 5 Provides
Chris@87 6 1. An array object of arbitrary homogeneous items
Chris@87 7 2. Fast mathematical operations over arrays
Chris@87 8 3. Linear Algebra, Fourier Transforms, Random Number Generation
Chris@87 9
Chris@87 10 How to use the documentation
Chris@87 11 ----------------------------
Chris@87 12 Documentation is available in two forms: docstrings provided
Chris@87 13 with the code, and a loose standing reference guide, available from
Chris@87 14 `the NumPy homepage <http://www.scipy.org>`_.
Chris@87 15
Chris@87 16 We recommend exploring the docstrings using
Chris@87 17 `IPython <http://ipython.scipy.org>`_, an advanced Python shell with
Chris@87 18 TAB-completion and introspection capabilities. See below for further
Chris@87 19 instructions.
Chris@87 20
Chris@87 21 The docstring examples assume that `numpy` has been imported as `np`::
Chris@87 22
Chris@87 23 >>> import numpy as np
Chris@87 24
Chris@87 25 Code snippets are indicated by three greater-than signs::
Chris@87 26
Chris@87 27 >>> x = 42
Chris@87 28 >>> x = x + 1
Chris@87 29
Chris@87 30 Use the built-in ``help`` function to view a function's docstring::
Chris@87 31
Chris@87 32 >>> help(np.sort)
Chris@87 33 ... # doctest: +SKIP
Chris@87 34
Chris@87 35 For some objects, ``np.info(obj)`` may provide additional help. This is
Chris@87 36 particularly true if you see the line "Help on ufunc object:" at the top
Chris@87 37 of the help() page. Ufuncs are implemented in C, not Python, for speed.
Chris@87 38 The native Python help() does not know how to view their help, but our
Chris@87 39 np.info() function does.
Chris@87 40
Chris@87 41 To search for documents containing a keyword, do::
Chris@87 42
Chris@87 43 >>> np.lookfor('keyword')
Chris@87 44 ... # doctest: +SKIP
Chris@87 45
Chris@87 46 General-purpose documents like a glossary and help on the basic concepts
Chris@87 47 of numpy are available under the ``doc`` sub-module::
Chris@87 48
Chris@87 49 >>> from numpy import doc
Chris@87 50 >>> help(doc)
Chris@87 51 ... # doctest: +SKIP
Chris@87 52
Chris@87 53 Available subpackages
Chris@87 54 ---------------------
Chris@87 55 doc
Chris@87 56 Topical documentation on broadcasting, indexing, etc.
Chris@87 57 lib
Chris@87 58 Basic functions used by several sub-packages.
Chris@87 59 random
Chris@87 60 Core Random Tools
Chris@87 61 linalg
Chris@87 62 Core Linear Algebra Tools
Chris@87 63 fft
Chris@87 64 Core FFT routines
Chris@87 65 polynomial
Chris@87 66 Polynomial tools
Chris@87 67 testing
Chris@87 68 Numpy testing tools
Chris@87 69 f2py
Chris@87 70 Fortran to Python Interface Generator.
Chris@87 71 distutils
Chris@87 72 Enhancements to distutils with support for
Chris@87 73 Fortran compilers support and more.
Chris@87 74
Chris@87 75 Utilities
Chris@87 76 ---------
Chris@87 77 test
Chris@87 78 Run numpy unittests
Chris@87 79 show_config
Chris@87 80 Show numpy build configuration
Chris@87 81 dual
Chris@87 82 Overwrite certain functions with high-performance Scipy tools
Chris@87 83 matlib
Chris@87 84 Make everything matrices.
Chris@87 85 __version__
Chris@87 86 Numpy version string
Chris@87 87
Chris@87 88 Viewing documentation using IPython
Chris@87 89 -----------------------------------
Chris@87 90 Start IPython with the NumPy profile (``ipython -p numpy``), which will
Chris@87 91 import `numpy` under the alias `np`. Then, use the ``cpaste`` command to
Chris@87 92 paste examples into the shell. To see which functions are available in
Chris@87 93 `numpy`, type ``np.<TAB>`` (where ``<TAB>`` refers to the TAB key), or use
Chris@87 94 ``np.*cos*?<ENTER>`` (where ``<ENTER>`` refers to the ENTER key) to narrow
Chris@87 95 down the list. To view the docstring for a function, use
Chris@87 96 ``np.cos?<ENTER>`` (to view the docstring) and ``np.cos??<ENTER>`` (to view
Chris@87 97 the source code).
Chris@87 98
Chris@87 99 Copies vs. in-place operation
Chris@87 100 -----------------------------
Chris@87 101 Most of the functions in `numpy` return a copy of the array argument
Chris@87 102 (e.g., `np.sort`). In-place versions of these functions are often
Chris@87 103 available as array methods, i.e. ``x = np.array([1,2,3]); x.sort()``.
Chris@87 104 Exceptions to this rule are documented.
Chris@87 105
Chris@87 106 """
Chris@87 107 from __future__ import division, absolute_import, print_function
Chris@87 108
Chris@87 109 import sys
Chris@87 110
Chris@87 111
Chris@87 112 class ModuleDeprecationWarning(DeprecationWarning):
Chris@87 113 """Module deprecation warning.
Chris@87 114
Chris@87 115 The nose tester turns ordinary Deprecation warnings into test failures.
Chris@87 116 That makes it hard to deprecate whole modules, because they get
Chris@87 117 imported by default. So this is a special Deprecation warning that the
Chris@87 118 nose tester will let pass without making tests fail.
Chris@87 119
Chris@87 120 """
Chris@87 121 pass
Chris@87 122
Chris@87 123
Chris@87 124 class VisibleDeprecationWarning(UserWarning):
Chris@87 125 """Visible deprecation warning.
Chris@87 126
Chris@87 127 By default, python will not show deprecation warnings, so this class
Chris@87 128 can be used when a very visible warning is helpful, for example because
Chris@87 129 the usage is most likely a user bug.
Chris@87 130
Chris@87 131 """
Chris@87 132 pass
Chris@87 133
Chris@87 134
Chris@87 135 # oldnumeric and numarray were removed in 1.9. In case some packages import
Chris@87 136 # but do not use them, we define them here for backward compatibility.
Chris@87 137 oldnumeric = 'removed'
Chris@87 138 numarray = 'removed'
Chris@87 139
Chris@87 140
Chris@87 141 # We first need to detect if we're being called as part of the numpy setup
Chris@87 142 # procedure itself in a reliable manner.
Chris@87 143 try:
Chris@87 144 __NUMPY_SETUP__
Chris@87 145 except NameError:
Chris@87 146 __NUMPY_SETUP__ = False
Chris@87 147
Chris@87 148
Chris@87 149 if __NUMPY_SETUP__:
Chris@87 150 import sys as _sys
Chris@87 151 _sys.stderr.write('Running from numpy source directory.\n')
Chris@87 152 del _sys
Chris@87 153 else:
Chris@87 154 try:
Chris@87 155 from numpy.__config__ import show as show_config
Chris@87 156 except ImportError:
Chris@87 157 msg = """Error importing numpy: you should not try to import numpy from
Chris@87 158 its source directory; please exit the numpy source tree, and relaunch
Chris@87 159 your python interpreter from there."""
Chris@87 160 raise ImportError(msg)
Chris@87 161 from .version import git_revision as __git_revision__
Chris@87 162 from .version import version as __version__
Chris@87 163
Chris@87 164 from ._import_tools import PackageLoader
Chris@87 165
Chris@87 166 def pkgload(*packages, **options):
Chris@87 167 loader = PackageLoader(infunc=True)
Chris@87 168 return loader(*packages, **options)
Chris@87 169
Chris@87 170 from . import add_newdocs
Chris@87 171 __all__ = ['add_newdocs',
Chris@87 172 'ModuleDeprecationWarning',
Chris@87 173 'VisibleDeprecationWarning']
Chris@87 174
Chris@87 175 pkgload.__doc__ = PackageLoader.__call__.__doc__
Chris@87 176
Chris@87 177 from .testing import Tester
Chris@87 178 test = Tester().test
Chris@87 179 bench = Tester().bench
Chris@87 180
Chris@87 181 from . import core
Chris@87 182 from .core import *
Chris@87 183 from . import compat
Chris@87 184 from . import lib
Chris@87 185 from .lib import *
Chris@87 186 from . import linalg
Chris@87 187 from . import fft
Chris@87 188 from . import polynomial
Chris@87 189 from . import random
Chris@87 190 from . import ctypeslib
Chris@87 191 from . import ma
Chris@87 192 from . import matrixlib as _mat
Chris@87 193 from .matrixlib import *
Chris@87 194 from .compat import long
Chris@87 195
Chris@87 196 # Make these accessible from numpy name-space
Chris@87 197 # but not imported in from numpy import *
Chris@87 198 if sys.version_info[0] >= 3:
Chris@87 199 from builtins import bool, int, float, complex, object, str
Chris@87 200 unicode = str
Chris@87 201 else:
Chris@87 202 from __builtin__ import bool, int, float, complex, object, unicode, str
Chris@87 203
Chris@87 204 from .core import round, abs, max, min
Chris@87 205
Chris@87 206 __all__.extend(['__version__', 'pkgload', 'PackageLoader',
Chris@87 207 'show_config'])
Chris@87 208 __all__.extend(core.__all__)
Chris@87 209 __all__.extend(_mat.__all__)
Chris@87 210 __all__.extend(lib.__all__)
Chris@87 211 __all__.extend(['linalg', 'fft', 'random', 'ctypeslib', 'ma'])
Chris@87 212
Chris@87 213 # Filter annoying Cython warnings that serve no good purpose.
Chris@87 214 import warnings
Chris@87 215 warnings.filterwarnings("ignore", message="numpy.dtype size changed")
Chris@87 216 warnings.filterwarnings("ignore", message="numpy.ufunc size changed")