Re: [Numpy-discussion] [ANN] Numpy 1.3.0rc2

2009-04-03 Thread Robert Pyle

On Apr 3, 2009, at 1:10 PM, David Cournapeau wrote:

> On Sat, Apr 4, 2009 at 1:44 AM, Robert Pyle   
> wrote:
>
>>
>> PPC G5, Mac OS X 10.5.6
>>
>> Installing from source for my usual python (EPD Py25 4.1.30101) went
>> smoothly and numpy.test() passed.
>
> That's confusing. I have no idea why this works - or maybe EPD loads
> numpy as installed in the python.org binary ?

I should have been clearer:  I performed two installations, from the  
source tarball for EPD, and from the OS X installer for the python.org  
2.5 python.
>
>>
>> I guess EPD python already has nose, but python.org does not?

After I installed nose for the python.org 2.5, numpy.test() runs  
perfectly, that is,

Ran 2030 tests in 13.710s

OK (KNOWNFAIL=2, SKIP=1)


Bob

___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy.ctypeslib.ndpointer and the restype attribute [patch]

2009-04-03 Thread Thomas Heller
Thomas Heller schrieb:
>> Sturla Molden schrieb:
>>> On 3/26/2009 12:41 PM, Jens Rantil wrote:
>>> 
 Wouldn't my code, or a tweak of it, be a nice feature in
 numpy.ctypeslib? Is this the wrong channel for proposing things like
 this?
>>> 
>>> If you look at
>>> 
>>> http://svn.scipy.org/svn/numpy/trunk/numpy/ctypeslib.py
>>> 
>>> you will see that it does almost the same. I think it would be better to 
>>> work out why ndpointer fails as restype and patch that.
>> 
> 
> Thomas Heller schrieb:
> 
>> ndpointer(...), which returns an _nptr instance, does not work as restype
>> because neither it is a base class of one of the ctypes base types like
>> ctypes.c_void_p, also it is not callable with one argument.
>> 
>> There are two ways to fix this.  The first one is to make the _nptr callable
> [...]
>> 
>> The other way is to make _nptr a subclass of ctypes.c_void_p,
>> the result that the foreign function call returns will then be
>> an instance of this class.  Unfortunately, ctypes will not call
>> __new__() to create this instance; so a custom __new__() implementation
>> cannot return a numpy array and we are left with the _nptr instance.
>> The only way to create and access the numpy array is to construct
>> and return one from a method call on the _nptr instance, or a property
>> on the _nptr instance.
>> Ok, .errcheck could call that method and return the result.
>> 
> Well, looking into the ctypes sources trying to invent a new protocol for
> the restype attribute I found out that THERE IS ALREADY a mechanism for it,
> but I had totally forgotten that it exists.
> 
> When the .restype attribute of a function is set to a SUBCLASS of a
> ctypes type (c_void_p for example), an instance of this subclass is created.
> After that, if this instance has a _check_retval_ method, this method is 
> called
> and the result of this call is returned.  So, it is indeed possible to create
> a class that can be assigned to .restype, and which can convert the return 
> value
> of a function to whatever we like.
> 
> I will prepare a patch for numpy.ctypeslib.
> 

It seems there isn't much interest in a patch - true?

Anyway, before it gets totally forgotten, here is the patch.
The _ndptr._check_retval_ method should probably be extended
to handle the memory management of the result.

diff -u c:\python25\lib\site-packages\numpy\ctypeslib.py.orig 
c:\python25\lib\site-packages\numpy\ctypeslib.py.new
--- c:\python25\lib\site-packages\numpy\ctypeslib.py.orig   Fri Apr 03 
19:35:10 2009
+++ c:\python25\lib\site-packages\numpy\ctypeslib.py.newFri Apr 03 
19:35:10 2009
@@ -69,10 +69,12 @@
 as_ctypes = _dummy
 as_array = _dummy
 from numpy import intp as c_intp
+_ndptr_base = object
 else:
 import numpy.core._internal as nic
 c_intp = nic._getintp_ctype()
 del nic
+_ndptr_base = ctypes.c_void_p
 
 # Adapted from Albert Strasheim
 def load_library(libname, loader_path):
@@ -130,7 +132,24 @@
 return res
 
 
-class _ndptr(object):
+class _ndptr(_ndptr_base):
+
+def _check_retval_(self):
+"""This method is called when this class is used as .restype
+attribute for a dll function.  It constructs a numpy array from
+a void pointer."""
+return array(self)
+
+@property
+def __array_interface__(self):
+return {'descr': self._dtype_.descr,
+'__ref': self,
+'strides': None,
+'shape': self._shape_,
+'version': 3,
+'typestr': self._dtype_.descr[0][1],
+'data': (self.value, False),
+}
 
 def from_param(cls, obj):
 if not isinstance(obj, ndarray):


