comparison DEPENDENCIES/mingw32/Python27/Lib/site-packages/numpy/__init__.py @ 87:2a2c65a20a8b

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