Re: [Numpy-discussion] new incremental statistics project

2009-01-22 Thread David Cournapeau
On Mon, Jan 19, 2009 at 7:34 PM, Hans Meine me...@informatik.uni-hamburg.de wrote: On Friday 19 December 2008 03:27:12 Bradford Cross wrote: This is a new project I just released. I know it is C#, but some of the design and idioms would be nice in numpy/scipy for working with discrete event

[Numpy-discussion] array manipulation

2009-01-22 Thread Nils Wagner
Hi all, what is the best way to check if the entries (integers) of an array are stored in ascending order ? Nils ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] array manipulation

2009-01-22 Thread Robert Cimrman
Nils Wagner wrote: Hi all, what is the best way to check if the entries (integers) of an array are stored in ascending order ? Hi Nils, Try np.alltrue( ar[1:] ar[:-1] ). r. ___ Numpy-discussion mailing list Numpy-discussion@scipy.org

Re: [Numpy-discussion] array manipulation

2009-01-22 Thread Nils Wagner
On Thu, 22 Jan 2009 11:23:43 +0100 Robert Cimrman cimrm...@ntc.zcu.cz wrote: Nils Wagner wrote: Hi all, what is the best way to check if the entries (integers) of an array are stored in ascending order ? Hi Nils, Try np.alltrue( ar[1:] ar[:-1] ). r. Thank you ! Nils

[Numpy-discussion] header option for savetxt

2009-01-22 Thread Nils Wagner
Hi all, Is it possible to add a header option for savetxt ? Nils ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

[Numpy-discussion] numpy.array and subok kwarg

2009-01-22 Thread Darren Dale
Hello, I have a test script: import numpy as np class MyArray(np.ndarray): __array_priority__ = 20 def __new__(cls): return np.asarray(1).view(cls).copy() def __repr__(self): return 'my_array' __str__ = __repr__ def __mul__(self, other): return

Re: [Numpy-discussion] numpy.array and subok kwarg

2009-01-22 Thread Pierre GM
Darren, The type returned by np.array is ndarray, unless I specifically set subok=True, in which case I get a MyArray. The default value of subok is True, so I dont understand why I have to specify subok unless I want it to be False. Is my subclass missing something important?

Re: [Numpy-discussion] default float type of array not accepted by SWIG wrapped C functions

2009-01-22 Thread Spotz, William F
Rich, Basic python only supports double precision floats, so that is not an option. NumPy does not have, as far as I know, a way to set the default precision, although it might be a reasonable request. As for the SWIG interface file, almost anything is possible. Can you give an example of a

Re: [Numpy-discussion] Failures in test_recfunctions.py

2009-01-22 Thread Pierre GM
Interesting. The tests pass on my machine OS X, Python version 2.5.4 (r254:67916, Dec 29 2008, 17:02:44) [GCC 4.0.1 (Apple Inc. build 5488)] nose version 0.10.4 For File /home/nwagner/local/lib64/python2.6/site-packages/numpy/lib/tests/ test_recfunctions.py, line 34, in test_zip_descr

Re: [Numpy-discussion] Failures in test_recfunctions.py

2009-01-22 Thread Nils Wagner
On Thu, 22 Jan 2009 12:53:39 -0500 Pierre GM pgmdevl...@gmail.com wrote: Interesting. The tests pass on my machine OS X, Python version 2.5.4 (r254:67916, Dec 29 2008, 17:02:44) [GCC 4.0.1 (Apple Inc. build 5488)] nose version 0.10.4 For File

Re: [Numpy-discussion] Failures in test_recfunctions.py

2009-01-22 Thread Pierre GM
On Jan 22, 2009, at 1:31 PM, Nils Wagner wrote: Hi Pierre, Thank you. Works for me. You're welcome, thanks for reporting! ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

[Numpy-discussion] have to use matlab: what is the equiv. to pdb.pm()