-- 
Thanks,
Thomas

___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] "Can't install when cross-compiling"

2009-04-03 Thread Andrew Myers
Hello All,

I'm trying to install numpy 1.2.1 for 64-bit python 2.6.1 on Leopard.  
Python appears to have been installed correctly, and sys.maxint  
returns the 64 bit value. When I do

sudo python-64 setup.py config_fc --fcompiler=gnu95 install

I get the following error message:

running build_scripts
   adding 'build/scripts.macosx-10.5-universal-2.6/f2py64-64' to scripts
error: Can't install when cross-compiling

What's weird is that I've got this working once before, but after I  
tried to erase and re-install I started getting the error.

Chris Kees seems to have had this problem a few months back: 
http://www.nabble.com/Mac-OSX-4-way-universal-td18957309.html

He found that after erasing "Library/Frameworks/Python64.framework"  
the build worked correctly. Apparently having some remnant of a  
previous install on your system tricks the installer into thinking you  
are cross-compiling. However, removing that directory doesn't work for  
me.

Any ideas?

Thanks!
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] [ANN] Numpy 1.3.0rc2

2009-04-03 Thread Alan G Isaac
Looks good.

Cheers,
Alan Isaac


Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit (Intel)] on 
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np 
>>> np.test()
Running unit tests for numpy
NumPy version 1.3.0rc2
NumPy is installed in C:\Python26\lib\site-packages\numpy
Python version 2.6.1 (r261:67517, Dec  4 2008, 16:51:00) [MSC v.1500 32 bit 
(Intel)]
nose version 0.11.0
[snip]
Ran 1882 tests in 10.453s

OK (KNOWNFAIL=3, SKIP=1)



___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] [ANN] Numpy 1.3.0rc2

2009-04-03 Thread David Cournapeau
On Sat, Apr 4, 2009 at 1:44 AM, Robert Pyle  wrote:

>
> PPC G5, Mac OS X 10.5.6
>
> Installing from source for my usual python (EPD Py25 4.1.30101) went
> smoothly and numpy.test() passed.

That's confusing. I have no idea why this works - or maybe EPD loads
numpy as installed in the python.org binary ?

>
> I guess EPD python already has nose, but python.org does not?

Indeed. The whole point of EPD is to package a whole suite of tools
integrated together - you need to install node separately.

cheers,

David
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] [ANN] Numpy 1.3.0rc2

2009-04-03 Thread Jarrod Millman
On Fri, Apr 3, 2009 at 8:18 AM, David Cournapeau
 wrote:
> I am pleased to announce the release of the rc2 for numpy 1.3.0. I have
> decided to go for a rc2 instead of the release directly because of the
> serious mac os X issue. You can find source tarballs and installers for
> both Mac OS X and Windows on the sourceforge page:

Thanks to David and everyone else who worked on this release!  I am
looking forward to 1.3.0 final.
Jarrod
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] [ANN] Numpy 1.3.0rc2

2009-04-03 Thread Robert Pyle
Hi David,

On Apr 3, 2009, at 11:18 AM, David Cournapeau wrote:
>
> I am pleased to announce the release of the rc2 for numpy 1.3.0. I  
> have
> decided to go for a rc2 instead of the release directly because of the
> serious mac os X issue. You can find source tarballs and installers  
> for
> both Mac OS X and Windows on the sourceforge page:
>
> https://sourceforge.net/projects/numpy/

PPC G5, Mac OS X 10.5.6

Installing from source for my usual python (EPD Py25 4.1.30101) went  
smoothly and numpy.test() passed.

Installing from the OS X installer for python.org was uneventful, but  
when I tried to run the usual tests, I got


~ $ /Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5
Python 2.5.4 (r254:67917, Dec 23 2008, 14:57:27)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> import numpy as np
 >>> np.__version__
'1.3.0rc2'
 >>> np.test()
Running unit tests for numpy
Traceback (most recent call last):
   File "", line 1, in 
   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/numpy/testing/nosetester.py", line 242, in test
 self._show_system_info()
   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/numpy/testing/nosetester.py", line 149, in  
_show_system_info
 nose = import_nose()
   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/numpy/testing/nosetester.py", line 49, in  
import_nose
 raise ImportError(msg)
ImportError: Need nose >= 0.10.0 for tests - see 
http://somethingaboutorange.com/mrl/projects/nose
 >>>


I guess EPD python already has nose, but python.org does not?

Bob


___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] Fwd: [ANN] Numpy 1.3.0rc2

