From da2ab0350e28c21fe53b6f1d23ea0d928e70a5fa Mon Sep 17 00:00:00 2001 From: Jarrod Millman Date: Wed, 13 Oct 2021 14:10:31 -0700 Subject: [PATCH] Remove NumPy stuff --- content/en/bug-report.md | 12 +- content/en/download.md | 124 +-------------- content/en/faq.md | 306 +----------------------------------- content/en/mailing-lists.md | 52 ------ 4 files changed, 10 insertions(+), 484 deletions(-) diff --git a/content/en/bug-report.md b/content/en/bug-report.md index 175a3b5..5bca234 100644 --- a/content/en/bug-report.md +++ b/content/en/bug-report.md @@ -5,19 +5,13 @@ sidebar: false **Please help us by reporting any problems you find.** -NumPy and SciPy libraries make use of GitHub to do project management. +SciPy uses GitHub to do project management. There, you can see what we are currently working on (Pull Requests), as well as file bug-reports (issues). 1. Go to the relevant page: - - [SciPy library pull - requests](https://github.com/scipy/scipy/pulls) - - [SciPy library bug - reports](https://github.com/scipy/scipy/issues) - - [NumPy library pull - requests](https://github.com/numpy/numpy/pulls) - - [NumPy library bug - reports](https://github.com/numpy/numpy/issues) + - [Pull requests](https://github.com/scipy/scipy/pulls) + - [Bug reports](https://github.com/scipy/scipy/issues) 2. On GitHub, you need to register an account the first time you use it. 3. Make sure the bug hasn\'t already been reported. Click on \"Search\" diff --git a/content/en/download.md b/content/en/download.md index 240af50..5817b98 100644 --- a/content/en/download.md +++ b/content/en/download.md @@ -1,36 +1,27 @@ --- -title: Obtaining NumPy & SciPy libraries +title: Obtaining SciPy sidebar: false --- # Official source and binary releases -For each official release of NumPy and SciPy, we provide source code +For each official release of SciPy, we provide source code (tarball), as well as binary wheels for several major platforms (Windows, OSX, Linux). {{< yamlToTable >}} headers: - - Project - Available Packages - Download location format: - - align: left - align: left - align: right rows: - - columns: - - "NumPy" - - | - Official *source code* (all platforms) and *binaries* for
- **Windows**, **Linux**, and **Mac OS X** - - "[PyPi page for NumPy](https://pypi.python.org/pypi/numpy)" - columns: - - SciPy - | Official *source code* (all platforms) and *binaries* for
**Windows**, **Linux** and **Mac OS X** @@ -43,14 +34,10 @@ rows: # Source code repository access -The most recent development versions of NumPy and SciPy are available +The most recent development versions of SciPy is available through the official repositories hosted on [GitHub](https://github.com/). -To check out the latest **NumPy** sources: - - git clone https://github.com/numpy/numpy.git numpy - To check out the latest **SciPy** sources: git clone https://github.com/scipy/scipy.git scipy @@ -64,9 +51,9 @@ latest version can be found at: # Third-party/vendor package managers Below is a partial list of third-party and operating system vendor -package managers containing NumPy and SciPy packages. +package managers containing SciPy packages. -These packages are **not** maintained by the NumPy and SciPy developers; +These packages are **not** maintained by the SciPy developers; this list is provided only as a convenience. These packages may not always provide the most up-to-date version of the software, and may be unmaintained. @@ -74,13 +61,12 @@ unmaintained. **IMPORTANT:** If you experience problems with these packages (*especially* those related to installation/build errors), **please report the problem to the package maintainer first, rather than to the -NumPy/SciPy mailing lists**. +SciPy mailing lists**. {{< yamlToTable >}} headers: - Distribution - - NumPy Packages - SciPy Packages format: @@ -91,146 +77,48 @@ format: rows: - columns: - "[Arch Linux](https://www.archlinux.org/)" - - "[python-numpy](https://www.archlinux.org/packages/?q=numpy)" - "[python-scipy](https://www.archlinux.org/packages/?q=scipy)" - columns: - "[Debian GNU/Linux](http://www.debian.org/)" - - "[python-numpy](https://packages.debian.org/search?keywords=python-numpy)" - "[python-scipy](https://packages.debian.org/search?keywords=python-scipy)" - columns: - "[Ubuntu Linux](http://www.ubuntu.com/)" - - "[python-numpy](http://packages.ubuntu.com/search?keywords=python-numpy)" - "[pythonscipy](http://packages.ubuntu.com/search?keywords=python-scipy)" - columns: - "[Fedora](https://getfedora.org/)" - - "[numpy](https://apps.fedoraproject.org/packages/numpy)" - "[scipy](https://apps.fedoraproject.org/packages/scipy)" - columns: - "[Fink](http://www.finkproject.org/)" - - "[numpy-py38](http://pdb.finkproject.org/pdb/package.php/numpy-py38)" - "[scipy-py38](http://pdb.finkproject.org/pdb/package.php/scipy-py38)" - columns: - "[FreeBSD (Ports)](https://www.freebsd.org/ports/)" - - "[math/py-numpy](https://svnweb.freebsd.org/ports/head/math/py-numpy)" - "[science/py-scipy](https://svnweb.freebsd.org/ports/head/science/py-scipy)" - columns: - "[Gentoo Linux](https://www.gentoo.org/)" - - "[dev-python/numpy](https://packages.gentoo.org/packages/dev-python/numpy)" - "[sci-libs/scipy](https://packages.gentoo.org/packages/sci-libs/scipy)" - columns: - "[MacPorts](http://www.macports.org/)" - - "[py-numpy](http://trac.macports.org/browser/trunk/dports/python/py-numpy/Portfile)" - "[py-scipy](http://trac.macports.org/browser/trunk/dports/python/py-scipy/Portfile)" - columns: - "[NetBSD (pkgsrc)](http://www.pkgsrc.org/)" - - "[math/py-numpy](http://pkgsrc.se/math/py-numpy)" - "[math/py-scipy](http://pkgsrc.se/math/py-scipy)" - columns: - "[OpenSUSE](https://www.opensuse.org/)" - - | - [python-numpy](http://software.opensuse.org/search?q=python-numpy), - [python-numpy-devel](http://software.opensuse.org/search?q=python-numpy-devel) - | [python-scipy](http://software.opensuse.org/search?q=python-scipy), [python-scipy-devel](http://software.opensuse.org/search?q=python-scipy-devel) - columns: - "[Slackware Linux](http://www.slackware.com/)" - - "[numpy (slackbuilds.org)](https://slackbuilds.org/result/?search=numpy)" - "[scipy (slackbuilds.org)](https://slackbuilds.org/result/?search=scipy)" {{< /yamlToTable >}} - diff --git a/content/en/faq.md b/content/en/faq.md index ad745b6..508935a 100644 --- a/content/en/faq.md +++ b/content/en/faq.md @@ -3,88 +3,6 @@ title: Frequently Asked Questions sidebar: false --- -# General questions about NumPy - -## What is NumPy? - -NumPy is a Python extension module that provides efficient operation on -arrays of homogeneous data. It allows Python to serve as a high-level -language for manipulating numerical data, much like, for example, IDL or -MATLAB. - -## Why should I use NumPy rather than IDL, MATLAB, or Octave? - -As always, you should choose the programming tools that suit your -problem and your environment. Advantages many people cite are that it is -open-source, it doesn\'t cost anything, it uses a general-purpose -programming language (Python), which is very popular and has -high-quality libraries for almost any task available, and it is -relatively easy to connect existing C and Fortran code to the Python -interpreter. - -## What is a NumPy array? - -A NumPy array is a multidimensional array of objects all of the same -type. In memory, it is an object which points to a block of memory, -keeps track of the type of data stored in that memory, keeps track of -how many dimensions there are and how large each one is, and - -importantly -the spacing between elements along each axis. - -For example, you might have a NumPy array that represents the numbers -from zero to nine, stored as 32-bit integers, one right after another, -in a single block of memory. (For comparison, each Python integer needs -to have some type information stored alongside it.) You might also have -the array of even numbers from zero to eight, stored in the same block -of memory, but with a gap of four bytes (one 32-bit integer) between -elements. This is called **striding**, and it means that you can often -create a new array referring to a subset of the elements in an array -without copying any data. Such subsets are called **views**. This is an -efficiency gain, obviously, but it also allows modification of selected -elements of an array in various ways. - -An important constraint on NumPy arrays is that, for a given axis, all -the elements must be spaced by the same number of bytes in memory. NumPy -cannot use double-indirection to access array elements, so indexing -modes that would require this must produce copies. This constraint makes -it possible for all the inner loops in NumPy\'s internals to be written -in efficient C code. - -NumPy arrays offer a number of other possibilities, including using a -memory-mapped disk file as the storage space for an array, and **record -arrays**, where each element can have a custom, compound data type. - -## What advantages do NumPy arrays offer over (nested) Python lists? - -Python\'s lists are efficient general-purpose containers. They support -(fairly) efficient insertion, deletion, appending, and concatenation, -and Python\'s list comprehensions make them easy to construct and -manipulate. However, they have certain limitations: they don\'t support -\"vectorized\" operations, like elementwise addition and multiplication, -and the fact that they can contain objects of differing types mean that -Python must store type information for every element, and must execute -type-dispatching code when operating on each element. This also means -that very few list operations can be carried out by efficient C loops -\-- each iteration would require type checks and other Python API -bookkeeping. - -## What\'s the story behind Numeric, numarray, and NumPy? - -The short version is that Numeric was the original package that provided -efficient homogeneous numeric arrays for Python, but some developers -felt it lacked certain essential features, so they began developing an -independent implementation called numarray. Having two incompatible -implementations of array was clearly a disaster in the making, so NumPy -was designed to be an improvement on both. - -Neither Numeric nor numarray is currently supported. NumPy has been the -standard array package for a number of years now. If you use Numeric or -numarray, you should upgrade; NumPy is explicitly designed to have all -the capabilities of both (and already boasts new features found in -neither of its predecessor packages). There are tools available to ease -the upgrade process; only C code should require much modification. - -# General questions about SciPy - ## What is SciPy? SciPy is a set of open source (BSD licensed) scientific and numerical @@ -216,7 +134,7 @@ problems](https://en.wikipedia.org/wiki/Generalized_eigenvalue_problem). # Python version support -## Do NumPy and SciPytill support Python 2.7? +## Do NumPy and SciPy still support Python 2.7? The last version of NumPy to support Python 2.7 is NumPy 1.16.x. The last SciPy version to do so is SciPy 1.2.x. The first release of NumPy @@ -245,228 +163,6 @@ with .NET. Some users at the time reported success in using NumPy with [Ironclad](https://code.google.com/archive/p/ironclad) on 32-bit Windows. -# Basic NumPy/SciPy usage - -## What is the preferred way to check for an empty (zero-element) array? - -If you are certain a variable is an array, then use the size attribute. -If the variable is a list or other sequence type, use -`len`. The size attribute is preferable -to len because: - - >>> a = numpy.zeros((1,0)) - >>> a.size - 0 - -whereas - - >>> len(a) - 1 - -## I want to load data from a text file. How do I make this code more efficient? - -Use `numpy.loadtxt`. Even if your text -file has header and footer lines or comments, loadtxt can almost -certainly read it; it is convenient and efficient. - -If you find this still too slow, you can try pandas (it has a faster csv -reader for example). If that doesn\'t help, you should consider changing -to a more efficient file format than plain text. There are a large -number of alternatives, depending on your needs (and on which version of -NumPy/SciPy you are using): - -- Text files: slow, huge, portable, human-readable; built into NumPy -- pickle: somewhat slow, somewhat portable (may be incompatible with - different NumPy versions); built into NumPy -- [HDF5](http://www.hdfgroup.org/): high-powered kitchen-sink format; - both [PyTables](http://www.pytables.org/) and - [h5py](http://www.h5py.org/) provide a NumPy-friendly interface on - top of the core HDF5 library written in C -- [FITS](http://fits.gsfc.nasa.gov/): standard kitchen-sink format in - astronomy; the [astropy](http://www.astropy.org/) library provides a - convenient Python interface through its - [io.fits](http://docs.astropy.org/en/stable/io/fits/index.html) - package -- [.npy](http://docs.scipy.org/doc/numpy/neps/npy-format.html): NumPy - native binary data format, simple, efficient, portable; built into - NumPy as of 1.0.5 - -## What is the difference between matrices and arrays? - -*Note: NumPy matrices will be deprecated, do not use them for new code. -The rest of the answer below is kept for historical reasons.* - -NumPy\'s basic data type is the multidimensional array. These can be 1-D -(that is, one index, like a list or a vector), 2-D (two indices, like an -image), 3-D, or more (0-D arrays exist and are slightly strange corner -cases). They support various operations, including addition, -subtraction, multiplication, exponentiation, and so on - but all of -these are *elementwise* operations. If you want matrix multiplication -between two 2-D arrays, the function `numpy.dot` -or the built-in Python operator `@` do this. It also works -fine for getting the matrix product of a 2-D array and a 1-D array, in -either direction, or two 1-D arrays. If you want some kind of matrix -multiplication-like operation on higher-dimensional arrays (tensor -contraction), you need to think over which indices you want to be -contracting. Some combination of `tensordot` -and `rollaxis` should do what you want. - -However, some users find that they are doing so many matrix -multiplications that always having to write `dot` as a prefix is too -cumbersome, or they really want to keep row and column vectors separate. -For these users, there is a matrix class. This is simply a transparent -wrapper around arrays that forces arrays to be at least 2-D, and that -overloads the multiplication and exponentiation operations. -Multiplication becomes matrix multiplication, and exponentiation becomes -matrix exponentiation. If you want elementwise multiplication, use -`numpy.multiply`. - -The function `asmatrix` converts an array -into a matrix (without ever copying any data); -`asarray` converts matrices to arrays. -`asanyarray` makes sure that the result -is either a matrix or an array (but not, say, a list). Unfortunately, a -few of NumPy\'s many functions use `asarray` when they should use `asanyarray`, -so, from time to time, you may find your matrices -accidentally getting converted into arrays. Just use -`asmatrix` on the output of these -operations and consider filing a bug. - -## Why not just have a separate operator for matrix multiplication? - -From Python 3.5, the `@` symbol will be defined as a matrix -multiplication operator, and NumPy and SciPy will make use of this. This -addition was the subject of [PEP -465](https://www.python.org/dev/peps/pep-0465/). The separate matrix and -array types exist to work around the lack of this operator in earlier -versions of Python. - -## How do I find the indices of an array where some condition is true? - -The preferred idiom for doing this is to use the function -`numpy.nonzero`, or the -`nonzero` method of an array. Given an -array `a`, the condition `a > 3` returns a boolean array, and since -`False` is interpreted as 0 in Python and NumPy, `np.nonzero(a > 3)` -yields the indices of `a` where the condition is true. - - >>> import numpy as np - >>> a = np.array([[1,2,3],[4,5,6],[7,8,9]]) - >>> a > 3 - array([[False, False, False], - [ True, True, True], - [ True, True, True]], dtype=bool) - >>> np.nonzero(a > 3) - (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) - -The `nonzero` method of the boolean array -can also be called. - - >>> (a > 3).nonzero() - (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) - -## How do I count the number of times each value appears in an array of integers? - -Use `numpy.bincount`. The resulting array -is - - >>> arr = numpy.array([0, 5, 4, 0, 4, 4, 3, 0, 0, 5, 2, 1, 1, 9]) - >>> numpy.bincount(arr) - -The argument to `bincount` must consist -of positive integers or booleans. Negative integers are not supported. - -# Advanced NumPy usage - -## Does NumPy support `nan`? - -`nan`, short for \"not a number\", is a -special floating-point value defined by the IEEE-754 specification, -along with `inf` (infinity) and other -values and behaviours. In theory, IEEE `nan` -was specifically designed to address the problem of -missing values, but the reality is that different platforms behave -differently, making life more difficult. On some platforms, the presence -of `nan` slows calculations 10-100 -times. For integer data, no `nan` value -exists. - -Despite all these issues NumPy (and SciPy) endeavor to support IEEE-754 -behavior (based on NumPy\'s predecessor numarray). The most significant -challenge is the lack of cross-platform support within Python itself. -Because NumPy is written to take advantage of C99, which supports -IEEE-754, it can side-step such issues internally, but users may still -face problems when, for example, comparing values within the Python -interpreter. - -Those wishing to avoid potential headaches will be interested in an -alternative solution, which has a long history in NumPy\'s predecessors -\-- **masked arrays**. Masked arrays are standard arrays with a second -\"mask\" array of the same shape to indicate whether the value is -present or missing. Masked arrays are the domain of the -`numpy.ma` module, and continue the -cross-platform Numeric/numarray tradition. See -\"Cookbook/Matplotlib/Plotting values with masked arrays\" (*TODO*) for -example, to avoid plotting missing data in -[Matplotlib](http://matplotlib.org). Despite their additional memory -requirement, masked arrays are faster than `nans` on many floating point -units. See also the [NumPy documentation on masked -arrays](http://docs.scipy.org/doc/numpy/reference/maskedarray.html). - -Another good option is to use pandas - it uses `nan` in a similar way to -NumPy for floating-point data, and since pandas 0.25.0 also supports -missing integer values. - -## Why doesn\'t A\[\[0, 1, 1, 2\]\] += 1 do what I think it should? - -This comes up from time to time on the . See -[here](https://mail.scipy.org/pipermail/numpy-discussion/2006-March/006877.html) -for one extensive discussion. - - >>> A = numpy.zeros(3) - >>> A[[0,1,1,2]] += 1 - >>> A - array([ 1., 1., 1.]) - -One might, quite reasonably, have expected A to contain \[1,2,1\]. -Unfortunately, this is not what is implemented in NumPy. Moreover, the -[Python Reference -Manual](https://docs.python.org/reference/simple_stmts.html#grammar-token-augmented_assignment_stmt) -specifies that - - >>> x = x + y - -and - - >>> x += y - -should result in `x` having the same value (though not necessarily the -same identity). Moreover, even if the NumPy developers wanted to modify -this behavior, Python does not provide an overloadable -`__indexed_iadd__` function; the code -acts like - - >>> tmp = A.__getitem__([0,1,1,2]) - >>> tmp.__iadd__(1) - >>> A.__setitem__([0,1,1,2],tmp) - -This leads to other peculiarities sometimes; if the indexing operation -is actually able to provide a view rather than a copy, the -`__iadd__` writes to the array, then the -view is copied into the array, so that the array is written to twice. - -However, do not despair! NumPy does contain functionality for this type -of behavior, and it can be obtained by using the ufunc -`at`, which is an attribute of the -addition (`np.add`), subtraction (`np.subtract`), multiplication -(`np.multiply`), and division (`np.divide`) ufuncs between a matrix and -a scalar: - - >>> A = numpy.zeros(3) - >>> numpy.add.at(A, [0, 1, 1, 2], 1) - >>> A - array([ 1., 2., 1.]) - # Where to get help You can ask questions with the [SciPy tag on diff --git a/content/en/mailing-lists.md b/content/en/mailing-lists.md index 25cdc2c..5a6e2db 100644 --- a/content/en/mailing-lists.md +++ b/content/en/mailing-lists.md @@ -55,60 +55,8 @@ rows: - colspan: 3 text: For discussions about SciPy development (code, website, docs, and more). - - columns: - - "**NumPy-discussion**" - - "[Archives](https://mail.python.org/archives/list/numpy-discussion@python.org/)" - - "[Subscribe](https://mail.python.org/mailman/listinfo/numpy-discussion/)" - - - columns: - - colspan: 3 - text: For discussion of NumPy. - {{< /yamlToTable >}} - - # StackOverflow [StackOverflow](http://stackoverflow.com) is a good place to ask usage