diff options
Diffstat (limited to 'doc/source/reference')
-rw-r--r-- | doc/source/reference/arrays.classes.rst | 1 | ||||
-rw-r--r-- | doc/source/reference/arrays.ndarray.rst | 6 | ||||
-rw-r--r-- | doc/source/reference/arrays.nditer.cython.rst | 8 | ||||
-rw-r--r-- | doc/source/reference/arrays.nditer.rst | 8 | ||||
-rw-r--r-- | doc/source/reference/distutils.rst | 2 | ||||
-rw-r--r-- | doc/source/reference/maskedarray.baseclass.rst | 1 | ||||
-rw-r--r-- | doc/source/reference/maskedarray.generic.rst | 2 | ||||
-rw-r--r-- | doc/source/reference/random/generator.rst | 10 | ||||
-rw-r--r-- | doc/source/reference/routines.polynomials.classes.rst | 20 |
9 files changed, 25 insertions, 33 deletions
diff --git a/doc/source/reference/arrays.classes.rst b/doc/source/reference/arrays.classes.rst index 92c271f6b..4e908678d 100644 --- a/doc/source/reference/arrays.classes.rst +++ b/doc/source/reference/arrays.classes.rst @@ -7,7 +7,6 @@ Standard array subclasses .. currentmodule:: numpy .. for doctests - >>> import numpy as np >>> np.random.seed(1) .. note:: diff --git a/doc/source/reference/arrays.ndarray.rst b/doc/source/reference/arrays.ndarray.rst index 0f703b475..66ebb66fb 100644 --- a/doc/source/reference/arrays.ndarray.rst +++ b/doc/source/reference/arrays.ndarray.rst @@ -54,13 +54,13 @@ objects implementing the :class:`buffer` or :ref:`array >>> y = x[:,1] >>> y - array([2, 5]) + array([2, 5], dtype=int32) >>> y[0] = 9 # this also changes the corresponding element in x >>> y - array([9, 5]) + array([9, 5], dtype=int32) >>> x array([[1, 9, 3], - [4, 5, 6]]) + [4, 5, 6]], dtype=int32) Constructing arrays diff --git a/doc/source/reference/arrays.nditer.cython.rst b/doc/source/reference/arrays.nditer.cython.rst index 43aad9927..66485fc8a 100644 --- a/doc/source/reference/arrays.nditer.cython.rst +++ b/doc/source/reference/arrays.nditer.cython.rst @@ -49,7 +49,7 @@ Here's how this looks. ... >>> a = np.arange(6).reshape(2,3) >>> sum_squares_py(a) - array(55.0) + array(55.) >>> sum_squares_py(a, axis=-1) array([ 5., 50.]) @@ -117,11 +117,11 @@ as our native Python/NumPy code did. .. admonition:: Example - >>> from sum_squares import sum_squares_cy + >>> from sum_squares import sum_squares_cy #doctest: +SKIP >>> a = np.arange(6).reshape(2,3) - >>> sum_squares_cy(a) + >>> sum_squares_cy(a) #doctest: +SKIP array(55.0) - >>> sum_squares_cy(a, axis=-1) + >>> sum_squares_cy(a, axis=-1) #doctest: +SKIP array([ 5., 50.]) Doing a little timing in IPython shows that the reduced overhead and diff --git a/doc/source/reference/arrays.nditer.rst b/doc/source/reference/arrays.nditer.rst index 72a04f73e..8cabc1a06 100644 --- a/doc/source/reference/arrays.nditer.rst +++ b/doc/source/reference/arrays.nditer.rst @@ -1,9 +1,5 @@ .. currentmodule:: numpy -.. for doctests - The last section on Cython is 'included' at the end of this file. The tests - for that section are disabled. - .. _arrays.nditer: ********************* @@ -489,9 +485,9 @@ reasons. >>> b = np.zeros((3,)) >>> square([1,2,3], out=b) - array([ 1., 4., 9.]) + array([1., 4., 9.]) >>> b - array([ 1., 4., 9.]) + array([1., 4., 9.]) >>> square(np.arange(6).reshape(2,3), out=b) Traceback (most recent call last): diff --git a/doc/source/reference/distutils.rst b/doc/source/reference/distutils.rst index f201ba668..9db757c89 100644 --- a/doc/source/reference/distutils.rst +++ b/doc/source/reference/distutils.rst @@ -188,6 +188,8 @@ Info are easily retrieved from the `get_info` function in >>> info = np.distutils.misc_util.get_info('npymath') >>> config.add_extension('foo', sources=['foo.c'], extra_info=info) + <numpy.distutils.extension.Extension('foo') at 0x...> + An additional list of paths to look for .ini files can be given to `get_info`. diff --git a/doc/source/reference/maskedarray.baseclass.rst b/doc/source/reference/maskedarray.baseclass.rst index 5a0f99651..44792a0d6 100644 --- a/doc/source/reference/maskedarray.baseclass.rst +++ b/doc/source/reference/maskedarray.baseclass.rst @@ -1,7 +1,6 @@ .. currentmodule:: numpy.ma .. for doctests - >>> import numpy as np >>> from numpy import ma .. _numpy.ma.constants: diff --git a/doc/source/reference/maskedarray.generic.rst b/doc/source/reference/maskedarray.generic.rst index d3849c50d..29fc2fe07 100644 --- a/doc/source/reference/maskedarray.generic.rst +++ b/doc/source/reference/maskedarray.generic.rst @@ -467,7 +467,7 @@ Suppose now that we wish to print that same data, but with the missing values replaced by the average value. >>> print(mx.filled(mx.mean())) - [ 0. 1. 2. 3. 4.] + [0. 1. 2. 3. 4.] Numerical operations diff --git a/doc/source/reference/random/generator.rst b/doc/source/reference/random/generator.rst index 7934be98a..a0ef01dcb 100644 --- a/doc/source/reference/random/generator.rst +++ b/doc/source/reference/random/generator.rst @@ -73,12 +73,12 @@ the value of the ``out`` parameter. For example, >>> rng = np.random.default_rng() >>> x = np.arange(0, 15).reshape(3, 5) - >>> x + >>> x #doctest: +SKIP array([[ 0, 1, 2, 3, 4], [ 5, 6, 7, 8, 9], [10, 11, 12, 13, 14]]) >>> y = rng.permuted(x, axis=1, out=x) - >>> x + >>> x #doctest: +SKIP array([[ 1, 0, 2, 4, 3], # random [ 6, 7, 8, 9, 5], [10, 14, 11, 13, 12]]) @@ -103,7 +103,7 @@ array, and ``axis=1`` will rearrange the columns. For example array([[ 0, 1, 2, 3, 4], [ 5, 6, 7, 8, 9], [10, 11, 12, 13, 14]]) - >>> rng.permutation(x, axis=1) + >>> rng.permutation(x, axis=1) #doctest: +SKIP array([[ 1, 3, 2, 0, 4], # random [ 6, 8, 7, 5, 9], [11, 13, 12, 10, 14]]) @@ -116,7 +116,7 @@ how `numpy.sort` treats it. Each slice along the given axis is shuffled independently of the others. Compare the following example of the use of `Generator.permuted` to the above example of `Generator.permutation`: - >>> rng.permuted(x, axis=1) + >>> rng.permuted(x, axis=1) #doctest: +SKIP array([[ 1, 0, 2, 4, 3], # random [ 5, 7, 6, 9, 8], [10, 14, 12, 13, 11]]) @@ -134,7 +134,7 @@ For example, >>> rng = np.random.default_rng() >>> a = ['A', 'B', 'C', 'D', 'E'] >>> rng.shuffle(a) # shuffle the list in-place - >>> a + >>> a #doctest: +SKIP ['B', 'D', 'A', 'E', 'C'] # random Distributions diff --git a/doc/source/reference/routines.polynomials.classes.rst b/doc/source/reference/routines.polynomials.classes.rst index 5f575bed1..2ce29d9d0 100644 --- a/doc/source/reference/routines.polynomials.classes.rst +++ b/doc/source/reference/routines.polynomials.classes.rst @@ -59,11 +59,11 @@ first is the coefficients, the second is the domain, and the third is the window:: >>> p.coef - array([ 1., 2., 3.]) + array([1., 2., 3.]) >>> p.domain - array([-1., 1.]) + array([-1, 1]) >>> p.window - array([-1., 1.]) + array([-1, 1]) Printing a polynomial yields the polynomial expression in a more familiar format:: @@ -77,7 +77,7 @@ representation is also available (default on Windows). The polynomial string format can be toggled at the package-level with the `~numpy.polynomial.set_default_printstyle` function:: - >>> numpy.polynomial.set_default_printstyle('ascii') + >>> np.polynomial.set_default_printstyle('ascii') >>> print(p) 1.0 + 2.0 x**1 + 3.0 x**2 @@ -137,9 +137,9 @@ Evaluation:: array([ 1., 6., 17., 34., 57.]) >>> x = np.arange(6).reshape(3,2) >>> p(x) - array([[ 1., 6.], - [ 17., 34.], - [ 57., 86.]]) + array([[ 1., 6.], + [17., 34.], + [57., 86.]]) Substitution: @@ -294,7 +294,6 @@ polynomials up to degree 5 are plotted below. ... ax = plt.plot(x, T.basis(i)(x), lw=2, label=f"$T_{i}$") ... >>> plt.legend(loc="upper left") - <matplotlib.legend.Legend object at 0x3b3ee10> >>> plt.show() In the range -1 <= `x` <= 1 they are nice, equiripple functions lying between +/- 1. @@ -309,7 +308,6 @@ The same plots over the range -2 <= `x` <= 2 look very different: ... ax = plt.plot(x, T.basis(i)(x), lw=2, label=f"$T_{i}$") ... >>> plt.legend(loc="lower right") - <matplotlib.legend.Legend object at 0x3b3ee10> >>> plt.show() As can be seen, the "good" parts have shrunk to insignificance. In using @@ -335,12 +333,10 @@ illustrated below for a fit to a noisy sine curve. >>> y = np.sin(x) + np.random.normal(scale=.1, size=x.shape) >>> p = T.fit(x, y, 5) >>> plt.plot(x, y, 'o') - [<matplotlib.lines.Line2D object at 0x2136c10>] >>> xx, yy = p.linspace() >>> plt.plot(xx, yy, lw=2) - [<matplotlib.lines.Line2D object at 0x1cf2890>] >>> p.domain - array([ 0. , 6.28318531]) + array([0. , 6.28318531]) >>> p.window array([-1., 1.]) >>> plt.show() |