2009-04-03 Thread Tommy Grav
On Apr 3, 2009, at 11:18 AM, David Cournapeau wrote:

> Hi,
>
> I am pleased to announce the release of the rc2 for numpy 1.3.0. I  
> have
> decided to go for a rc2 instead of the release directly because of the
> serious mac os X issue. You can find source tarballs and installers  
> for
> both Mac OS X and Windows on the sourceforge page:

Installed on my PowerMac Intel running 10.5.6 and ActiveState 2.5.4.3  
using
the mpkg installer. Worked fine.

tgrav% python
ActivePython 2.5.4.3 (ActiveState Software Inc.) based on
Python 2.5.4 (r254:67916, Jan 20 2009, 14:11:42)
[GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> import numpy
 >>> print numpy.__version__
1.3.0rc2
 >>> numpy.test()
Running unit tests for numpy
NumPy version 1.3.0rc2
NumPy is installed in /Library/Frameworks/Python.framework/Versions/ 
2.5/lib/python2.5/site-packages/numpy
Python version 2.5.4 (r254:67916, Jan 20 2009, 14:11:42) [GCC 4.0.1  
(Apple Computer, Inc. build 5250)]
nose version 0.10.4
 
 
 
 
 
 
 
K... 
 
 
 
 
 
 
 
...S..
--
Ran 2030 tests in 7.663s

OK (KNOWNFAIL=1, SKIP=1)

 >>>


___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] [ANN] Numpy 1.3.0rc2

2009-04-03 Thread Stéfan van der Walt
Hi David

2009/4/3 David Cournapeau :
> I am pleased to announce the release of the rc2 for numpy 1.3.0. I have
> decided to go for a rc2 instead of the release directly because of the
> serious mac os X issue. You can find source tarballs and installers for
> both Mac OS X and Windows on the sourceforge page:

Thanks for all your effort!

Also, thanks to the 3 people (out of the 300 who downloaded the
binary) who reported that it was unusable :-)

Cheers
Stéfan
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] [ANN] Numpy 1.3.0rc2

2009-04-03 Thread David Cournapeau
Hi,

I am pleased to announce the release of the rc2 for numpy 1.3.0. I have
decided to go for a rc2 instead of the release directly because of the
serious mac os X issue. You can find source tarballs and installers for
both Mac OS X and Windows on the sourceforge page:

https://sourceforge.net/projects/numpy/

>

The release note for the 1.3.0 release are below,

the numpy developers.

=
NumPy 1.3.0 Release Notes
=

This minor includes numerous bug fixes, official python 2.6 support, and
several new features such as generalized ufuncs.

Highlights
==

Python 2.6 support
~~

Python 2.6 is now supported on all previously supported platforms, including
windows.

http://www.python.org/dev/peps/pep-0361/

Generalized ufuncs
~~

There is a general need for looping over not only functions on scalars
but also
over functions on vectors (or arrays), as explained on
http://scipy.org/scipy/numpy/wiki/GeneralLoopingFunctions. We propose to
realize this concept by generalizing the universal functions (ufuncs), and
provide a C implementation that adds ~500 lines to the numpy code base. In
current (specialized) ufuncs, the elementary function is limited to
element-by-element operations, whereas the generalized version supports
"sub-array" by "sub-array" operations. The Perl vector library PDL
provides a
similar functionality and its terms are re-used in the following.

Each generalized ufunc has information associated with it that states
what the
"core" dimensionality of the inputs is, as well as the corresponding
dimensionality of the outputs (the element-wise ufuncs have zero core
dimensions). The list of the core dimensions for all arguments is called the
"signature" of a ufunc. For example, the ufunc numpy.add has signature
"(),()->()" defining two scalar inputs and one scalar output.

Another example is (see the GeneralLoopingFunctions page) the function
inner1d(a,b) with a signature of "(i),(i)->()". This applies the inner
product
along the last axis of each input, but keeps the remaining indices
intact. For
example, where a is of shape (3,5,N) and b is of shape (5,N), this will
return
an output of shape (3,5). The underlying elementary function is called 3*5
times. In the signature, we specify one core dimension "(i)" for each
input and
zero core dimensions "()" for the output, since it takes two 1-d arrays and
returns a scalar. By using the same name "i", we specify that the two
corresponding dimensions should be of the same size (or one of them is
of size
1 and will be broadcasted).

The dimensions beyond the core dimensions are called "loop" dimensions.
In the
above example, this corresponds to (3,5).

The usual numpy "broadcasting" rules apply, where the signature
determines how
the dimensions of each input/output object are split into core and loop
dimensions:

While an input array has a smaller dimensionality than the corresponding
number
of core dimensions, 1's are pre-pended to its shape.  The core
dimensions are
removed from all inputs and the remaining dimensions are broadcasted;
defining
the loop dimensions.  The output is given by the loop dimensions plus the
output core dimensions.

Experimental Windows 64 bits support


Numpy can now be built on windows 64 bits (amd64 only, not IA64), with
both MS
compilers and mingw-w64 compilers:

This is *highly experimental*: DO NOT USE FOR PRODUCTION USE. See
INSTALL.txt,
Windows 64 bits section for more information on limitations and how to
build it
by yourself.

New features


Formatting issues
~

Float formatting is now handled by numpy instead of the C runtime: this
enables
locale independent formatting, more robust fromstring and related methods.
Special values (inf and nan) are also more consistent across platforms
(nan vs
IND/NaN, etc...), and more consistent with recent python formatting work (in
2.6 and later).

Nan handling in max/min
~~~

The maximum/minimum ufuncs now reliably propagate nans. If one of the
arguments is a nan, then nan is retured. This affects np.min/np.max,
amin/amax
and the array methods max/min. New ufuncs fmax and fmin have been added
to deal
with non-propagating nans.

Nan handling in sign


The ufunc sign now returns nan for the sign of anan.


New ufuncs
~~

#. fmax - same as maximum for integer types and non-nan floats. Returns the
   non-nan argument if one argument is nan and returns nan if both arguments
   are nan.
#. fmin - same as minimum for integer types and non-nan floats. Returns the
   non-nan argument if one argument is nan and returns nan if both arguments
   are nan.
#. deg2rad - converts degrees to radians, same as the radians ufunc.
#. rad2deg - converts radians to degrees, same as the degrees 

Re: [Numpy-discussion] dpss windows

2009-04-03 Thread Gabriel Beckers
I, for one, would be very grateful if DPSS code could be added to NumPy.
Best, Gabriel

On Fri, 2009-04-03 at 16:21 +0200, Stéfan van der Walt wrote:
> Hi Sturla
> 
> 2009/4/3 Sturla Molden :
> > NumPy has support for various window functions (von Hann, hamming,
> > blackman, bartlet, kaiser). DPSS windows (e.g. used by multitaper
> > spectral estimators) are missing. Is there any particular reason for this?
> 
> If things are missing, it probably means no one needed them thus far.
> Would you mind uploading your patch to Trac?
> 
> I still owe you a review on your other patch; I can do that on Sunday evening.
> 
> Cheers

___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] dpss windows

2009-04-03 Thread Stéfan van der Walt
Hi Sturla

2009/4/3 Sturla Molden :
> NumPy has support for various window functions (von Hann, hamming,
> blackman, bartlet, kaiser). DPSS windows (e.g. used by multitaper
> spectral estimators) are missing. Is there any particular reason for this?

If things are missing, it probably means no one needed them thus far.
Would you mind uploading your patch to Trac?

I still owe you a review on your other patch; I can do that on Sunday evening.

Cheers
Stéfan
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Fwd: Fast numpy array visualization

2009-04-03 Thread Robert Cimrman
Stéfan van der Walt wrote:
> Hi all,
> 
> Nicolas Rougier is doing some fun things with Pyglet and IPython!

Awesome!

r.

> -- Forwarded message --
> From: Nicolas Rougier
> Date: 2009/4/3
> Subject: Fast numpy array visualization
> To: pyglet-users
> 
> Hi all,
> 
> I've adapted the code from the ipython/python terminal to display 2d
> numpy arrays (using texture) directly within the terminal.
> 
> Sources & screenshots:
> http://www.loria.fr/~rougier/glnumpy.html
> 
> 
> 
> Nicolas
> ___
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
> 
> 

___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] dpss windows

2009-04-03 Thread Sturla Molden
NumPy has support for various window functions (von Hann, hamming, 
blackman, bartlet, kaiser). DPSS windows (e.g. used by multitaper 
spectral estimators) are missing. Is there any particular reason for this?

(No this is not a request, I already have my own dpss code. I just 
notice while reading the NumPy and SciPy docs today that dpss windows 
are missing.)


Sturla Molden


___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] Fwd: Fast numpy array visualization

2009-04-03 Thread Stéfan van der Walt
Hi all,

Nicolas Rougier is doing some fun things with Pyglet and IPython!

Cheers
Stéfan

-- Forwarded message --
From: Nicolas Rougier
Date: 2009/4/3
Subject: Fast numpy array visualization
To: pyglet-users

Hi all,

I've adapted the code from the ipython/python terminal to display 2d
numpy arrays (using texture) directly within the terminal.

Sources & screenshots:
http://www.loria.fr/~rougier/glnumpy.html



Nicolas
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion