i have a simple array with floating values
>>> print a
array([ 0. , 0.2, 0.4, 0.6, 0.8])
what i need to do is change each index into another
dimension with 3 indices. hmm, kind of confusing, an
example will explain better
>>> b = array(zip(a,a,a))
>>> print b
array([[ 0. , 0. , 0. ],
[ 0.2, 0.2, 0.2],
[ 0.4, 0.4, 0.4],
[ 0.6, 0.6, 0.6],
[ 0.8, 0.8, 0.8]])
ok, this does the job, but once i start using large
arrays, the back-n-forth conversion between arrays and
python lists is costing me quite a bit. is there a way
i can reshape the array this way without the call to
python's 'zip'? (no, 'map' doesn't count either)
i've tried much fooling with NewAxis, resize, and friends.
but either i haven't stumbled upon the correct combination
or i'm not trying the correct tools. i'd like to keep this
as quick as possible, so hopefully it can be done without
anything too elaborate.
thanks
(doh, sorry for the previous distutils related post...
hit the wrong mailing list)

When attempting to install Numeric 17.0 with Python 1.5.2 and Distutils 1.0
on Red Hat 7.0, I get the following error after issuing the command 'python
setup.py install'
Traceback (innermost last):
File "setup.py", line 15, in ?
vs = map(string.atoi, v.groups())
AttributeError: 'None' object has no attribute 'groups'
This error occurs regardless of whether or not I am root. I have also tried
uninstalling the Red Hat Python packages and installing all from source, but I
get the same error.
Any help would be appreciated.
Thanks.

Hey Numpy people!
This a PS from my previous message. I just tried the underflow with
complex :
>>> Numeric.array([2.9e-131])**3
Traceback (most recent call last):
File "<stdin>", line 1, in ?
OverflowError: math range error
>>> 2.9e-131**3
0.0
>>> Numeric.array([2.9e-131+0j])**3
array([ 0.+0.j])
Now I have a quick solution for my problem, but I have the impression that
this is a bug, at least I don't understand the underlying logic. If
somebody can explain it to me?
Jean-Bernard

Hey Numpy people!
Do anyone know how to disable underflow exception errors in Numeric?
I have a lot of these in my code. It is now a very important problem in my
calculations. The only solution I see is to make a for loop and make the
arithmetic in python instead of Numeric.
Thanks for your help,
Jean-Bernard
Python 2.0 (#9, Feb 2 2001, 12:17:02)
[GCC 2.95.2 19991024 (release)] on linux2
Type "copyright", "credits" or "license" for more information.
Hello from .pythonrc.py
>>> import Numeric
>>> Numeric.__version__
'17.2.0'
>>> Numeric.array([2.9e-131])**3
Traceback (most recent call last):
File "<stdin>", line 1, in ?
OverflowError: math range error
>>> 2.9e-131**3
0.0

I use Numeric 20.0.0, Python 2.1, and RedHat 7.1 on a PC.
Here is a small Python program:
import Numeric
a = Numeric.zeros((2,2), 'b')
print a[0,0], type(a[0,0])
print a[0][0], type(a[0][0])
a = Numeric.zeros((2,2), 'i')
print a[0,0], type(a[0,0])
print a[0][0], type(a[0][0])
a = Numeric.zeros((2,2), 'f')
print a[0,0], type(a[0,0])
print a[0][0], type(a[0][0])
The output is:
0 <type 'array'>
0 <type 'int'>
0 <type 'array'>
0 <type 'int'>
0.0 <type 'array'>
0.0 <type 'float'>
This can't be correct. "a[0,0]" and "a[0][0]" should have the same type. A quick
check of my old Python code shows that this
problem may have appeared since Numeric version 17.
Thanks,
Ed Jones

> Mark Esplin wrote:
> >
> > What is the plan for the future development of Numerical Python? For
> > example, will additional special functions be included in numpy, or is
> > NumPy to be a building block for other applications? I guess the big
> > question is "Will Numerical Python become a complete computing
> > environment like Matlab or IDL?"
> >
> > There is an interesting series of article on Numerical Python by Eric
> > Hagemann on O'Reilly network (www.oreillynet.com) where Eric Hagemann
> > is using NumPy with other python modules as a computing environment
> > more than as a software development framework.
> >
> > I think NumPy could become a lot like the development of linux. Linux
> > strictly speaking is only the operating system kernel. However, a
> > linux system has come to includes a whole set of packages that work
> > together to make up a whole system.
>
> See PEP 209: Multi-dimensional Arrays
>
> http://python.sourceforge.net/peps/pep-0209.html
>
> --
> Paul Barrett, PhD Space Telescope Science Institute
>
We at STScI have been working on a new implementation of Numeric.
We are far enough along to release an incomplete version for evaluation
by the Numeric (the current version) developers in about 2 weeks.
The existing PEP (209) doesn't address all the details of the
implementation and there are some differences from the PEP, but
it does give a general idea of what our goals are. We have been
more concerned at this point in implementation than keeping the
PEP up to date. The PEP will be revised when we release a preliminary
version. The preliminary version will be
0) Called something else. Probably numarray.
1) Not completely backwards compatible with the existing Numeric.
(I don't have time to detail the differences, but they will be
listed when we make it availble).
2) Incomplete. It will be missing functionality, especially
with regard to structural operations (choose, where, nonzero, put,
take, compress...). It will have most types (excepting complex) and
most standard Ufuncs. We do not expect this version will be usuable
for most projects because of this. We are looking for feedback on
the interface and design approach rather than advertising it as a
usuable version. We also are interested in collaborators in
implementing the rest of the functionality. It probably will be
moved to sourceforge soon after.
3) Slower for smaller arrays. We expect that performance for large
arrays (>100,000 elements) should be fairly respectable, but since
most of the original implementation is in Python, the overhead for
smaller arrays is substantially increased over the existing Numeric.
While we did benchmarking for determining what design approaches
were efficient enough, we have eschewed benchmarks until we have
completed all the important functionality (soon). At that point
we will begin to work on optimization to improve the performance.
I'll stop here, but you should be hearing more about it in the near
future.
Perry Greenfield
Space Telescope Science Institute
Science Software Group

