[Numpy-discussion] Py3k and numpy

2008-12-04 Thread Erik Tollerud
I noticed that the Python 3000 final was released today... is there any sense of how long it will take to get numpy working under 3k? I would imagine it'll be a lot to adapt given the low-level change, but is the work already in progress? ___

[Numpy-discussion] genloadtxt: second serving

2008-12-04 Thread Pierre GM
All, Here's the second round of genloadtxt. That's a tad cleaner version than the previous one, where I tried to take into account the different comments and suggestions that were posted. So, tabs should be supported and explicit whitespaces are not collapsed. FYI, in the __main__ section,

[Numpy-discussion] genloadtxt: second serving (tests)

2008-12-04 Thread Pierre GM
And now for the tests: # pylint disable-msg=E1101, W0212, W0621 import numpy as np import numpy.ma as ma from numpy.ma.testutils import * from StringIO import StringIO from _preview import * class TestLineSplitter(TestCase): Tests the LineSplitter class. # def

Re: [Numpy-discussion] genloadtxt: second serving

2008-12-04 Thread Manuel Metz
Pierre GM wrote: All, Here's the second round of genloadtxt. That's a tad cleaner version than the previous one, where I tried to take into account the different comments and suggestions that were posted. So, tabs should be supported and explicit whitespaces are not collapsed. FYI, in

[Numpy-discussion] Broadcasting question

2008-12-04 Thread Olivier Grisel
Hi list, Suppose I have array a with dimensions (d1, d3) and array b with dimensions (d2, d3). I want to compute array c with dimensions (d1, d2) holding the squared euclidian norms of vectors in a and b with size d3. My first take was to use a python level loop: from numpy import * c =

Re: [Numpy-discussion] Broadcasting question

2008-12-04 Thread Stéfan van der Walt
Hi Olivier 2008/12/4 Olivier Grisel [EMAIL PROTECTED]: To avoid the python level loop I then tried to use broadcasting as follows: c = sum((a[:,newaxis,:] - b) ** 2, axis=2) But this build a useless and huge (d1, d2, d3) temporary array that does not fit in memory for large values of d1, d2

Re: [Numpy-discussion] Compiler options for mingw?

2008-12-04 Thread Zachary Pincus
I needed it to help me fixing a couple of bugs for old CPU, so it ended up being implemented in the nsis script for scipy now (I will add it to numpy installers too). So from now, any newly releases of both numpy and scipy installers could be overriden: installer-name.exe /arch native -

Re: [Numpy-discussion] Py3k and numpy

2008-12-04 Thread Charles R Harris
On Thu, Dec 4, 2008 at 1:20 AM, Erik Tollerud [EMAIL PROTECTED]wrote: I noticed that the Python 3000 final was released today... is there any sense of how long it will take to get numpy working under 3k? I would imagine it'll be a lot to adapt given the low-level change, but is the work

Re: [Numpy-discussion] Broadcasting question

2008-12-04 Thread Olivier Grisel
2008/12/4 Stéfan van der Walt [EMAIL PROTECTED]: Hi Olivier 2008/12/4 Olivier Grisel [EMAIL PROTECTED]: To avoid the python level loop I then tried to use broadcasting as follows: c = sum((a[:,newaxis,:] - b) ** 2, axis=2) But this build a useless and huge (d1, d2, d3) temporary array that

Re: [Numpy-discussion] Broadcasting question

2008-12-04 Thread Charles R Harris
On Thu, Dec 4, 2008 at 8:26 AM, Olivier Grisel [EMAIL PROTECTED]wrote: Hi list, Suppose I have array a with dimensions (d1, d3) and array b with dimensions (d2, d3). I want to compute array c with dimensions (d1, d2) holding the squared euclidian norms of vectors in a and b with size d3.

Re: [Numpy-discussion] genloadtxt: second serving

2008-12-04 Thread Pierre GM
On Dec 4, 2008, at 7:22 AM, Manuel Metz wrote: Will loadtxt in that case remain as is? Or will the _faulttolerantconv class be used? No idea, we need to discuss it. There's a problem with _faulttolerantconv: using np.nan as default value will not work in Python2.6 if the output is to be

Re: [Numpy-discussion] Broadcasting question

2008-12-04 Thread Olivier Grisel
2008/12/4 Charles R Harris [EMAIL PROTECTED]: On Thu, Dec 4, 2008 at 8:26 AM, Olivier Grisel [EMAIL PROTECTED] wrote: Hi list, Suppose I have array a with dimensions (d1, d3) and array b with dimensions (d2, d3). I want to compute array c with dimensions (d1, d2) holding the squared

Re: [Numpy-discussion] Py3k and numpy

2008-12-04 Thread Charles R Harris
On Thu, Dec 4, 2008 at 9:39 AM, Charles R Harris [EMAIL PROTECTED]wrote: On Thu, Dec 4, 2008 at 1:20 AM, Erik Tollerud [EMAIL PROTECTED]wrote: I noticed that the Python 3000 final was released today... is there any sense of how long it will take to get numpy working under 3k? I would

Re: [Numpy-discussion] Py3k and numpy

2008-12-04 Thread Robert Kern
On Thu, Dec 4, 2008 at 12:57, Charles R Harris [EMAIL PROTECTED] wrote: On Thu, Dec 4, 2008 at 9:39 AM, Charles R Harris [EMAIL PROTECTED] wrote: On Thu, Dec 4, 2008 at 1:20 AM, Erik Tollerud [EMAIL PROTECTED] wrote: I noticed that the Python 3000 final was released today... is there

Re: [Numpy-discussion] in(np.nan) on python 2.6

2008-12-04 Thread Pierre GM
On Nov 25, 2008, at 12:23 PM, Pierre GM wrote: All, Sorry to bump my own post, and I was kinda threadjacking anyway: Some functions of numy.ma (eg, ma.max, ma.min...) accept explicit outputs that may not be MaskedArrays. When such an explicit output is not a MaskedArray, a value that

Re: [Numpy-discussion] in(np.nan) on python 2.6

2008-12-04 Thread Jarrod Millman
On Thu, Dec 4, 2008 at 11:14 AM, Pierre GM [EMAIL PROTECTED] wrote: Raise a ValueError (even in 2.5, therefore risking to break something) +1 -- Jarrod Millman Computational Infrastructure for Research Labs 10 Giannini Hall, UC Berkeley phone: 510.643.4014 http://cirl.berkeley.edu/

Re: [Numpy-discussion] Py3k and numpy

2008-12-04 Thread Tommy Grav
On Dec 4, 2008, at 2:03 PM, Robert Kern wrote: It does. What problems are people seeing? Is it just the Windows build that causes people to say numpy doesn't work with Python 2.6? There is currently no official Mac OSX binary for numpy for python 2.6, but you can build it from source. Is there

Re: [Numpy-discussion] in(np.nan) on python 2.6

2008-12-04 Thread josef . pktd
On Thu, Dec 4, 2008 at 2:40 PM, Jarrod Millman [EMAIL PROTECTED] wrote: On Thu, Dec 4, 2008 at 11:14 AM, Pierre GM [EMAIL PROTECTED] wrote: Raise a ValueError (even in 2.5, therefore risking to break something) +1 +1 I'm not yet a serious user of numpy/scipy, but when debugging the discrete

Re: [Numpy-discussion] Py3k and numpy

2008-12-04 Thread Jarrod Millman
On Thu, Dec 4, 2008 at 12:15 PM, Tommy Grav [EMAIL PROTECTED] wrote: On Dec 4, 2008, at 2:03 PM, Robert Kern wrote: It does. What problems are people seeing? Is it just the Windows build that causes people to say numpy doesn't work with Python 2.6? There is currently no official Mac OSX

Re: [Numpy-discussion] in(np.nan) on python 2.6

2008-12-04 Thread Pierre GM
On Dec 4, 2008, at 3:24 PM, [EMAIL PROTECTED] wrote: On Thu, Dec 4, 2008 at 2:40 PM, Jarrod Millman [EMAIL PROTECTED] wrote: On Thu, Dec 4, 2008 at 11:14 AM, Pierre GM [EMAIL PROTECTED] wrote: Raise a ValueError (even in 2.5, therefore risking to break something) +1 +1 OK then,

Re: [Numpy-discussion] genloadtxt: second serving

2008-12-04 Thread Ryan May
Pierre GM wrote: All, Here's the second round of genloadtxt. That's a tad cleaner version than the previous one, where I tried to take into account the different comments and suggestions that were posted. So, tabs should be supported and explicit whitespaces are not collapsed. Looks

Re: [Numpy-discussion] in(np.nan) on python 2.6

2008-12-04 Thread Christopher Barker
[EMAIL PROTECTED] wrote: Raise a ValueError (even in 2.5, therefore risking to break something) +1 as well it took me a while to figure out that some mysteriously appearing zeros were nans that were silently converted during casting to int. and this is why -- a zero is a perfectly valid and

Re: [Numpy-discussion] Apply a function to an array elementwise

2008-12-04 Thread Tim Michelsen
I want to apply a function (myfunc which takes and returns a scalar) to each element in a multi-dimensioned array (data): I can do this: newdata = numpy.array([myfunc(d) for d in data.flat]).reshape(data.shape) But I'm wondering if there's a faster more numpy way. I've looked at the

Re: [Numpy-discussion] PyArray_EMPTY and Cython

