neulab/docprompting-conala huggingface dataset:
numpy.AxisError   exception numpy.AxisError(axis, ndim=None, msg_prefix=None)[source]
 
Axis supplied was invalid. This is raised whenever an axis parameter is specified that is larger than the number of array dimensions. For compatibility with code written against older numpy versions, which raised a mixture of ValueError and IndexError for this situation, this exception subclasses both to ensure that except ValueError and except IndexError statements continue to catch AxisError.  New in version 1.13.   Parameters 
 
axisint or str


The out of bounds axis or a custom exception message. If an axis is provided, then ndim should be specified as well.  
ndimint, optional


The number of array dimensions.  
msg_prefixstr, optional


A prefix for the exception message.     Examples >>> array_1d = np.arange(10)
>>> np.cumsum(array_1d, axis=1)
Traceback (most recent call last):
  ...
numpy.AxisError: axis 1 is out of bounds for array of dimension 1
 Negative axes are preserved: >>> np.cumsum(array_1d, axis=-2)
Traceback (most recent call last):
  ...
numpy.AxisError: axis -2 is out of bounds for array of dimension 1
 The class constructor generally takes the axis and arrays’ dimensionality as arguments: >>> print(np.AxisError(2, 1, msg_prefix='error'))
error: axis 2 is out of bounds for array of dimension 1
 Alternatively, a custom exception message can be passed: >>> print(np.AxisError('Custom error message'))
Custom error message
  Attributes 
 
axisint, optional


The out of bounds axis or None if a custom exception message was provided. This should be the axis as passed by the user, before any normalization to resolve negative indices.  New in version 1.22.   
ndimint, optional


The number of array dimensions or None if a custom exception message was provided.  New in version 1.22.
numpy.bartlett   numpy.bartlett(M)[source]
 
Return the Bartlett window. The Bartlett window is very similar to a triangular window, except that the end points are at zero. It is often used in signal processing for tapering a signal, without generating too much ripple in the frequency domain.  Parameters 
 
Mint


Number of points in the output window. If zero or less, an empty array is returned.    Returns 
 
outarray


The triangular window, with the maximum value normalized to one (the value one appears only if the number of samples is odd), with the first and last samples equal to zero.      See also  
blackman, hamming, hanning, kaiser

  Notes The Bartlett window is defined as  \[w(n) = \frac{2}{M-1} \left( \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right| \right)\] Most references to the Bartlett window come from the signal processing literature, where it is used as one of many windowing functions for smoothing values. Note that convolution with this window produces linear interpolation. It is also known as an apodization (which means”removing the foot”, i.e. smoothing discontinuities at the beginning and end of the sampled signal) or tapering function. The fourier transform of the Bartlett is the product of two sinc functions. Note the excellent discussion in Kanasewich. References  1 
M.S. Bartlett, “Periodogram Analysis and Continuous Spectra”, Biometrika 37, 1-16, 1950.  2 
E.R. Kanasewich, “Time Sequence Analysis in Geophysics”, The University of Alberta Press, 1975, pp. 109-110.  3 
A.V. Oppenheim and R.W. Schafer, “Discrete-Time Signal Processing”, Prentice-Hall, 1999, pp. 468-471.  4 
Wikipedia, “Window function”, https://en.wikipedia.org/wiki/Window_function  5 
W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, “Numerical Recipes”, Cambridge University Press, 1986, page 429.   Examples >>> import matplotlib.pyplot as plt
>>> np.bartlett(12)
array([ 0.        ,  0.18181818,  0.36363636,  0.54545455,  0.72727273, # may vary
        0.90909091,  0.90909091,  0.72727273,  0.54545455,  0.36363636,
        0.18181818,  0.        ])
 Plot the window and its frequency response (requires SciPy and matplotlib): >>> from numpy.fft import fft, fftshift
>>> window = np.bartlett(51)
>>> plt.plot(window)
[<matplotlib.lines.Line2D object at 0x...>]
>>> plt.title("Bartlett window")
Text(0.5, 1.0, 'Bartlett window')
>>> plt.ylabel("Amplitude")
Text(0, 0.5, 'Amplitude')
>>> plt.xlabel("Sample")
Text(0.5, 0, 'Sample')
>>> plt.show()
    >>> plt.figure()
