diff options
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/numeric.py | 2 | ||||
-rw-r--r-- | numpy/distutils/misc_util.py | 12 | ||||
-rw-r--r-- | numpy/doc/glossary.py | 30 | ||||
-rw-r--r-- | numpy/doc/structured_arrays.py | 4 | ||||
-rw-r--r-- | numpy/linalg/linalg.py | 2 | ||||
-rw-r--r-- | numpy/random/mtrand/mtrand.pyx | 54 |
6 files changed, 65 insertions, 39 deletions
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 77aaf6dec..1108d4667 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -2529,7 +2529,7 @@ def seterr(all=None, divide=None, over=None, under=None, invalid=None): Notes ----- - The floating-point exceptions are defined in the IEEE 754 standard [1]: + The floating-point exceptions are defined in the IEEE 754 standard [1]_: - Division by zero: infinite result obtained from finite numbers. - Overflow: result too large to be expressed. diff --git a/numpy/distutils/misc_util.py b/numpy/distutils/misc_util.py index 1d08942f6..cb7414a04 100644 --- a/numpy/distutils/misc_util.py +++ b/numpy/distutils/misc_util.py @@ -1218,15 +1218,15 @@ class Configuration(object): #. file.txt -> (., file.txt)-> parent/file.txt #. foo/file.txt -> (foo, foo/file.txt) -> parent/foo/file.txt #. /foo/bar/file.txt -> (., /foo/bar/file.txt) -> parent/file.txt - #. *.txt -> parent/a.txt, parent/b.txt - #. foo/*.txt -> parent/foo/a.txt, parent/foo/b.txt - #. */*.txt -> (*, */*.txt) -> parent/c/a.txt, parent/d/b.txt + #. ``*``.txt -> parent/a.txt, parent/b.txt + #. foo/``*``.txt`` -> parent/foo/a.txt, parent/foo/b.txt + #. ``*/*.txt`` -> (``*``, ``*``/``*``.txt) -> parent/c/a.txt, parent/d/b.txt #. (sun, file.txt) -> parent/sun/file.txt #. (sun, bar/file.txt) -> parent/sun/file.txt #. (sun, /foo/bar/file.txt) -> parent/sun/file.txt - #. (sun, *.txt) -> parent/sun/a.txt, parent/sun/b.txt - #. (sun, bar/*.txt) -> parent/sun/a.txt, parent/sun/b.txt - #. (sun/*, */*.txt) -> parent/sun/c/a.txt, parent/d/b.txt + #. (sun, ``*``.txt) -> parent/sun/a.txt, parent/sun/b.txt + #. (sun, bar/``*``.txt) -> parent/sun/a.txt, parent/sun/b.txt + #. (sun/``*``, ``*``/``*``.txt) -> parent/sun/c/a.txt, parent/d/b.txt An additional feature is that the path to a data-file can actually be a function that takes no arguments and returns the actual path(s) to diff --git a/numpy/doc/glossary.py b/numpy/doc/glossary.py index 9b7d613ba..0e1df495b 100644 --- a/numpy/doc/glossary.py +++ b/numpy/doc/glossary.py @@ -48,7 +48,7 @@ Glossary array([(1, 2.0), (3, 4.0)], dtype=[('x', '<i4'), ('y', '<f8')]) - Fast element-wise operations, called :term:`ufuncs`, operate on arrays. + Fast element-wise operations, called a :term:`ufunc`, operate on arrays. array_like Any sequence that can be interpreted as an ndarray. This includes @@ -62,6 +62,12 @@ Glossary >>> x.shape (3,) + big-endian + When storing a multi-byte value in memory as a sequence of bytes, the + sequence addresses/sends/stores the most significant byte first (lowest + address) and the least significant byte last (highest address). Common in + micro-processors and used for transmission of data over network protocols. + BLAS `Basic Linear Algebra Subprograms <http://en.wikipedia.org/wiki/BLAS>`_ @@ -151,6 +157,11 @@ Glossary For more information on dictionaries, read the `Python tutorial <http://docs.python.org/tut>`_. + field + In a :term:`structured data type`, each sub-type is called a `field`. + The `field` has a name (a string), a type (any valid :term:`dtype`, and + an optional `title`. See :ref:`arrays.dtypes` + Fortran order See `column-major` @@ -158,6 +169,12 @@ Glossary Collapsed to a one-dimensional array. See `numpy.ndarray.flatten` for details. + homogenous + Describes a block of memory comprised of blocks, each block comprised of + items and of the same size, and blocks are interpreted in exactly the + same way. In the simplest case each block contains a single item, for + instance int32 or float64. + immutable An object that cannot be modified after execution is called immutable. Two common examples are strings and tuples. @@ -224,6 +241,12 @@ Glossary tutorial <http://docs.python.org/tut>`_. For a mapping type (key-value), see *dictionary*. + little-endian + When storing a multi-byte value in memory as a sequence of bytes, the + sequence addresses/sends/stores the least significant byte first (lowest + address) and the most significant byte last (highest address). Common in + x86 processors. + mask A boolean array, used to select only certain elements for an operation:: @@ -285,7 +308,7 @@ Glossary See *array*. record array - An :term:`ndarray` with :term:`structured data type`_ which has been + An :term:`ndarray` with :term:`structured data type` which has been subclassed as ``np.recarray`` and whose dtype is of type ``np.record``, making the fields of its data type to be accessible by attribute. @@ -350,6 +373,9 @@ Glossary >>> x[:, 1] array([2, 4]) + structure + See :term:`structured data type` + structured data type A data type composed of other datatypes diff --git a/numpy/doc/structured_arrays.py b/numpy/doc/structured_arrays.py index af02e2173..ba667da59 100644 --- a/numpy/doc/structured_arrays.py +++ b/numpy/doc/structured_arrays.py @@ -284,7 +284,7 @@ the desired underlying dtype, and fields and flags will be copied from ``dtype``. This dtype is similar to a 'union' in C. Indexing and Assignment to Structured arrays -============================================= +============================================ Assigning data to a Structured Array ------------------------------------ @@ -293,7 +293,7 @@ There are a number of ways to assign values to a structured array: Using python tuples, using scalar values, or using other structured arrays. Assignment from Python Native Types (Tuples) -``````````````````````````````````````````` +```````````````````````````````````````````` The simplest way to assign values to a structured array is using python tuples. Each assigned value should be a tuple of length equal to the number of fields diff --git a/numpy/linalg/linalg.py b/numpy/linalg/linalg.py index f073abadf..4905690ad 100644 --- a/numpy/linalg/linalg.py +++ b/numpy/linalg/linalg.py @@ -1987,7 +1987,7 @@ def lstsq(a, b, rcond="warn"): [ 2., 1.], [ 3., 1.]]) - >>> m, c = np.linalg.lstsq(A, y)[0] + >>> m, c = np.linalg.lstsq(A, y, rcond=None)[0] >>> print(m, c) 1.0 -0.95 diff --git a/numpy/random/mtrand/mtrand.pyx b/numpy/random/mtrand/mtrand.pyx index 1846a363f..4dabaa093 100644 --- a/numpy/random/mtrand/mtrand.pyx +++ b/numpy/random/mtrand/mtrand.pyx @@ -1284,7 +1284,7 @@ cdef class RandomState: probability density function: >>> import matplotlib.pyplot as plt - >>> count, bins, ignored = plt.hist(s, 15, normed=True) + >>> count, bins, ignored = plt.hist(s, 15, density=True) >>> plt.plot(bins, np.ones_like(bins), linewidth=2, color='r') >>> plt.show() @@ -1495,7 +1495,7 @@ cdef class RandomState: Display results as a histogram: >>> import matplotlib.pyplot as plt - >>> count, bins, ignored = plt.hist(dsums, 11, normed=True) + >>> count, bins, ignored = plt.hist(dsums, 11, density=True) >>> plt.show() """ @@ -1631,7 +1631,7 @@ cdef class RandomState: the probability density function: >>> import matplotlib.pyplot as plt - >>> count, bins, ignored = plt.hist(s, 30, normed=True) + >>> count, bins, ignored = plt.hist(s, 30, density=True) >>> plt.plot(bins, 1/(sigma * np.sqrt(2 * np.pi)) * ... np.exp( - (bins - mu)**2 / (2 * sigma**2) ), ... linewidth=2, color='r') @@ -1874,7 +1874,7 @@ cdef class RandomState: >>> import matplotlib.pyplot as plt >>> import scipy.special as sps - >>> count, bins, ignored = plt.hist(s, 50, normed=True) + >>> count, bins, ignored = plt.hist(s, 50, density=True) >>> y = bins**(shape-1) * ((np.exp(-bins/scale))/ \\ ... (sps.gamma(shape) * scale**shape)) >>> plt.plot(bins, y, linewidth=2, color='r') @@ -1964,7 +1964,7 @@ cdef class RandomState: >>> import matplotlib.pyplot as plt >>> import scipy.special as sps - >>> count, bins, ignored = plt.hist(s, 50, normed=True) + >>> count, bins, ignored = plt.hist(s, 50, density=True) >>> y = bins**(shape-1)*(np.exp(-bins/scale) / ... (sps.gamma(shape)*scale**shape)) >>> plt.plot(bins, y, linewidth=2, color='r') @@ -2164,9 +2164,9 @@ cdef class RandomState: >>> dfden = 20 # within groups degrees of freedom >>> nonc = 3.0 >>> nc_vals = np.random.noncentral_f(dfnum, dfden, nonc, 1000000) - >>> NF = np.histogram(nc_vals, bins=50, normed=True) + >>> NF = np.histogram(nc_vals, bins=50, density=True) >>> c_vals = np.random.f(dfnum, dfden, 1000000) - >>> F = np.histogram(c_vals, bins=50, normed=True) + >>> F = np.histogram(c_vals, bins=50, density=True) >>> plt.plot(F[1][1:], F[0]) >>> plt.plot(NF[1][1:], NF[0]) >>> plt.show() @@ -2342,7 +2342,7 @@ cdef class RandomState: >>> import matplotlib.pyplot as plt >>> values = plt.hist(np.random.noncentral_chisquare(3, 20, 100000), - ... bins=200, normed=True) + ... bins=200, density=True) >>> plt.show() Draw values from a noncentral chisquare with very small noncentrality, @@ -2350,9 +2350,9 @@ cdef class RandomState: >>> plt.figure() >>> values = plt.hist(np.random.noncentral_chisquare(3, .0000001, 100000), - ... bins=np.arange(0., 25, .1), normed=True) + ... bins=np.arange(0., 25, .1), density=True) >>> values2 = plt.hist(np.random.chisquare(3, 100000), - ... bins=np.arange(0., 25, .1), normed=True) + ... bins=np.arange(0., 25, .1), density=True) >>> plt.plot(values[1][0:-1], values[0]-values2[0], 'ob') >>> plt.show() @@ -2361,7 +2361,7 @@ cdef class RandomState: >>> plt.figure() >>> values = plt.hist(np.random.noncentral_chisquare(3, 20, 100000), - ... bins=200, normed=True) + ... bins=200, density=True) >>> plt.show() """ @@ -2529,7 +2529,7 @@ cdef class RandomState: >>> t = (np.mean(intake)-7725)/(intake.std(ddof=1)/np.sqrt(len(intake))) >>> import matplotlib.pyplot as plt - >>> h = plt.hist(s, bins=100, normed=True) + >>> h = plt.hist(s, bins=100, density=True) For a one-sided t-test, how far out in the distribution does the t statistic appear? @@ -2630,7 +2630,7 @@ cdef class RandomState: >>> import matplotlib.pyplot as plt >>> from scipy.special import i0 - >>> plt.hist(s, 50, normed=True) + >>> plt.hist(s, 50, density=True) >>> x = np.linspace(-np.pi, np.pi, num=51) >>> y = np.exp(kappa*np.cos(x-mu))/(2*np.pi*i0(kappa)) >>> plt.plot(x, y, linewidth=2, color='r') @@ -2744,7 +2744,7 @@ cdef class RandomState: density function: >>> import matplotlib.pyplot as plt - >>> count, bins, _ = plt.hist(s, 100, normed=True) + >>> count, bins, _ = plt.hist(s, 100, density=True) >>> fit = a*m**a / bins**(a+1) >>> plt.plot(bins, max(count)*fit/max(fit), linewidth=2, color='r') >>> plt.show() @@ -2957,17 +2957,17 @@ cdef class RandomState: >>> powpdf = stats.powerlaw.pdf(xx,5) >>> plt.figure() - >>> plt.hist(rvs, bins=50, normed=True) + >>> plt.hist(rvs, bins=50, density=True) >>> plt.plot(xx,powpdf,'r-') >>> plt.title('np.random.power(5)') >>> plt.figure() - >>> plt.hist(1./(1.+rvsp), bins=50, normed=True) + >>> plt.hist(1./(1.+rvsp), bins=50, density=True) >>> plt.plot(xx,powpdf,'r-') >>> plt.title('inverse of 1 + np.random.pareto(5)') >>> plt.figure() - >>> plt.hist(1./(1.+rvsp), bins=50, normed=True) + >>> plt.hist(1./(1.+rvsp), bins=50, density=True) >>> plt.plot(xx,powpdf,'r-') >>> plt.title('inverse of stats.pareto(5)') @@ -3055,7 +3055,7 @@ cdef class RandomState: the probability density function: >>> import matplotlib.pyplot as plt - >>> count, bins, ignored = plt.hist(s, 30, normed=True) + >>> count, bins, ignored = plt.hist(s, 30, density=True) >>> x = np.arange(-8., 8., .01) >>> pdf = np.exp(-abs(x-loc)/scale)/(2.*scale) >>> plt.plot(x, pdf) @@ -3171,7 +3171,7 @@ cdef class RandomState: the probability density function: >>> import matplotlib.pyplot as plt - >>> count, bins, ignored = plt.hist(s, 30, normed=True) + >>> count, bins, ignored = plt.hist(s, 30, density=True) >>> plt.plot(bins, (1/beta)*np.exp(-(bins - mu)/beta) ... * np.exp( -np.exp( -(bins - mu) /beta) ), ... linewidth=2, color='r') @@ -3186,7 +3186,7 @@ cdef class RandomState: ... a = np.random.normal(mu, beta, 1000) ... means.append(a.mean()) ... maxima.append(a.max()) - >>> count, bins, ignored = plt.hist(maxima, 30, normed=True) + >>> count, bins, ignored = plt.hist(maxima, 30, density=True) >>> beta = np.std(maxima) * np.sqrt(6) / np.pi >>> mu = np.mean(maxima) - 0.57721*beta >>> plt.plot(bins, (1/beta)*np.exp(-(bins - mu)/beta) @@ -3381,7 +3381,7 @@ cdef class RandomState: the probability density function: >>> import matplotlib.pyplot as plt - >>> count, bins, ignored = plt.hist(s, 100, normed=True, align='mid') + >>> count, bins, ignored = plt.hist(s, 100, density=True, align='mid') >>> x = np.linspace(min(bins), max(bins), 10000) >>> pdf = (np.exp(-(np.log(x) - mu)**2 / (2 * sigma**2)) @@ -3403,7 +3403,7 @@ cdef class RandomState: ... b.append(np.product(a)) >>> b = np.array(b) / np.min(b) # scale values to be positive - >>> count, bins, ignored = plt.hist(b, 100, normed=True, align='mid') + >>> count, bins, ignored = plt.hist(b, 100, density=True, align='mid') >>> sigma = np.std(np.log(b)) >>> mu = np.mean(np.log(b)) @@ -3480,7 +3480,7 @@ cdef class RandomState: -------- Draw values from the distribution and plot the histogram - >>> values = hist(np.random.rayleigh(3, 100000), bins=200, normed=True) + >>> values = hist(np.random.rayleigh(3, 100000), bins=200, density=True) Wave heights tend to follow a Rayleigh distribution. If the mean wave height is 1 meter, what fraction of waves are likely to be larger than 3 @@ -3572,7 +3572,7 @@ cdef class RandomState: Draw values from the distribution and plot the histogram: >>> import matplotlib.pyplot as plt - >>> h = plt.hist(np.random.wald(3, 2, 100000), bins=200, normed=True) + >>> h = plt.hist(np.random.wald(3, 2, 100000), bins=200, density=True) >>> plt.show() """ @@ -3659,7 +3659,7 @@ cdef class RandomState: >>> import matplotlib.pyplot as plt >>> h = plt.hist(np.random.triangular(-3, 0, 8, 100000), bins=200, - ... normed=True) + ... density=True) >>> plt.show() """ @@ -3969,7 +3969,7 @@ cdef class RandomState: Display histogram of the sample: >>> import matplotlib.pyplot as plt - >>> count, bins, ignored = plt.hist(s, 14, normed=True) + >>> count, bins, ignored = plt.hist(s, 14, density=True) >>> plt.show() Draw each 100 values for lambda 100 and 500: @@ -4066,7 +4066,7 @@ cdef class RandomState: Truncate s values at 50 so plot is interesting: - >>> count, bins, ignored = plt.hist(s[s<50], 50, normed=True) + >>> count, bins, ignored = plt.hist(s[s<50], 50, density=True) >>> x = np.arange(1., 50.) >>> y = x**(-a) / special.zetac(a) >>> plt.plot(x, y/max(y), linewidth=2, color='r') |