2008-12-04 Thread Kurt Smith
On Tue, Dec 2, 2008 at 9:57 PM, Gabriel Gellner [EMAIL PROTECTED]wrote: After some discussion on the Cython lists I thought I would try my hand at writing some Cython accelerators for empty and zeros. This will involve using PyArray_EMPTY, I have a simple prototype I would like to get

[Numpy-discussion] checksum on numpy float array

2008-12-04 Thread Brennan Williams
My app reads in one or more float arrays from a binary file. Sometimes due to network timeouts etc the array is not read correctly. What would be the best way of checking the validity of the data? Would some sort of checksum approach be a good idea? Would that work with an array of floating

Re: [Numpy-discussion] checksum on numpy float array

2008-12-04 Thread Robert Kern
On Thu, Dec 4, 2008 at 17:17, Brennan Williams [EMAIL PROTECTED] wrote: My app reads in one or more float arrays from a binary file. Sometimes due to network timeouts etc the array is not read correctly. What would be the best way of checking the validity of the data? Would some sort of

Re: [Numpy-discussion] checksum on numpy float array

2008-12-04 Thread josef . pktd
On Thu, Dec 4, 2008 at 6:17 PM, Brennan Williams [EMAIL PROTECTED] wrote: My app reads in one or more float arrays from a binary file. Sometimes due to network timeouts etc the array is not read correctly. What would be the best way of checking the validity of the data? Would some sort of

Re: [Numpy-discussion] genloadtxt: second serving

2008-12-04 Thread Jarrod Millman
I am not familiar with this, but it looks quite useful: http://www.stecf.org/software/PYTHONtools/astroasciidata/ or (http://www.scipy.org/AstroAsciiData) Within the AstroAsciiData project we envision a module which can be used to work on all kinds of ASCII tables. The module provides a

Re: [Numpy-discussion] checksum on numpy float array

2008-12-04 Thread Brennan Williams
[EMAIL PROTECTED] wrote: On Thu, Dec 4, 2008 at 6:17 PM, Brennan Williams [EMAIL PROTECTED] wrote: My app reads in one or more float arrays from a binary file. Sometimes due to network timeouts etc the array is not read correctly. What would be the best way of checking the validity of

Re: [Numpy-discussion] checksum on numpy float array

2008-12-04 Thread Robert Kern
On Thu, Dec 4, 2008 at 17:43, Brennan Williams [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: On Thu, Dec 4, 2008 at 6:17 PM, Brennan Williams [EMAIL PROTECTED] wrote: My app reads in one or more float arrays from a binary file. Sometimes due to network timeouts etc the array is not read

Re: [Numpy-discussion] checksum on numpy float array

2008-12-04 Thread josef . pktd
I didn't check what this does behind the scenes, but try this m = hashlib.md5() m.update(np.array(range(100))) m.update(np.array(range(200))) m2 = hashlib.md5() m2.update(np.array(range(100))) m2.update(np.array(range(200))) print m.hexdigest() print m2.hexdigest() assert m.hexdigest() ==

Re: [Numpy-discussion] checksum on numpy float array

2008-12-04 Thread josef . pktd
On Thu, Dec 4, 2008 at 6:57 PM, [EMAIL PROTECTED] wrote: I didn't check what this does behind the scenes, but try this I forgot to paste: import hashlib #standard python library Josef ___ Numpy-discussion mailing list Numpy-discussion@scipy.org

Re: [Numpy-discussion] checksum on numpy float array

2008-12-04 Thread Brennan Williams
Thanks [EMAIL PROTECTED] wrote: I didn't check what this does behind the scenes, but try this import hashlib #standard python library import numpy as np m = hashlib.md5() m.update(np.array(range(100))) m.update(np.array(range(200))) m2 = hashlib.md5() m2.update(np.array(range(100)))

Re: [Numpy-discussion] checksum on numpy float array

2008-12-04 Thread Robert Kern
On Thu, Dec 4, 2008 at 18:54, Brennan Williams [EMAIL PROTECTED] wrote: Thanks [EMAIL PROTECTED] wrote: I didn't check what this does behind the scenes, but try this import hashlib #standard python library import numpy as np m = hashlib.md5() m.update(np.array(range(100)))

Re: [Numpy-discussion] checksum on numpy float array

2008-12-04 Thread Brennan Williams
Robert Kern wrote: On Thu, Dec 4, 2008 at 18:54, Brennan Williams [EMAIL PROTECTED] wrote: Thanks [EMAIL PROTECTED] wrote: I didn't check what this does behind the scenes, but try this import hashlib #standard python library import numpy as np m = hashlib.md5()

Re: [Numpy-discussion] Py3k and numpy

2008-12-04 Thread Lisandro Dalcin
From my experience working on my own projects and Cython: * the C code making Python C-API calls could be made to version-agnostic by using preprocessor macros, and even some compatibility header conditionally included. Perhaps the later would be the easiest for C-API calls (we have a lot already