<Figure size 640x480 with 0 Axes>
>>> A = fft(window, 2048) / 25.5
>>> mag = np.abs(fftshift(A))
>>> freq = np.linspace(-0.5, 0.5, len(A))
>>> with np.errstate(divide='ignore', invalid='ignore'):
...     response = 20 * np.log10(mag)
...
>>> response = np.clip(response, -100, 100)
>>> plt.plot(freq, response)
[<matplotlib.lines.Line2D object at 0x...>]
>>> plt.title("Frequency response of Bartlett window")
Text(0.5, 1.0, 'Frequency response of Bartlett window')
>>> plt.ylabel("Magnitude [dB]")
Text(0, 0.5, 'Magnitude [dB]')
>>> plt.xlabel("Normalized frequency [cycles per sample]")
Text(0.5, 0, 'Normalized frequency [cycles per sample]')
>>> _ = plt.axis('tight')
>>> plt.show()
numpy.base_repr   numpy.base_repr(number, base=2, padding=0)[source]
 
Return a string representation of a number in the given base system.  Parameters 
 
numberint


The value to convert. Positive and negative values are handled.  
baseint, optional


Convert number to the base number system. The valid range is 2-36, the default value is 2.  
paddingint, optional


Number of zeros padded on the left. Default is 0 (no padding).    Returns 
 
outstr


String representation of number in base system.      See also  binary_repr

Faster version of base_repr for base 2.    Examples >>> np.base_repr(5)
'101'
>>> np.base_repr(6, 5)
'11'
>>> np.base_repr(7, base=5, padding=3)
'00012'
 >>> np.base_repr(10, base=16)
'A'
>>> np.base_repr(32, base=16)
'20'
numpy.binary_repr   numpy.binary_repr(num, width=None)[source]
 
Return the binary representation of the input number as a string. For negative numbers, if width is not given, a minus sign is added to the front. If width is given, the two’s complement of the number is returned, with respect to that width. In a two’s-complement system negative numbers are represented by the two’s complement of the absolute value. This is the most common method of representing signed integers on computers [1]. A N-bit two’s-complement system can represent every integer in the range \(-2^{N-1}\) to \(+2^{N-1}-1\).  Parameters 
 
numint


Only an integer decimal number can be used.  
widthint, optional


The length of the returned string if num is positive, or the length of the two’s complement if num is negative, provided that width is at least a sufficient number of bits for num to be represented in the designated form. If the width value is insufficient, it will be ignored, and num will be returned in binary (num > 0) or two’s complement (num < 0) form with its width equal to the minimum number of bits needed to represent the number in the designated form. This behavior is deprecated and will later raise an error.  Deprecated since version 1.12.0.     Returns 
 
binstr


Binary representation of num or two’s complement of num.      See also  base_repr

Return a string representation of a number in the given base system.  bin

Python’s built-in binary representation generator of an integer.    Notes binary_repr is equivalent to using base_repr with base 2, but about 25x faster. References  1 
Wikipedia, “Two’s complement”, https://en.wikipedia.org/wiki/Two’s_complement   Examples >>> np.binary_repr(3)
'11'
>>> np.binary_repr(-3)
'-11'
>>> np.binary_repr(3, width=4)
'0011'
 The two’s complement is returned when the input number is negative and width is specified: >>> np.binary_repr(-3, width=3)
'101'
>>> np.binary_repr(-3, width=5)
'11101'
numpy.bincount   numpy.bincount(x, /, weights=None, minlength=0)
 
Count number of occurrences of each value in array of non-negative ints. The number of bins (of size 1) is one larger than the largest value in x. If minlength is specified, there will be at least this number of bins in the output array (though it will be longer if necessary, depending on the contents of x). Each bin gives the number of occurrences of its index value in x. If weights is specified the input array is weighted by it, i.e. if a value n is found at position i, out[n] += weight[i] instead of out[n] += 1.  Parameters 
 
xarray_like, 1 dimension, nonnegative ints


Input array.  
weightsarray_like, optional


Weights, array of the same shape as x.  
minlengthint, optional


A minimum number of bins for the output array.  New in version 1.6.0.     Returns 
 
outndarray of ints


The result of binning the input array. The length of out is equal to np.amax(x)+1.    Raises 
 ValueError

If the input is not 1-dimensional, or contains elements with negative values, or if minlength is negative.  TypeError

If the type of the input is float or complex.      See also  
histogram, digitize, unique

  Examples >>> np.bincount(np.arange(5))
array([1, 1, 1, 1, 1])
>>> np.bincount(np.array([0, 1, 1, 3, 2, 1, 7]))
array([1, 3, 1, 1, 0, 0, 0, 1])
 >>> x = np.array([0, 1, 1, 3, 2, 1, 7, 23])
>>> np.bincount(x).size == np.amax(x)+1
True
 The input array needs to be of integer dtype, otherwise a TypeError is raised: >>> np.bincount(np.arange(5, dtype=float))
Traceback (most recent call last):
  ...
TypeError: Cannot cast array data from dtype('float64') to dtype('int64')
according to the rule 'safe'
 A possible use of bincount is to perform sums over variable-size chunks of an array, using the weights keyword. >>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6]) # weights
>>> x = np.array([0, 1, 1, 2, 2, 2])
>>> np.bincount(x,  weights=w)
array([ 0.3,  0.7,  1.1])
numpy.bitwise_and   numpy.bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'bitwise_and'>
 
Compute the bit-wise AND of two arrays element-wise. Computes the bit-wise AND of the underlying binary representation of the integers in the input arrays. This ufunc implements the C/Python operator &.  Parameters 
 
x1, x2array_like


Only integer and boolean types are handled. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).  
outndarray, None, or tuple of ndarray and None, optional


A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs.  
wherearray_like, optional


This condition is broadcast over the input. At locations where the condition is True, the out array will be set to the ufunc result. Elsewhere, the out array will retain its original value. Note that if an uninitialized out array is created via the default out=None, locations within it where the condition is False will remain uninitialized.  **kwargs

For other keyword-only arguments, see the ufunc docs.    Returns 
 
outndarray or scalar


Result. This is a scalar if both x1 and x2 are scalars.      See also  logical_and
bitwise_or
bitwise_xor
binary_repr

Return the binary representation of the input number as a string.    Examples The number 13 is represented by 00001101. Likewise, 17 is represented by 00010001. The bit-wise AND of 13 and 17 is therefore 000000001, or 1: >>> np.bitwise_and(13, 17)
1
 >>> np.bitwise_and(14, 13)
12
>>> np.binary_repr(12)
'1100'
>>> np.bitwise_and([14,3], 13)
array([12,  1])
 >>> np.bitwise_and([11,7], [4,25])
array([0, 1])
>>> np.bitwise_and(np.array([2,5,255]), np.array([3,14,16]))
array([ 2,  4, 16])
>>> np.bitwise_and([True, True], [False, True])
array([False,  True])
 The & operator can be used as a shorthand for np.bitwise_and on ndarrays. >>> x1 = np.array([2, 5, 255])
>>> x2 = np.array([3, 14, 16])
>>> x1 & x2
array([ 2,  4, 16])
numpy.bitwise_or   numpy.bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'bitwise_or'>
 
Compute the bit-wise OR of two arrays element-wise. Computes the bit-wise OR of the underlying binary representation of the integers in the input arrays. This ufunc implements the C/Python operator |.  Parameters 
 
x1, x2array_like


Only integer and boolean types are handled. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).  
outndarray, None, or tuple of ndarray and None, optional


A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs.  
wherearray_like, optional


This condition is broadcast over the input. At locations where the condition is True, the out array will be set to the ufunc result. Elsewhere, the out array will retain its original value. Note that if an uninitialized out array is created via the default out=None, locations within it where the condition is False will remain uninitialized.  **kwargs

For other keyword-only arguments, see the ufunc docs.    Returns 
 
outndarray or scalar


Result. This is a scalar if both x1 and x2 are scalars.      See also  logical_or
bitwise_and
bitwise_xor
binary_repr

Return the binary representation of the input number as a string.    Examples The number 13 has the binary representation 00001101. Likewise, 16 is represented by 00010000. The bit-wise OR of 13 and 16 is then 000111011, or 29: >>> np.bitwise_or(13, 16)
29
>>> np.binary_repr(29)
'11101'
 >>> np.bitwise_or(32, 2)
34
>>> np.bitwise_or([33, 4], 1)
array([33,  5])
>>> np.bitwise_or([33, 4], [1, 2])
array([33,  6])
 >>> np.bitwise_or(np.array([2, 5, 255]), np.array([4, 4, 4]))
array([  6,   5, 255])
>>> np.array([2, 5, 255]) | np.array([4, 4, 4])
array([  6,   5, 255])
>>> np.bitwise_or(np.array([2, 5, 255, 2147483647], dtype=np.int32),
...               np.array([4, 4, 4, 2147483647], dtype=np.int32))
array([         6,          5,        255, 2147483647])
>>> np.bitwise_or([True, True], [False, True])
array([ True,  True])
 The | operator can be used as a shorthand for np.bitwise_or on ndarrays. >>> x1 = np.array([2, 5, 255])
>>> x2 = np.array([4, 4, 4])
>>> x1 | x2
array([  6,   5, 255])
numpy.bitwise_xor   numpy.bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'bitwise_xor'>
 
