[Numpy-discussion] datetime failure on py3k, string type issue.

2010-05-04 Thread Charles R Harris
The following fails after fixing datetime_data assert_equal(datetime_data(a.dtype), ('us', 1, 1, 1)) The problem is that 'us' is unicode and the function call yields bytes. The question is: should datetime units use unicode when compiled on python = 3k? Chuck

Re: [Numpy-discussion] PY_ARRAY_UNIQUE_SYMBOL is too far reaching?

2010-05-04 Thread Austin Bingham
On Tue, May 4, 2010 at 7:05 AM, David Cournapeau courn...@gmail.com wrote: On Mon, May 3, 2010 at 7:23 PM, Austin Bingham austin.bing...@gmail.com wrote: Hi everyone, I've recently been developing a python module and C++ library in parallel, with core functionality in python and C++ largely

Re: [Numpy-discussion] incremental histogram

2010-05-04 Thread denis
On 03/05/2010 16:02, Neal Becker wrote: I have coded in c++ a histogram object that can be used as: h += my_sample or h += my_vector This is very useful in simulations which are looping and developing results incrementally. It would me great to have such a feature in numpy. Neal, I

Re: [Numpy-discussion] incremental histogram

2010-05-04 Thread Neal Becker
denis wrote: On 03/05/2010 16:02, Neal Becker wrote: I have coded in c++ a histogram object that can be used as: h += my_sample or h += my_vector This is very useful in simulations which are looping and developing results incrementally. It would me great to have such a feature in

Re: [Numpy-discussion] incremental histogram

2010-05-04 Thread denis
On 04/05/2010 14:09, Neal Becker wrote: denis wrote: Neal, I like the idea of a faster np.histogram / histogramdd; but it would have to be compatible with numpy and pylab or at least a clear, documented subset (doc first). The point is not to be faster, it's to be incremental. OK,

Re: [Numpy-discussion] Poll: Semantics for % in Cython

2010-05-04 Thread S. Chris Colbert
On Thu, 2009-03-12 at 19:59 +0100, Dag Sverre Seljebotn wrote: (First off, is it OK to continue polling the NumPy list now and then on Cython language decisions? Or should I expect that any interested Cython users follow the Cython list?) In Python, if I write -1 % 5, I get 4. However, in

Re: [Numpy-discussion] Poll: Semantics for % in Cython

2010-05-04 Thread Chris Colbert
On Tue, May 4, 2010 at 12:20 PM, S. Chris Colbert sccolb...@gmail.comwrote: On Thu, 2009-03-12 at 19:59 +0100, Dag Sverre Seljebotn wrote: (First off, is it OK to continue polling the NumPy list now and then on Cython language decisions? Or should I expect that any interested Cython users

Re: [Numpy-discussion] Adding an ndarray.dot method

2010-05-04 Thread David Goldsmith
On Thu, Apr 29, 2010 at 12:30 PM, Pauli Virtanen p...@iki.fi wrote: Wed, 28 Apr 2010 14:12:07 -0400, Alan G Isaac wrote: [clip] Here is a related ticket that proposes a more explicit alternative: adding a ``dot`` method to ndarray. http://projects.scipy.org/numpy/ticket/1456 I kind of

[Numpy-discussion] Improvement of performance

2010-05-04 Thread gerardob
Hello, I have written a very simple code that computes the gradient by finite differences of any general function. Keeping the same idea, I would like modify the code using numpy to make it faster. Any ideas? Thanks. def grad_finite_dif(self,x,user_data = None):

Re: [Numpy-discussion] Improvement of performance

2010-05-04 Thread Davide Lasagna
If your x data are equispaced I would do something like this def derive( func, x): Approximate the first derivative of function func at points x. # compute the values of y = func(x) y = func(x) # compute the step dx = x[1] - x[0] # kernel array for second order accuracy centered

Re: [Numpy-discussion] Improvement of performance

2010-05-04 Thread Sebastian Walter
playing devil's advocate I'd say use Algorithmic Differentiation instead of finite differences ;) that would probably speed things up quite a lot. On Tue, May 4, 2010 at 11:36 PM, Davide Lasagna lasagnadav...@gmail.com wrote: If your x data are equispaced I would do something like this def

Re: [Numpy-discussion] Improvement of performance

2010-05-04 Thread Guilherme P. de Freitas
On Tue, May 4, 2010 at 2:57 PM, Sebastian Walter sebastian.wal...@gmail.com wrote: playing devil's advocate I'd say use Algorithmic Differentiation instead of finite differences ;) that would probably speed things up quite a lot. I would suggest that too, but aside from FuncDesigner[0]

Re: [Numpy-discussion] Improvement of performance

2010-05-04 Thread Guilherme P. de Freitas
I forgot to mention one thing: if you are doing optimization, a good solution is a modeling package like AMPL (or GAMS or AIMMS, but I only know AMPL, so I will restrict my attention to it). AMPL has a natural modeling language and provides you with automatic differentiation. It's not free, but

[Numpy-discussion] Question about numpy.ma masking

2010-05-04 Thread Gökhan Sever
Hello, I have the following arrays read as masked array. I[10]: basic.data['Air_Temp'].mask O[10]: array([ True, False, False, ..., False, False, False], dtype=bool) [12]: basic.data['Press_Alt'].mask O[12]: False I[13]: len basic.data['Air_Temp'] - len(basic.data['Air_Temp']) O[13]: 1758

Re: [Numpy-discussion] Improvement of performance

2010-05-04 Thread josef . pktd
On Tue, May 4, 2010 at 8:23 PM, Guilherme P. de Freitas guilhe...@gpfreitas.com wrote: On Tue, May 4, 2010 at 2:57 PM, Sebastian Walter sebastian.wal...@gmail.com wrote: playing devil's advocate I'd say use Algorithmic Differentiation instead of finite differences ;) that would probably speed