Quoting from numdoc.pdf, dated March 31, 2001, in section
"Creating an array from a function: fromfunction()"
> The implementation of fromfunction consists of:
>
> def fromfunction(function, dimensions):
> return apply(function, tuple(indices(dimensions)))
>
> which means that the function function is called for each element in
> the sequence indices(dimensions) [...]
This is wholly incorrect. apply() does not call a function for each
element in the sequence, apply calls a function exactly *once*, using
the elements of the sequence for arguments.
Also, that same section of the documentation refers to "the first
example below [...] works" and "the second array [...] fails", but there
is only one example, which apparently is the failing one (as it's named
"buggy"). Having a *working* example would be nice. =)
Perhaps this is a formatting glitch in the documentation processor, but
I couldn't find the documentation's source format.
and then... there's always the possibility that I'm barking up the
wrong tree. What I'm trying to achieve is this: I've got a function
which, given a vector describing a point in n-dimensional space, returns
a value for that point. I want a matrix of the shape I specify, filled
these values, with the array indicies as coordinates for the points.
Is that too much to ask? ;)
Thanks,
- Kevin Turner
[using Python version 2.0, PyNum 19.0.0]
--
Kevin Turner <acapnotic(a)users.sf.net> | OpenPGP encryption welcome here
http://www.purl.org/wiki/python/KevinTurner

What is the plan for the future development of Numerical Python? For
example, will additional special functions be included in numpy, or is
NumPy to be a building block for other applications? I guess the big
question is "Will Numerical Python become a complete computing
environment like Matlab or IDL?"
There is an interesting series of article on Numerical Python by Eric
Hagemann on O'Reilly network (www.oreillynet.com) where Eric Hagemann
is using NumPy with other python modules as a computing environment
more than as a software development framework.
I think NumPy could become a lot like the development of linux. Linux
strictly speaking is only the operating system kernel. However, a
linux system has come to includes a whole set of packages that work
together to make up a whole system.
-Mark Esplin
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

Does have an updated Win32 binary of Konrad Hinsen's
ScientificPython? I've been using Robert Kern's
version, but it's only good up to Python 1.5.2. Now
that the main modules I use have been compiled for
Python 2.1 (dislin & mxTools) I have upgraded. The
only other binary extension I use often is
ScientificPython, especially the netcdf portion. I'm
not really a computer person so compiling myself is a
scary option. Any help?
Thank you,
Grant Callis
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/