Compute the bit-wise XOR of two arrays element-wise. Computes the bit-wise XOR of the underlying binary representation of the integers in the input arrays. This ufunc implements the C/Python operator ^.  Parameters 
 
x1, x2array_like


Only integer and boolean types are handled. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).  
outndarray, None, or tuple of ndarray and None, optional


A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs.  
wherearray_like, optional


This condition is broadcast over the input. At locations where the condition is True, the out array will be set to the ufunc result. Elsewhere, the out array will retain its original value. Note that if an uninitialized out array is created via the default out=None, locations within it where the condition is False will remain uninitialized.  **kwargs

For other keyword-only arguments, see the ufunc docs.    Returns 
 
outndarray or scalar


Result. This is a scalar if both x1 and x2 are scalars.      See also  logical_xor
bitwise_and
bitwise_or
binary_repr

Return the binary representation of the input number as a string.    Examples The number 13 is represented by 00001101. Likewise, 17 is represented by 00010001. The bit-wise XOR of 13 and 17 is therefore 00011100, or 28: >>> np.bitwise_xor(13, 17)
28
>>> np.binary_repr(28)
'11100'
 >>> np.bitwise_xor(31, 5)
26
>>> np.bitwise_xor([31,3], 5)
array([26,  6])
 >>> np.bitwise_xor([31,3], [5,6])
array([26,  5])
>>> np.bitwise_xor([True, True], [False, True])
array([ True, False])
 The ^ operator can be used as a shorthand for np.bitwise_xor on ndarrays. >>> x1 = np.array([True, True])
>>> x2 = np.array([False, True])
>>> x1 ^ x2
array([ True, False])
numpy.blackman   numpy.blackman(M)[source]
 
Return the Blackman window. The Blackman window is a taper formed by using the first three terms of a summation of cosines. It was designed to have close to the minimal leakage possible. It is close to optimal, only slightly worse than a Kaiser window.  Parameters 
 
Mint


Number of points in the output window. If zero or less, an empty array is returned.    Returns 
 
outndarray


The window, with the maximum value normalized to one (the value one appears only if the number of samples is odd).      See also  
bartlett, hamming, hanning, kaiser

  Notes The Blackman window is defined as  \[w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M)\] Most references to the Blackman window come from the signal processing literature, where it is used as one of many windowing functions for smoothing values. It is also known as an apodization (which means “removing the foot”, i.e. smoothing discontinuities at the beginning and end of the sampled signal) or tapering function. It is known as a “near optimal” tapering function, almost as good (by some measures) as the kaiser window. References Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, Dover Publications, New York. Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471. Examples >>> import matplotlib.pyplot as plt
>>> np.blackman(12)
array([-1.38777878e-17,   3.26064346e-02,   1.59903635e-01, # may vary
        4.14397981e-01,   7.36045180e-01,   9.67046769e-01,
        9.67046769e-01,   7.36045180e-01,   4.14397981e-01,
        1.59903635e-01,   3.26064346e-02,  -1.38777878e-17])
 Plot the window and the frequency response: >>> from numpy.fft import fft, fftshift
>>> window = np.blackman(51)
>>> plt.plot(window)
[<matplotlib.lines.Line2D object at 0x...>]
>>> plt.title("Blackman window")
Text(0.5, 1.0, 'Blackman window')
>>> plt.ylabel("Amplitude")
Text(0, 0.5, 'Amplitude')
>>> plt.xlabel("Sample")
Text(0.5, 0, 'Sample')
>>> plt.show()
    >>> plt.figure()
<Figure size 640x480 with 0 Axes>
>>> A = fft(window, 2048) / 25.5
>>> mag = np.abs(fftshift(A))
>>> freq = np.linspace(-0.5, 0.5, len(A))
>>> with np.errstate(divide='ignore', invalid='ignore'):
...     response = 20 * np.log10(mag)
...
>>> response = np.clip(response, -100, 100)
>>> plt.plot(freq, response)
[<matplotlib.lines.Line2D object at 0x...>]
>>> plt.title("Frequency response of Blackman window")
Text(0.5, 1.0, 'Frequency response of Blackman window')
>>> plt.ylabel("Magnitude [dB]")
Text(0, 0.5, 'Magnitude [dB]')
>>> plt.xlabel("Normalized frequency [cycles per sample]")
Text(0.5, 0, 'Normalized frequency [cycles per sample]')
>>> _ = plt.axis('tight')
>>> plt.show()
numpy.bmat   numpy.bmat(obj, ldict=None, gdict=None)[source]
 
Build a matrix object from a string, nested sequence, or array.  Parameters 
 
objstr or array_like


Input data. If a string, variables in the current scope may be referenced by name.  
ldictdict, optional


A dictionary that replaces local operands in current frame. Ignored if obj is not a string or gdict is None.  
gdictdict, optional


A dictionary that replaces global operands in current frame. Ignored if obj is not a string.    Returns 
 
outmatrix


Returns a matrix object, which is a specialized 2-D array.      See also  block

A generalization of this function for N-d arrays, that returns normal ndarrays.    Examples >>> A = np.mat('1 1; 1 1')
>>> B = np.mat('2 2; 2 2')
>>> C = np.mat('3 4; 5 6')
>>> D = np.mat('7 8; 9 0')
 All the following expressions construct the same block matrix: >>> np.bmat([[A, B], [C, D]])
matrix([[1, 1, 2, 2],
        [1, 1, 2, 2],
        [3, 4, 7, 8],
        [5, 6, 9, 0]])
>>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]])
matrix([[1, 1, 2, 2],
        [1, 1, 2, 2],
        [3, 4, 7, 8],
        [5, 6, 9, 0]])
>>> np.bmat('A,B; C,D')
matrix([[1, 1, 2, 2],
        [1, 1, 2, 2],
        [3, 4, 7, 8],
        [5, 6, 9, 0]])
numpy.broadcast   class numpy.broadcast[source]
 
Produce an object that mimics broadcasting.  Parameters 
 
in1, in2, …array_like


Input parameters.    Returns 
 
bbroadcast object


Broadcast the input parameters against one another, and return an object that encapsulates the result. Amongst others, it has shape and nd properties, and may be used as an iterator.      See also  broadcast_arrays
broadcast_to
broadcast_shapes
  Examples Manually adding two vectors, using broadcasting: >>> x = np.array([[1], [2], [3]])
>>> y = np.array([4, 5, 6])
>>> b = np.broadcast(x, y)
 >>> out = np.empty(b.shape)
>>> out.flat = [u+v for (u,v) in b]
>>> out
array([[5.,  6.,  7.],
       [6.,  7.,  8.],
       [7.,  8.,  9.]])
 Compare against built-in broadcasting: >>> x + y
array([[5, 6, 7],
       [6, 7, 8],
       [7, 8, 9]])
  Attributes 
 index

current index in broadcasted result  iters

tuple of iterators along self’s “components.”  nd

Number of dimensions of broadcasted result.  ndim

Number of dimensions of broadcasted result.  numiter

Number of iterators possessed by the broadcasted result.  shape

Shape of broadcasted result.  size

Total size of broadcasted result.     Methods  
reset() Reset the broadcasted result's iterator(s).
numpy.broadcast_arrays   numpy.broadcast_arrays(*args, subok=False)[source]
 
Broadcast any number of arrays against each other.  Parameters 
 
`*args`array_likes


The arrays to broadcast.  
subokbool, optional


If True, then sub-classes will be passed-through, otherwise the returned arrays will be forced to be a base-class array (default).    Returns 
 
broadcastedlist of arrays


These arrays are views on the original arrays. They are typically not contiguous. Furthermore, more than one element of a broadcasted array may refer to a single memory location. If you need to write to the arrays, make copies first. While you can set the writable flag True, writing to a single output value may end up changing more than one location in the output array.  Deprecated since version 1.17: The output is currently marked so that if written to, a deprecation warning will be emitted. A future version will set the writable flag False so writing to it will raise an error.       See also  broadcast
broadcast_to
broadcast_shapes
  Examples >>> x = np.array([[1,2,3]])
>>> y = np.array([[4],[5]])
>>> np.broadcast_arrays(x, y)
[array([[1, 2, 3],
       [1, 2, 3]]), array([[4, 4, 4],
       [5, 5, 5]])]
 Here is a useful idiom for getting contiguous copies instead of non-contiguous views. >>> [np.array(a) for a in np.broadcast_arrays(x, y)]
[array([[1, 2, 3],
       [1, 2, 3]]), array([[4, 4, 4],
       [5, 5, 5]])]
numpy.broadcast_shapes   numpy.broadcast_shapes(*args)[source]
 
Broadcast the input shapes into a single shape. Learn more about broadcasting here.  New in version 1.20.0.   Parameters 
 
`*args`tuples of ints, or ints


The shapes to be broadcast against each other.    Returns 
 tuple

Broadcasted shape.    Raises 
 ValueError

If the shapes are not compatible and cannot be broadcast according to NumPy’s broadcasting rules.      See also  broadcast
broadcast_arrays
broadcast_to
  Examples >>> np.broadcast_shapes((1, 2), (3, 1), (3, 2))
(3, 2)
 >>> np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7))
(5, 6, 7)