[Numpy-discussion] Warning: message 1Ggbsf-00056T-Ol delayed 48 hours

2006-11-07 Thread Mail Delivery System
This message was created automatically by mail delivery software.
A message that you sent has not yet been delivered to one or more of its
recipients after more than 48 hours on the queue on 
externalmx-1.sourceforge.net.

The message identifier is: 1Ggbsf-00056T-Ol
The subject of the message is: faces and their former position.  To be, sure.  
But question
The date of the message is:Sun, 05 Nov 2006 16:01:50 +0900

The address to which the message has not yet been delivered is:

  numpy-discussion@lists.sourceforge.net
Delay reason: SMTP error from remote mailer after RCPT 
TO:numpy-discussion@lists.sourceforge.net:
host mail.sourceforge.net [66.35.250.206]: 451-Could not complete sender 
verify callout
451-Could not complete sender verify callout for
451-numpy-discussion@lists.sourceforge.net.
451-The mail server(s) for the domain may be temporarily unreachable, or
451-they may be permanently unreachable from this server. In the latter 
case,
451-you need to change the address or create an MX record for its domain
451-if it is 

No action is required on your part. Delivery attempts will continue for
some time, and this warning may be repeated at intervals if the message
remains undelivered. Eventually the mail delivery software will give up,
and when that happens, the message will be returned to you.

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


[Numpy-discussion] numpy on wince

2006-11-07 Thread Emanuele Olivetti
Hi all,
do you know if numpy/Numeric is available on WinCE ?
I'm thinking about the use of a numpy/Numeric app on a palmtop
and I'm not sure it will be deployed on linux only devices.

Thanks in advance,

Emanuele

P.S.: I know that Python is available on many many platforms, but
I not so confident about many external libraries.

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


[Numpy-discussion] More on Numexpr-unsupported objects

2006-11-07 Thread Ivan Vilata i Balaguer
This is somehow related with this previous thread about raising
``TypeError`` on unsupported objects in Numexpr:
http://www.mail-archive.com/numpy-discussion@lists.sourceforge.net/msg03146.html

There is still a case where unsupported objects can get into expressions
without Numexpr noticing.  For instance:

 import numexpr
 numexpr.evaluate('[]')
Traceback (most recent call last):
  File stdin, line 1, in ?
  File numexpr/compiler.py, line 594, in evaluate
_names_cache[expr_key] = getExprNames(ex, context)
  File numexpr/compiler.py, line 570, in getExprNames
ast = expressionToAST(ex)
  File numexpr/compiler.py, line 84, in expressionToAST