2009-01-22 Thread Sebastian Haase
Hi, I have to debug a matlab program -- is there a way to do a post mortem debugging ? (I don't even know if this term even exists outside of python ;-) ((I want to know some local variable values and find out why our program crashes when there are no particles found...)) Thanks, Sebastian Haase

Re: [Numpy-discussion] have to use matlab: what is the equiv. to pdb.pm()

2009-01-22 Thread Matthew Brett
Did you say matlab ? ;-) I have to debug a matlab program -- is there a way to do a post mortem debugging ? (I don't even know if this term even exists outside of python ;-) ((I want to know some local variable values and find out why our program crashes when there are no particles

Re: [Numpy-discussion] python numpy code many times slower than c++

2009-01-22 Thread Wes McKinney
import cProfile def f(): pass def g(): for i in xrange(100): f() cProfile.run(g()) test.py 103 function calls in 1.225 CPU seconds Ordered by: standard name ncalls tottime percall cumtime percall filename:lineno(function) 10.0000.000

Re: [Numpy-discussion] python numpy code many times slower than c++

2009-01-22 Thread Robert Kern
On Thu, Jan 22, 2009 at 17:00, Wes McKinney wesmck...@gmail.com wrote: import cProfile def f(): pass def g(): for i in xrange(100): f() cProfile.run(g()) test.py 103 function calls in 1.225 CPU seconds Ordered by: standard name ncalls tottime

Re: [Numpy-discussion] python numpy code many times slower than c++

2009-01-22 Thread Wes McKinney
Windows XP, Pentium D, Python 2.5.2 On Thu, Jan 22, 2009 at 6:03 PM, Robert Kern robert.k...@gmail.com wrote: On Thu, Jan 22, 2009 at 17:00, Wes McKinney wesmck...@gmail.com wrote: import cProfile def f(): pass def g(): for i in xrange(100): f()

[Numpy-discussion] range in numpy where

2009-01-22 Thread Ross Williamson
Hi All I want to get out the index of values in an array. Normally WHERE works fine for one conditional statement but it does not work for two - i.e. a = array([0,1,2,3,4,5,6,7,8,9]) ind, = where(a 5) Works fine but if I wanted: ind = where((a 5) and (a8)) Then it bugs out with the

Re: [Numpy-discussion] range in numpy where

2009-01-22 Thread Eric Firing
Ross Williamson wrote: Hi All I want to get out the index of values in an array. Normally WHERE works fine for one conditional statement but it does not work for two - i.e. a = array([0,1,2,3,4,5,6,7,8,9]) ind, = where(a 5) Works fine but if I wanted: ind = where((a 5) and

[Numpy-discussion] N-D array interface page is out of date

2009-01-22 Thread Andrew Straw
Hi, I just noticed that the N-D array interface page is outdated and doesn't mention the buffer interface that is standard with Python 2.6 and Python 3.0: http://numpy.scipy.org/array_interface.shtml This page is linked to from http://numpy.scipy.org/ I suggest, at the minimum, modifying the

Re: [Numpy-discussion] numpy.array and subok kwarg

2009-01-22 Thread Scott Sinclair
2009/1/22 Pierre GM pgmdevl...@gmail.com: Darren, The type returned by np.array is ndarray, unless I specifically set subok=True, in which case I get a MyArray. The default value of subok is True, so I dont understand why I have to specify subok unless I want it to be False. Is my subclass

[Numpy-discussion] Numpy unexpected (for me) behaviour

2009-01-22 Thread V. Armando Sole
Hello, In an effort to suppress for loops, I have arrived to the following situation. Through vectorial logical operations I generate a set of indices for which the contents of an array have to be incremented. My problem can be reduced to the following: #This works import numpy

Re: [Numpy-discussion] Numpy unexpected (for me) behaviour

2009-01-22 Thread Matthew Brett
Hi, #This does not work import numpy a=numpy.zeros(10) b=numpy.ones(4, numpy.int) a[b] += 1 The problem here is that you are setting a[1] to a[1]+1. I think you want: import numpy a=numpy.zeros(10) b=numpy.ones(4, numpy.bool) a[b] += 1 Best, Matthew

Re: [Numpy-discussion] Numpy unexpected (for me) behaviour

2009-01-22 Thread Robert Kern
On Fri, Jan 23, 2009 at 01:39, Matthew Brett matthew.br...@gmail.com wrote: Hi, #This does not work import numpy a=numpy.zeros(10) b=numpy.ones(4, numpy.int) a[b] += 1 The problem here is that you are setting a[1] to a[1]+1. I think you want: import numpy a=numpy.zeros(10)

Re: [Numpy-discussion] Numpy unexpected (for me) behaviour

2009-01-22 Thread Robert Kern
On Fri, Jan 23, 2009 at 01:11, V. Armando Sole s...@esrf.fr wrote: Hello, In an effort to suppress for loops, I have arrived to the following situation. Through vectorial logical operations I generate a set of indices for which the contents of an array have to be incremented. My problem can

Re: [Numpy-discussion] Numpy unexpected (for me) behaviour

2009-01-22 Thread Matthew Brett
Judging from his for loop, he does want the integer array. He's doing something like histogramming. Yup, thanks, just goes to show that it's not good to send emails after a glass of wine late at night with slight jetlag. Matthew ___ Numpy-discussion