@@ -256,22 +256,22 @@ def histogramdd(sample, bins=10, range=None, normed=False, weights=None):
256
256
257
257
range : sequence, optional
258
258
A sequence of lower and upper bin edges to be used if the edges are
259
- not given explicitely in `bins`. Defaults to the minimum and maximum
259
+ not given explicitly in `bins`. Defaults to the minimum and maximum
260
260
values along each dimension.
261
261
normed : bool, optional
262
- If False, returns the number of samples in each bin. If True, returns
263
- the bin density, ie, the bin count divided by the bin hypervolume .
262
+ If False, returns the number of samples in each bin. If True,
263
+ returns the bin density ``bin_count / sample_count / bin_volume`` .
264
264
weights : array_like (N,), optional
265
265
An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`.
266
- Weights are normalized to 1 if normed is True. If normed is False, the
267
- values of the returned histogram are equal to the sum of the weights
268
- belonging to the samples falling into each bin.
266
+ Weights are normalized to 1 if normed is True. If normed is False,
267
+ the values of the returned histogram are equal to the sum of the
268
+ weights belonging to the samples falling into each bin.
269
269
270
270
Returns
271
271
-------
272
272
H : ndarray
273
- The multidimensional histogram of sample x. See normed and weights for
274
- the different possible semantics.
273
+ The multidimensional histogram of sample x. See normed and weights
274
+ for the different possible semantics.
275
275
edges : list
276
276
A list of D arrays describing the bin edges for each dimension.
277
277
@@ -1101,7 +1101,7 @@ def interp(x, xp, fp, left=None, right=None):
1101
1101
-----
1102
1102
Does not check that the x-coordinate sequence `xp` is increasing.
1103
1103
If `xp` is not increasing, the results are nonsense.
1104
- A simple check for increasingness is::
1104
+ A simple check for increasing is::
1105
1105
1106
1106
np.all(np.diff(xp) > 0)
1107
1107
@@ -1578,15 +1578,16 @@ class vectorize(object):
1578
1578
The `vectorize` function is provided primarily for convenience, not for
1579
1579
performance. The implementation is essentially a for loop.
1580
1580
1581
- If `otypes` is not specified, then a call to the function with the first
1582
- argument will be used to determine the number of outputs. The results of
1583
- this call will be cached if `cache` is `True` to prevent calling the
1584
- function twice. However, to implement the cache, the original function
1585
- must be wrapped which will slow down subsequent calls, so only do this if
1586
- your function is expensive.
1581
+ If `otypes` is not specified, then a call to the function with the
1582
+ first argument will be used to determine the number of outputs. The
1583
+ results of this call will be cached if `cache` is `True` to prevent
1584
+ calling the function twice. However, to implement the cache, the
1585
+ original function must be wrapped which will slow down subsequent
1586
+ calls, so only do this if your function is expensive.
1587
+
1588
+ The new keyword argument interface and `excluded` argument support
1589
+ further degrades performance.
1587
1590
1588
- The new keyword argument interface and `excluded` argument support further
1589
- degrades performance.
1590
1591
"""
1591
1592
def __init__ (self , pyfunc , otypes = '' , doc = None , excluded = None ,
1592
1593
cache = False ):
@@ -1911,7 +1912,7 @@ def blackman(M):
1911
1912
"""
1912
1913
Return the Blackman window.
1913
1914
1914
- The Blackman window is a taper formed by using the the first three
1915
+ The Blackman window is a taper formed by using the first three
1915
1916
terms of a summation of cosines. It was designed to have close to the
1916
1917
minimal leakage possible. It is close to optimal, only slightly worse
1917
1918
than a Kaiser window.
@@ -2141,9 +2142,10 @@ def hanning(M):
2141
2142
.. math:: w(n) = 0.5 - 0.5cos\\ left(\\ frac{2\\ pi{n}}{M-1}\\ right)
2142
2143
\\ qquad 0 \\ leq n \\ leq M-1
2143
2144
2144
- The Hanning was named for Julius van Hann, an Austrian meterologist. It is
2145
- also known as the Cosine Bell. Some authors prefer that it be called a
2146
- Hann window, to help avoid confusion with the very similar Hamming window.
2145
+ The Hanning was named for Julius van Hann, an Austrian meteorologist.
2146
+ It is also known as the Cosine Bell. Some authors prefer that it be
2147
+ called a Hann window, to help avoid confusion with the very similar
2148
+ Hamming window.
2147
2149
2148
2150
Most references to the Hanning window come from the signal processing
2149
2151
literature, where it is used as one of many windowing functions for
@@ -2240,9 +2242,9 @@ def hamming(M):
2240
2242
.. math:: w(n) = 0.54 - 0.46cos\\ left(\\ frac{2\\ pi{n}}{M-1}\\ right)
2241
2243
\\ qquad 0 \\ leq n \\ leq M-1
2242
2244
2243
- The Hamming was named for R. W. Hamming, an associate of J. W. Tukey and
2244
- is described in Blackman and Tukey. It was recommended for smoothing the
2245
- truncated autocovariance function in the time domain.
2245
+ The Hamming was named for R. W. Hamming, an associate of J. W. Tukey
2246
+ and is described in Blackman and Tukey. It was recommended for
2247
+ smoothing the truncated autocovariance function in the time domain.
2246
2248
Most references to the Hamming window come from the signal processing
2247
2249
literature, where it is used as one of many windowing functions for
2248
2250
smoothing values. It is also known as an apodization (which means
@@ -2422,11 +2424,11 @@ def i0(x):
2422
2424
Notes
2423
2425
-----
2424
2426
We use the algorithm published by Clenshaw [1]_ and referenced by
2425
- Abramowitz and Stegun [2]_, for which the function domain is partitioned
2426
- into the two intervals [0,8] and (8,inf), and Chebyshev polynomial
2427
- expansions are employed in each interval. Relative error on the domain
2428
- [0,30] using IEEE arithmetic is documented [3]_ as having a peak of 5.8e-16
2429
- with an rms of 1.4e-16 (n = 30000).
2427
+ Abramowitz and Stegun [2]_, for which the function domain is
2428
+ partitioned into the two intervals [0,8] and (8,inf), and Chebyshev
2429
+ polynomial expansions are employed in each interval. Relative error on
2430
+ the domain [0,30] using IEEE arithmetic is documented [3]_ as having a
2431
+ peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000).
2430
2432
2431
2433
References
2432
2434
----------
@@ -2496,12 +2498,11 @@ def kaiser(M, beta):
2496
2498
2497
2499
where :math:`I_0` is the modified zeroth-order Bessel function.
2498
2500
2499
- The Kaiser was named for Jim Kaiser, who discovered a simple approximation
2500
- to the DPSS window based on Bessel functions.
2501
- The Kaiser window is a very good approximation to the Digital Prolate
2502
- Spheroidal Sequence, or Slepian window, which is the transform which
2503
- maximizes the energy in the main lobe of the window relative to total
2504
- energy.
2501
+ The Kaiser was named for Jim Kaiser, who discovered a simple
2502
+ approximation to the DPSS window based on Bessel functions. The Kaiser
2503
+ window is a very good approximation to the Digital Prolate Spheroidal
2504
+ Sequence, or Slepian window, which is the transform which maximizes the
2505
+ energy in the main lobe of the window relative to total energy.
2505
2506
2506
2507
The Kaiser can approximate many other windows by varying the beta
2507
2508
parameter.
@@ -2611,8 +2612,8 @@ def sinc(x):
2611
2612
The name sinc is short for "sine cardinal" or "sinus cardinalis".
2612
2613
2613
2614
The sinc function is used in various signal processing applications,
2614
- including in anti-aliasing, in the construction of a
2615
- Lanczos resampling filter, and in interpolation.
2615
+ including in anti-aliasing, in the construction of a Lanczos resampling
2616
+ filter, and in interpolation.
2616
2617
2617
2618
For bandlimited interpolation of discrete-time signals, the ideal
2618
2619
interpolation kernel is proportional to the sinc function.
@@ -2708,23 +2709,23 @@ def median(a, axis=None, out=None, overwrite_input=False):
2708
2709
Axis along which the medians are computed. The default (axis=None)
2709
2710
is to compute the median along a flattened version of the array.
2710
2711
out : ndarray, optional
2711
- Alternative output array in which to place the result. It must
2712
- have the same shape and buffer length as the expected output,
2713
- but the type (of the output) will be cast if necessary.
2712
+ Alternative output array in which to place the result. It must have
2713
+ the same shape and buffer length as the expected output, but the
2714
+ type (of the output) will be cast if necessary.
2714
2715
overwrite_input : bool, optional
2715
2716
If True, then allow use of memory of input array (a) for
2716
2717
calculations. The input array will be modified by the call to
2717
- median. This will save memory when you do not need to preserve
2718
- the contents of the input array. Treat the input as undefined,
2719
- but it will probably be fully or partially sorted. Default is
2720
- False. Note that, if `overwrite_input` is True and the input
2721
- is not already an ndarray, an error will be raised.
2718
+ median. This will save memory when you do not need to preserve the
2719
+ contents of the input array. Treat the input as undefined, but it
2720
+ will probably be fully or partially sorted. Default is False. Note
2721
+ that, if `overwrite_input` is True and the input is not already an
2722
+ ndarray, an error will be raised.
2722
2723
2723
2724
Returns
2724
2725
-------
2725
2726
median : ndarray
2726
- A new array holding the result (unless `out` is specified, in
2727
- which case that array is returned instead). If the input contains
2727
+ A new array holding the result (unless `out` is specified, in which
2728
+ case that array is returned instead). If the input contains
2728
2729
integers, or floats of smaller precision than 64, then the output
2729
2730
data-type is float64. Otherwise, the output data-type is the same
2730
2731
as that of the input.
@@ -2861,26 +2862,26 @@ def percentile(a, q, axis=None, out=None,
2861
2862
Returns
2862
2863
-------
2863
2864
percentile : scalar or ndarray
2864
- If a single percentile `q` is given and axis=None a scalar is returned.
2865
- If multiple percentiles `q` are given an array holding the result is
2866
- returned. The results are listed in the first axis.
2867
- (If `out` is specified, in which case that array is returned instead).
2868
- If the input contains integers, or floats of smaller precision than 64,
2869
- then the output data-type is float64. Otherwise, the output data-type
2870
- is the same as that of the input.
2865
+ If a single percentile `q` is given and axis=None a scalar is
2866
+ returned. If multiple percentiles `q` are given an array holding
2867
+ the result is returned. The results are listed in the first axis.
2868
+ (If `out` is specified, in which case that array is returned
2869
+ instead). If the input contains integers, or floats of smaller
2870
+ precision than 64, then the output data-type is float64. Otherwise,
2871
+ the output data-type is the same as that of the input.
2871
2872
2872
2873
See Also
2873
2874
--------
2874
2875
mean, median
2875
2876
2876
2877
Notes
2877
2878
-----
2878
- Given a vector V of length N, the qth percentile of V is the qth ranked
2879
- value in a sorted copy of V. The values and distances of the two nearest
2880
- neighbors as well as the `interpolation` parameter will determine the
2881
- percentile if the normalized ranking does not match q exactly. This
2882
- function is the same as the median if ``q=50``, the same as the minimum
2883
- if ``q=0``and the same as the maximum if ``q=100``.
2879
+ Given a vector V of length N, the q-th percentile of V is the q-th ranked
2880
+ value in a sorted copy of V. The values and distances of the two
2881
+ nearest neighbors as well as the `interpolation` parameter will
2882
+ determine the percentile if the normalized ranking does not match q
2883
+ exactly. This function is the same as the median if ``q=50``, the same
2884
+ as the minimum if ``q=0``and the same as the maximum if ``q=100``.
2884
2885
2885
2886
Examples
2886
2887
--------
@@ -3031,10 +3032,11 @@ def trapz(y, x=None, dx=1.0, axis=-1):
3031
3032
3032
3033
Notes
3033
3034
-----
3034
- Image [2]_ illustrates trapezoidal rule -- y-axis locations of points will
3035
- be taken from `y` array, by default x-axis distances between points will be
3036
- 1.0, alternatively they can be provided with `x` array or with `dx` scalar.
3037
- Return value will be equal to combined area under the red lines.
3035
+ Image [2]_ illustrates trapezoidal rule -- y-axis locations of points
3036
+ will be taken from `y` array, by default x-axis distances between
3037
+ points will be 1.0, alternatively they can be provided with `x` array
3038
+ or with `dx` scalar. Return value will be equal to combined area under
3039
+ the red lines.
3038
3040
3039
3041
3040
3042
References
@@ -3147,12 +3149,12 @@ def meshgrid(*xi, **kwargs):
3147
3149
If True a sparse grid is returned in order to conserve memory.
3148
3150
Default is False.
3149
3151
copy : bool, optional
3150
- If False, a view into the original arrays are returned in
3151
- order to conserve memory. Default is True. Please note that
3152
- ``sparse=False, copy=False`` will likely return non-contiguous arrays.
3153
- Furthermore, more than one element of a broadcast array may refer to
3154
- a single memory location. If you need to write to the arrays, make
3155
- copies first.
3152
+ If False, a view into the original arrays are returned in order to
3153
+ conserve memory. Default is True. Please note that
3154
+ ``sparse=False, copy=False`` will likely return non-contiguous
3155
+ arrays. Furthermore, more than one element of a broadcast array
3156
+ may refer to a single memory location. If you need to write to the
3157
+ arrays, make copies first.
3156
3158
3157
3159
Returns
3158
3160
-------
@@ -3166,13 +3168,13 @@ def meshgrid(*xi, **kwargs):
3166
3168
Notes
3167
3169
-----
3168
3170
This function supports both indexing conventions through the indexing
3169
- keyword argument. Giving the string 'ij' returns a meshgrid with matrix
3170
- indexing, while 'xy' returns a meshgrid with Cartesian indexing. In the
3171
- 2-D case with inputs of length M and N, the outputs are of shape (N, M) for
3172
- 'xy' indexing and (M, N) for 'ij' indexing. In the 3-D case with inputs of
3173
- length M, N and P, outputs are of shape (N, M, P) for 'xy' indexing and
3174
- (M, N, P) for 'ij' indexing. The difference is illustrated by the
3175
- following code snippet::
3171
+ keyword argument. Giving the string 'ij' returns a meshgrid with
3172
+ matrix indexing, while 'xy' returns a meshgrid with Cartesian indexing.
3173
+ In the 2-D case with inputs of length M and N, the outputs are of shape
3174
+ (N, M) for 'xy' indexing and (M, N) for 'ij' indexing. In the 3-D case
3175
+ with inputs of length M, N and P, outputs are of shape (N, M, P) for
3176
+ 'xy' indexing and (M, N, P) for 'ij' indexing. The difference is
3177
+ illustrated by the following code snippet::
3176
3178
3177
3179
xv, yv = meshgrid(x, y, sparse=False, indexing='ij')
3178
3180
for i in range(nx):
@@ -3184,7 +3186,8 @@ def meshgrid(*xi, **kwargs):
3184
3186
for j in range(ny):
3185
3187
# treat xv[j,i], yv[j,i]
3186
3188
3187
- In the 1-D and 0-D case, the indexing and sparse keywords have no effect.
3189
+ In the 1-D and 0-D case, the indexing and sparse keywords have no
3190
+ effect.
3188
3191
3189
3192
See Also
3190
3193
--------
@@ -3260,7 +3263,8 @@ def meshgrid(*xi, **kwargs):
3260
3263
def delete (arr , obj , axis = None ):
3261
3264
"""
3262
3265
Return a new array with sub-arrays along an axis deleted. For a one
3263
- dimensional array, this returns those entries not returned by `arr[obj]`.
3266
+ dimensional array, this returns those entries not returned by
3267
+ `arr[obj]`.
3264
3268
3265
3269
Parameters
3266
3270
----------
@@ -3287,9 +3291,11 @@ def delete(arr, obj, axis=None):
3287
3291
Notes
3288
3292
-----
3289
3293
Often it is preferable to use a boolean mask. For example:
3294
+
3290
3295
>>> mask = np.ones(len(arr), dtype=bool)
3291
3296
>>> mask[[0,2,4]] = False
3292
3297
>>> result = arr[mask,...]
3298
+
3293
3299
Is equivalent to `np.delete(arr, [0,2,4], axis=0)`, but allows further
3294
3300
use of `mask`.
3295
3301
@@ -3467,7 +3473,8 @@ def insert(arr, obj, values, axis=None):
3467
3473
.. versionadded:: 1.8.0
3468
3474
3469
3475
Support for multiple insertions when `obj` is a single scalar or a
3470
- sequence with one element (similar to calling insert multiple times).
3476
+ sequence with one element (similar to calling insert multiple
3477
+ times).
3471
3478
values : array_like
3472
3479
Values to insert into `arr`. If the type of `values` is different
3473
3480
from that of `arr`, `values` is converted to the type of `arr`.
@@ -3666,19 +3673,19 @@ def append(arr, values, axis=None):
3666
3673
Values are appended to a copy of this array.
3667
3674
values : array_like
3668
3675
These values are appended to a copy of `arr`. It must be of the
3669
- correct shape (the same shape as `arr`, excluding `axis`). If `axis`
3670
- is not specified, `values` can be any shape and will be flattened
3671
- before use.
3676
+ correct shape (the same shape as `arr`, excluding `axis`). If
3677
+ `axis` is not specified, `values` can be any shape and will be
3678
+ flattened before use.
3672
3679
axis : int, optional
3673
- The axis along which `values` are appended. If `axis` is not given,
3674
- both `arr` and `values` are flattened before use.
3680
+ The axis along which `values` are appended. If `axis` is not
3681
+ given, both `arr` and `values` are flattened before use.
3675
3682
3676
3683
Returns
3677
3684
-------
3678
3685
append : ndarray
3679
- A copy of `arr` with `values` appended to `axis`. Note that `append`
3680
- does not occur in-place: a new array is allocated and filled. If
3681
- `axis` is None, `out` is a flattened array.
3686
+ A copy of `arr` with `values` appended to `axis`. Note that
3687
+ `append` does not occur in-place: a new array is allocated and
3688
+ filled. If `axis` is None, `out` is a flattened array.
3682
3689
3683
3690
See Also
3684
3691
--------
0 commit comments