this_ast = ASTNode(ex.astType, ex.astKind, ex.value,
AttributeError: 'list' object has no attribute 'astType'

The attached patch makes the error clearer and more consistent with the
error added in the aforementioned thread:

 import numpy
 import numexpr
 numexpr.evaluate('[]')
Traceback (most recent call last):
  File stdin, line 1, in ?
  File numexpr/compiler.py, line 596, in evaluate
_names_cache[expr_key] = getExprNames(ex, context)
  File numexpr/compiler.py, line 571, in getExprNames
ex = stringToExpression(text, {}, context)
  File numexpr/compiler.py, line 229, in stringToExpression
raise TypeError(unsupported expression type: %s % type(ex))
TypeError: unsupported expression type: type 'list'

Though I admit it may be strange for this error to be triggered.

(I had a little mess with using ``expressions.ExpressionNode`` instead
of ``expr.ExpressionNode``...  I still don't see why the private copy of
the module is necessary.)

::

Ivan Vilata i Balaguer   qo   http://www.carabos.com/
   Cárabos Coop. V.  V  V   Enjoy Data
  
Index: compiler.py
===
--- compiler.py (revisión: 2307)
+++ compiler.py (copia de trabajo)
@@ -225,6 +225,8 @@
 ex = eval(c, names)
 if expressions.isConstant(ex):
 ex = expr.ConstantNode(ex, expressions.getKind(ex))
+elif not isinstance(ex, expr.ExpressionNode):
+raise TypeError(unsupported expression type: %s % type(ex))
 return ex
 
 


signature.asc
Description: Digital signature
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


[Numpy-discussion] Stacking arrays...

2006-11-07 Thread Christopher Barker
HI all,

I'm trying to get the hang of this new r_ and c_ stuff.

I need to take two MxN arrays, and stack them together into one MxNx2 
arrays. I found this works:

  a = N.ones((3,4))
  b = N.ones((3,4)) * 2
  a
array([[ 1.,  1.,  1.,  1.],
[ 1.,  1.,  1.,  1.],
[ 1.,  1.,  1.,  1.]])
  b
array([[ 2.,  2.,  2.,  2.],
[ 2.,  2.,  2.,  2.],
[ 2.,  2.,  2.,  2.]])
  a.shape = (3,4,1)
  b.shape = (3,4,1)
  c = N.c_[a,b]
  c.shape
(3, 4, 2)
  c[0,0]
array([ 1.,  2.])


What I'm wondering is if there is a way to do that without explicitly 
adding the extra dimension to a and b before calling c_ ?

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

NOAA/ORR/HAZMAT (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

[EMAIL PROTECTED]

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Passing numpy arrays to matlab

2006-11-07 Thread Matthew Brett
Hi,

 Thank you very much, I think this added documentation is pretty recent;
 I have never seen it before, and I did a lot a mex programming at some
 point... This whole mxarray nonsense reminds me why I gave up on matlab :),

I would be very happy to help with this.  It would be great if we
could get a standard well-maintained library of some sort towards
scipy - we (http://neuroimaging.scipy.org/) have a great deal of
matlab integration to do.

Best,

Matthew

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Passing numpy arrays to matlab

2006-11-07 Thread Pauli Virtanen
Hi all,

ti, 2006-11-07 kello 11:23 +0900, David Cournapeau kirjoitti:
 I am trying to find a nice way to communicate between matlab and 
 python. I am aware of pymat, which does that, but the code is 
 deprecated, and I thing basing the code on ctypes would lead to much 
 more robust code.
 
 http://claymore.engineer.gvsu.edu/%7Esteriana/Software/pymat.html
 
 I have a really simple prototype which can send and get back data from 
 matlab, but I was wondering if it would be possible to use a scheme 
 similar to ctypes instead of having to convert it by hand.

A while ago I wrote a mex extension to embed the Python interpreter
inside Matlab:

http://www.iki.fi/pav/pythoncall

I guess it's something like an inverse of pymat :)

But I guess this is not really what you are looking for, since at
present it just does a memory copy when passing arrays between Matlab
and Python. Though, shared arrays might be just possible to implement if
memory management is done carefully.

BR,

Pauli Virtanen



signature.asc
Description: Digitaalisesti allekirjoitettu viestin osa
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Stacking arrays...

2006-11-07 Thread Bill Baxter
dstack maybe? or does that add a dim on the other end?--bbOn 11/8/06, Christopher Barker [EMAIL PROTECTED]
 wrote:HI all,I'm trying to get the hang of this new r_ and c_ stuff.
I need to take two MxN arrays, and stack them together into one MxNx2arrays. I found this works:  a = N.ones((3,4))  b = N.ones((3,4)) * 2  aarray([[ 1.,1.,1.,1.],
[ 1.,1.,1.,1.],[ 1.,1.,1.,1.]])  barray([[ 2.,2.,2.,2.],[ 2.,2.,2.,2.],[ 2.,2.,2.,2.]])  a.shape = (3,4,1)
  b.shape = (3,4,1)  c = N.c_[a,b]  c.shape(3, 4, 2)  c[0,0]array([ 1.,2.])What I'm wondering is if there is a way to do that without explicitly
adding the extra dimension to a and b before calling c_ ?-Chris--Christopher Barker, Ph.D.OceanographerNOAA/ORR/HAZMAT (206) 526-6959 voice7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA98115 (206) 526-6317 main reception[EMAIL PROTECTED]-Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easierDownload IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/numpy-discussion
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


[Numpy-discussion] Slicing recarrays

2006-11-07 Thread Christopher Barker
Hi all,

I'm using a recarray to read a bunch of binary data out of a file. It's 
working great, but it seems there should be a more efficient way to 
slice the data. Here's what I've got:

The binary data is essentially a dump of a 2-d array of structs. So I 
read it like this:

DataType = N.dtype([(long,i4), (lat, i4), (flag,b1)])

data = N.fromfile(file, DataType)

data.shape = (M, N)

So I now have a MxN array of the structs. What I would like to do is 
extract a MxNx2 array of just the two 4-byte integers. It seems that I 
should be able to do that without copying -- by using a view into the 
original data. I can't figure out how, however. What I am doing is:

LEs = N.empty((M, N, 2), dtype=N.int32)
LEs[:,:,0] = data['long']
LEs[:,:,1] = data['lat']

This works, but these are BIG files, so it would be nice not to be doing 
that extra copying. Is that possible?

Thanks,

-Chris







-- 
Christopher Barker, Ph.D.
Oceanographer

NOAA/ORR/HAZMAT (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

[EMAIL PROTECTED]

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] A reimplementation of MaskedArray

2006-11-07 Thread Michael Sorich
On 10/25/06, Pierre GM [EMAIL PROTECTED] wrote:
 On Tuesday 24 October 2006 02:50, Michael Sorich wrote:
  I am currently running numpy rc2 (I haven't tried your
  reimplementation yet as I am still using python 2.3). I am wondering
  whether the new maskedarray is able to handle construction of arrays
  from masked scalar values (not sure if this is the correct term).

 The answer is no, unfortunately: both the new and old implementations fail at
 the same point, raising a TypeError: lists are processed through
 numpy.core.numeric.array, which doesn't handle that.

I have finally gotten around to upgrading to python 2.4 and have had a
chance to play with your new version of the MaskedArray. It is great
to see that someone is working on this. I have a few thoughts on
masked arrays that may or may no warrant discusion

1. It would be nice if the masked_singleton could be passed into a
ndarray, as this would allow it to be passed into the MaskedArray e.g.

import numpy as N
import ma.maskedarray as MA
test = N.array([1,2,MA.masked])
 ValueError: setting an array element with a sequence

If the masked_singleton was implemented as an object that is not a
MakedArray (which is a sequence that numpy.array chokes on), then a
valid numpy array with an object dtype could be produced. e.g.

class MaskedScalar:
def __str__(self):
return 'masked'
masked = MaskedScalar()

test = N.array([1,2,masked])
print test.dtype, test
object [1 2 masked]
print test == masked
[False False True]
print test[2] == masked
True
print test[2] is masked
True

Then it would be possible to alternatively define a masked array as
MA.array([1,2,masked]) or MA.array(N.array([1,2,masked])). In the
__init__ of the MaskedArray if the ndarray has an object dtype simply
calculate the mask from a==masked.

2. What happens if a masked array is passed into a ndarray or passed
into a MaskedArray with another mask?

test_ma1 = MA.array([1,2,3], mask=[False, False, True])
print test_ma1
[1 2 --]

print N.array(test_ma1)
[1 2 3]

test_ma2 = MA.array(test_ma1, mask=[True, False, False])
print test_ma2
[-- 2 3]

I suppose it depends on whether you are masking useful data, or the
masks represent missing data. In the former it may make sense to
change or remove the mask. However in the latter case the original
data entered is a bogus value which should never be unmasked. In this
case, when converting to a ndarray I think it make more sense to make
an object ndarray with the missing value containing the masked
singleton. Additionally, if the MaskedArray is holding missing data,
it does not make much sense to be able to pass in to the MA
constructor both an existing ma and a mask.

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] More on Numexpr-unsupported objects

2006-11-07 Thread Tim Hochberg
Ivan Vilata i Balaguer wrote:


[SNIP]

 Though I admit it may be strange for this error to be triggered.

 (I had a little mess with using ``expressions.ExpressionNode`` instead
 of ``expr.ExpressionNode``...  I still don't see why the private copy of
 the module is necessary.)

   
It's an attempt to make things thread safe. Since we are mucking around 
with the internals of the expression module, if there were multiple 
threads one might thread might change get_context out from under the 
other one. Giving each call to stringToExpression its own copy of the 
expression module prevents this.

It is,  admittedly, a kind of stupid way to do this. A more sane thing 
to do would probably to have some sort of expression object that we 
instantiate for each call to stringToExpression instead of mucking 
around with modules, which really aren't meant to be (ab)used this way. 
However, this would require a major rewrite of the expression module and 
I was feeling lazy at the time (and still am), so I resorted to 
questionable hackery.

-tim


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Passing numpy arrays to matlab

2006-11-07 Thread David Cournapeau
Pauli Virtanen wrote:
 Hi all,

 ti, 2006-11-07 kello 11:23 +0900, David Cournapeau kirjoitti:
   
 I am trying to find a nice way to communicate between matlab and 
 python. I am aware of pymat, which does that, but the code is 
 deprecated, and I thing basing the code on ctypes would lead to much 
 more robust code.

 http://claymore.engineer.gvsu.edu/%7Esteriana/Software/pymat.html

 I have a really simple prototype which can send and get back data from 
 matlab, but I was wondering if it would be possible to use a scheme 
 similar to ctypes instead of having to convert it by hand.
 

 A while ago I wrote a mex extension to embed the Python interpreter
 inside Matlab:

   http://www.iki.fi/pav/pythoncall

 I guess it's something like an inverse of pymat :)

   
Yes, but at the end, I think they enable similar things. Thanks for the 
link !
 But I guess this is not really what you are looking for, since at
 present it just does a memory copy when passing arrays between Matlab
 and Python. Though, shared arrays might be just possible to implement if
 memory management is done carefully.
   
In my case, it is much worse:

1 first, you have numpy data that you have to copy to mxArray, the 
structure representing arrays in matlab C api.
2 then when you send data to the matlab engine, this is done 
automatically through pipe  by the matlab engine API (maybe pipe does 
not imply copying; I don't know much about pipe from a programming point 
of view, actually)
3 The arrays you get back from matlab are in matlab mxArray 
structures: right now, I copy their data to new numpy arrays.

At first, I just developed a prototype without thinking too much, 
and the result was much slower than I thought: sending a numpy  with 
2e5x10 double takes around 100 ms on my quite powerful machine (around 
14 cycles per item for the best case). I suspect it is because I copy 
memory in a non contiguous manner (matlab arrays have a internal F 
storage for real arrays, but complex arrays are really two different 
arrays, which is different than Fortran convention I think, making the 
copy cost really expensive for complex arrays). To see if I was doing 
something wrong, I compared with numpy.require(ar, requirements = 
'F_CONTIGUOUS'), which is even much slower
There is not much I can do about 2, it looks like there is a way to 
avoid copying for 1, and my question was more specific to 3 (but 
reusable in 1, maybe, if I am smart enough). Basically:

 * how to create an object which has the same interface than numpy 
arrays, but owns the data from a foreign structure, which data are 
availble when building the object (The idea was to create a class which 
implements the array interface from python, kind of proxy class, which 
owns the data from mxArray; owns here is from a memory management point 
of view).

David

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Passing numpy arrays to matlab

2006-11-07 Thread David Cournapeau
Josh Marshall wrote:
 Hi David,

 Did you have a look at mlabwrap? It's quite hard to find on the net,  
 which is a shame, since it is a much more up to date version,  
 enhancing pymat with the things that you are trying to do. It allows  
 passing arrays and getting arrays back.

 http://mlabwrap.sourceforge.net/
   
I didn't know that, thanks. Unfortunately, it is not really what I am 
trying to do: mlabwrap is just a python interface a bit more high level 
than pymat, with many fancy tricks, but still do copies. What I would 
like is to avoid completely the copying by using proxy classes around 
data from numpy so that I can pass automatically numpy arrays to 
matlab C api, and a proxy class around data from matlab so that they 
look like numpy arrays.
I don't care that much about the actual api from python point of 
view, because I intend to use this mainly to compare matlab vs numpy 
implementation, not as a way to use matlab inside python regularly. And 
once the copy problem is solved, adding syntactic sugar using python is 
easy anyway, I think (it should be easy to do something similar to 
mlabwrap at that point),

cheers,

David

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion