|
Note: numarray is being phased out and replaced by
numpy. STScI has
migrated all of its software to
use numpy, and the current release of stsci_python (2.5) and
STSDAS/TABLES (3.7) use numpy in place of numarray.
For the time being, PyFITS can use numpy
or numarray (the numarray support will eventually be
removed). We will continue to make numarray available,
however support
for numarray will be significantly reduced, and we
expect to stop supporting numarray entirely in the middle
of 2008. If you have a choice
(i.e., you do not depend on existing software
that uses numarray), we strongly recommend starting
with numpy instead of numarray (or switching as soon
as possible).
We have developed a guide to help conversion of code that uses
numarray to code that uses numpy. This PDF document can be found at
numarray2numpy.pdf
Numarray provides array manipulation and computational
capabilities similar to those found
in IDL, Matlab, or Octave. Using numarray, it is possible
to write many efficient numerical data processing
applications directly in Python without using any C, C++ or
Fortran code (as well as doing such analysis interactively
within Python or PyRAF). For algorithms that are not well
suited for efficient computation using array facilities it
is possible to write C functions (and eventually Fortran)
that can read and write numarray arrays that can be called
from Python.
Numarray is a re-implementation of an older Python array
module called Numeric. In general its interface is very
similar. It is mostly backward compatible and will be
becoming more so in future releases. Numarray offers more
capability than Numeric but is still behind Numeric in some areas:
- numarray is efficient for large arrays (>20,000
elements) but is slower than Numeric for small arrays
by a factor of 2 to 4.
- numarray has a smaller selection of addon packages.
numarray currently has ports of Numeric packages for linear
algebra, random numbers, and fourier transforms. numarray has
native packages for convolution and multi-dimensional image
processing. Most Numeric extensions (C or Fortran) can be
ported to numarray with minimal effort.
numarray is sufficiently developed to be
useful for a number of applications, and is being used in
the Hubble Space Telescope data processing pipeline (for the
Advanced Camera for Surveys) and to develop the Cosmic
Origins Spectrograph pipeline.
PyFITS is
also based on it. Most of STScI's future astronomical data
processing applications will be built using its
capabilities.
Numarray is being developed as an Open Source project on
SourceForge from which
the current development source code may be obtained. The
Science Software Branch at STScI is leading this development
effort.
STScI has settled on the
matplotlib plotting package as the
recommended 2-d data visualization tool for numarray data.
While its support for numarray and Tkinter is now present, we
are holding off a bit before recommending its use for all users.
If you don't mind possible problems with installation or some
holes in functionality it can be used now. We are in the process
of improving the installation documentation for use with numarray.
Although matplotlib has its heritage in trying to emulate matlab
plotting capabilities from Python, it does not require matlab.
Currently the documentation is geared towards those more familiar
with matlab, though many users will have no problem generating
simple plots with it. It is still undergoing considerable development
(by the original author, John Hunter, and with contributions by
STScI and others) and we hope to fill the holes in
functionality in the coming months. Nevertheless, it is capable
of doing many things now.
| |