[Numpy-discussion] un-silencing Numpy's deprecation warnings

2012-05-22 Thread Nathaniel Smith
So starting in Python 2.7 and 3.2, the Python developers have made DeprecationWarnings invisible by default: http://docs.python.org/whatsnew/2.7.html#the-future-for-python-2-x http://mail.python.org/pipermail/stdlib-sig/2009-November/000789.html http://bugs.python.org/issue7319 The only way

Re: [Numpy-discussion] Separating out the maskna code

2012-05-22 Thread Nathaniel Smith
On Tue, May 22, 2012 at 5:34 AM, Travis Oliphant tra...@continuum.io wrote: Just to be clear.   Are we waiting for the conclusion of the PyArray_Diagonal PR before proceeding with this one? We can talk about this one and everyone's welcome to look at the patch, of course. (In fact it'd be

Re: [Numpy-discussion] un-silencing Numpy's deprecation warnings

2012-05-22 Thread Peter
On Tue, May 22, 2012 at 9:27 AM, Nathaniel Smith n...@pobox.com wrote: So starting in Python 2.7 and 3.2, the Python developers have made DeprecationWarnings invisible by default:  http://docs.python.org/whatsnew/2.7.html#the-future-for-python-2-x  

Re: [Numpy-discussion] un-silencing Numpy's deprecation warnings

2012-05-22 Thread Robert Kern
On Tue, May 22, 2012 at 9:27 AM, Nathaniel Smith n...@pobox.com wrote: So starting in Python 2.7 and 3.2, the Python developers have made DeprecationWarnings invisible by default:  http://docs.python.org/whatsnew/2.7.html#the-future-for-python-2-x  

Re: [Numpy-discussion] un-silencing Numpy's deprecation warnings

2012-05-22 Thread Dag Sverre Seljebotn
On 05/22/2012 12:06 PM, Robert Kern wrote: On Tue, May 22, 2012 at 9:27 AM, Nathaniel Smithn...@pobox.com wrote: So starting in Python 2.7 and 3.2, the Python developers have made DeprecationWarnings invisible by default: http://docs.python.org/whatsnew/2.7.html#the-future-for-python-2-x

Re: [Numpy-discussion] un-silencing Numpy's deprecation warnings

2012-05-22 Thread Robert Kern
On Tue, May 22, 2012 at 11:14 AM, Dag Sverre Seljebotn d.s.seljeb...@astro.uio.no wrote: On 05/22/2012 12:06 PM, Robert Kern wrote: On Tue, May 22, 2012 at 9:27 AM, Nathaniel Smithn...@pobox.com  wrote: So maybe we should change all our DeprecationWarnings into FutureWarnings (or at least the

[Numpy-discussion] assign a float number to a member of integer array always return integer

2012-05-22 Thread Chao YUE
Dear all, Just in case some one didn't know this. Assign a float number to an integer array element will always return integer. In [4]: a=np.arange(2,11,2) In [5]: a Out[5]: array([ 2, 4, 6, 8, 10]) In [6]: a[1]=4.5 In [7]: a Out[7]: array([ 2, 4, 6, 8, 10]) so I would always do this

[Numpy-discussion] Problem with str.format() and np.recarray

2012-05-22 Thread Tom Aldcroft
I came across this problem which appears to be new in numpy 1.6.2 (vs. 1.6.1): In [17]: a = np.array([(1, )], dtype=[('a', 'i4')]) In [18]: ra = a.view(np.recarray) In [19]: '{}'.format(ra[0]) --- RuntimeError

Re: [Numpy-discussion] un-silencing Numpy's deprecation warnings

2012-05-22 Thread Nathaniel Smith
On Tue, May 22, 2012 at 11:06 AM, Robert Kern robert.k...@gmail.com wrote: On Tue, May 22, 2012 at 9:27 AM, Nathaniel Smith n...@pobox.com wrote: So starting in Python 2.7 and 3.2, the Python developers have made DeprecationWarnings invisible by default:  

Re: [Numpy-discussion] un-silencing Numpy's deprecation warnings

2012-05-22 Thread Robert Kern
On Tue, May 22, 2012 at 2:45 PM, Nathaniel Smith n...@pobox.com wrote: On Tue, May 22, 2012 at 11:06 AM, Robert Kern robert.k...@gmail.com wrote: On Tue, May 22, 2012 at 9:27 AM, Nathaniel Smith n...@pobox.com wrote: So starting in Python 2.7 and 3.2, the Python developers have made

[Numpy-discussion] Building error with ATLAS

2012-05-22 Thread Magician
Hi all, I'm now trying to build NumPy with ATLAS on CentOS 6.2. I'm going to use them with SciPy. My CentOS is installed as Software Development Workstation on my Virtual Machine (VMware Fusion 4, Mac OS 10.7.4). I already installed Python 2.7.3 on /usr/local/python-2.7.3 from sources, and no

[Numpy-discussion] question about in-place operations

2012-05-22 Thread Massimo DiPierro
hello everybody, first of all thanks to the developed for bumpy which is very useful. I am building a software that uses numpy+pyopencl for lattice qcd computations. One problem that I am facing is that I need to perform most operations on arrays in place and I must avoid creating temporary

Re: [Numpy-discussion] question about in-place operations

2012-05-22 Thread Dag Sverre Seljebotn
On 05/22/2012 04:25 PM, Massimo DiPierro wrote: hello everybody, first of all thanks to the developed for bumpy which is very useful. I am building a software that uses numpy+pyopencl for lattice qcd computations. One problem that I am facing is that I need to perform most operations on

Re: [Numpy-discussion] un-silencing Numpy's deprecation warnings

2012-05-22 Thread Jonathan T. Niehof
On 05/22/2012 03:50 AM, Peter wrote: We had the same discussion for Biopython two years ago, and introduced our own warning class to avoid our deprecations being silent (and thus almost pointless). It is just a subclass of Warning (originally we used a subclass of UserWarning). For SpacePy we

Re: [Numpy-discussion] question about in-place operations

2012-05-22 Thread Massimo DiPierro
Thank you. I will look into numexpr. Anyway, I do not need arbitrary expressions. If there were something like numpy.add_scaled(a,scale,b) with support for scale in int, float, complex, this would be sufficient for me. Massimo On May 22, 2012, at 9:32 AM, Dag Sverre Seljebotn wrote: On

Re: [Numpy-discussion] Internationalization of numpy/scipy docstrings...

2012-05-22 Thread Tim Cera
Docstrings are not stored in .rst files but in the numpy sources, so there are some non-trivial technical and workflow details missing here. But besides that, I think translating everything (even into a single language) is a massive amount of work, and it's not at all clear if there's enough

Re: [Numpy-discussion] question about in-place operations

2012-05-22 Thread Massimo DiPierro
For now I will be doing this: import numpy import time a=numpy.zeros(200) b=numpy.zeros(200) c=1.0 # naive solution t0 = time.time() for i in xrange(len(a)): a[i] += c*b[i] print time.time()-t0 # possible solution n=10 t0 = time.time() for i in xrange(0,len(a),n): a[i:i+n]

Re: [Numpy-discussion] question about in-place operations

2012-05-22 Thread Robert Kern
On Tue, May 22, 2012 at 3:47 PM, Massimo DiPierro massimo.dipie...@gmail.com wrote: Thank you. I will look into numexpr. Anyway, I do not need arbitrary expressions. If there were something like numpy.add_scaled(a,scale,b) with support for scale in int, float, complex, this would be

Re: [Numpy-discussion] question about in-place operations

2012-05-22 Thread Massimo DiPierro
Thank you this does it. On May 22, 2012, at 9:59 AM, Robert Kern wrote: On Tue, May 22, 2012 at 3:47 PM, Massimo DiPierro massimo.dipie...@gmail.com wrote: Thank you. I will look into numexpr. Anyway, I do not need arbitrary expressions. If there were something like

[Numpy-discussion] how to avoid re-shaping

2012-05-22 Thread Massimo DiPierro
One more questions (since this list is very useful. ;-) If I have a numpy array of arbitrary shape, is there are a way to sequentially loop over its elements without reshaping it into a 1D array? I am trying to simplify this: n=product(data.shape) oldshape = data.shape newshape = (n,)

Re: [Numpy-discussion] how to avoid re-shaping

2012-05-22 Thread Robert Kern
On Tue, May 22, 2012 at 4:09 PM, Massimo DiPierro massimo.dipie...@gmail.com wrote: One more questions (since this list is very useful. ;-) If I have a numpy array of arbitrary shape, is there are a way to sequentially loop over its elements without reshaping it into a 1D array? I am trying

Re: [Numpy-discussion] assign a float number to a member of integer array always return integer

2012-05-22 Thread Chris Barker
On Tue, May 22, 2012 at 6:33 AM, Chao YUE chaoyue...@gmail.com wrote: Just in case some one didn't know this. Assign a float number to an integer array element will always return integer. right -- numpy arrays are typed -- that's one of the points of them -- you wouldn't want the entire array

Re: [Numpy-discussion] subclassing ndarray subtleties??

2012-05-22 Thread Nathaniel Smith
On Mon, May 21, 2012 at 6:47 PM, Tom Aldcroft aldcr...@head.cfa.harvard.edu wrote: Over on the scipy-user mailing list there was a question about subclassing ndarray and I was interested to see two responses that seemed to imply that subclassing should be avoided. From Dag and Nathaniel,

Re: [Numpy-discussion] Internationalization of numpy/scipy docstrings...

2012-05-22 Thread josef . pktd
On Tue, May 22, 2012 at 10:51 AM, Tim Cera t...@cerazone.net wrote: Docstrings are not stored in .rst files but in the numpy sources, so there are some non-trivial technical and workflow details missing here. But besides that, I think translating everything (even into a single language) is a

Re: [Numpy-discussion] question about in-place operations

2012-05-22 Thread Dag Sverre Seljebotn
On 05/22/2012 04:54 PM, Massimo DiPierro wrote: For now I will be doing this: import numpy import time a=numpy.zeros(200) b=numpy.zeros(200) c=1.0 # naive solution t0 = time.time() for i in xrange(len(a)): a[i] += c*b[i] print time.time()-t0 # possible solution

Re: [Numpy-discussion] question about in-place operations

2012-05-22 Thread Francesc Alted
On 5/22/12 8:47 PM, Dag Sverre Seljebotn wrote: On 05/22/2012 04:54 PM, Massimo DiPierro wrote: For now I will be doing this: import numpy import time a=numpy.zeros(200) b=numpy.zeros(200) c=1.0 # naive solution t0 = time.time() for i in xrange(len(a)): a[i] += c*b[i]

Re: [Numpy-discussion] question about in-place operations

2012-05-22 Thread Massimo Di Pierro
Thank you Dag, I will look into it. Is there any documentation about ufunc? Is this the file core/src/umath/ufunc_object.c Massimo On May 22, 2012, at 1:47 PM, Dag Sverre Seljebotn wrote: On 05/22/2012 04:54 PM, Massimo DiPierro wrote: For now I will be doing this: import numpy import

Re: [Numpy-discussion] question about in-place operations

2012-05-22 Thread Massimo Di Pierro
This problem is linear so probably Ram IO bound. I do not think I would benefit much for multiple cores. But I will give it a try. In the short term this is good enough for me. On May 22, 2012, at 1:57 PM, Francesc Alted wrote: On 5/22/12 8:47 PM, Dag Sverre Seljebotn wrote: On 05/22/2012

Re: [Numpy-discussion] pre-PEP for making creative forking of NumPy less destructive

2012-05-22 Thread Frédéric Bastien
Hi, The example with numpy array for small array, the speed problem is probably because NumPy have not been speed optimized for low overhead. For example, each c function should check first if the input is a NumPy array, if not jump to a function to make one. For example, currently in the c

Re: [Numpy-discussion] subclassing ndarray subtleties??

2012-05-22 Thread Tom Aldcroft
On Tue, May 22, 2012 at 4:07 PM, Dan Goodman dg.gm...@thesamovar.net wrote: On 22/05/2012 18:20, Nathaniel Smith wrote: I don't know of anything that the docs are lacking in particular. It's just that subclassing in general is basically a special form of monkey-patching: you have this

Re: [Numpy-discussion] assign a float number to a member of integer array always return integer

2012-05-22 Thread Chao YUE
Thanks Chris for informative post. cheers, Chao 2012/5/22 Chris Barker chris.bar...@noaa.gov On Tue, May 22, 2012 at 6:33 AM, Chao YUE chaoyue...@gmail.com wrote: Just in case some one didn't know this. Assign a float number to an integer array element will always return integer.

Re: [Numpy-discussion] subclassing ndarray subtleties??

2012-05-22 Thread Chris Barker
On Tue, May 22, 2012 at 1:07 PM, Dan Goodman dg.gm...@thesamovar.net wrote: I think it would be useful to have an example of a completely 'correctly' subclassed ndarray that handles all of these issues that people could use as a template when they want to subclass ndarray. I think this is by

Re: [Numpy-discussion] Should arr.diagonal() return a copy or a view? (1.7 compatibility issue)

2012-05-22 Thread Travis Oliphant
I just realized that the pull request doesn't do what I thought it did which is just add the flag to warn users who are writing to an array that is a view when it used to be a copy. It's more cautious and also copies the data for 1.7. Is this really a necessary step? I guess it