Re: [Numpy-discussion] std(axis=1) memory footprint issues + moving avg / stddev

2006-08-26 Thread Travis Oliphant
Torgil Svensson wrote: > Hi > > ndarray.std(axis=1) seems to have memory issues on large 2D-arrays. I > first thought I had a performance issue but discovered that std() used > lots of memory and therefore caused lots of swapping. > There are certainly lots of intermediate arrays created as the

Re: [Numpy-discussion] std(axis=1) memory footprint issues + moving avg / stddev

2006-08-26 Thread Rob Hooft
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Torgil Svensson wrote: > My original problem was to get an moving average and a moving standard > deviation (120k rows and N=1000). For average I guess convolve should > perform good, but is there anything smart for std()? For now I use ... > mo

Re: [Numpy-discussion] C Api newbie question

2006-08-26 Thread Travis Oliphant
Matt Knox wrote: > > Hi there. I'm in the unfortunate situation of trying to track down a > memory error in someone elses code, and to make matters worse I don't > really know jack squat about C programming. The problem seems to arise > when several numpy arrays are created from C arrays in the

Re: [Numpy-discussion] [ANN] NumPy 1.0b4 now available

2006-08-26 Thread Travis Oliphant
Les Schaffer wrote: > Travis E. Oliphant wrote: > >> Porting is not difficult especially using the compatibility layers >> numpy.oldnumeric and numpy.numarray and the alter_code1.py modules in >> those packages. The full C-API of Numeric is supported as is the C-API >> of Numarray. >> >>

Re: [Numpy-discussion] attributes of scalar types - e.g. numpy.int32.itemsize

2006-08-26 Thread Charles R Harris
Hi,On 8/18/06, Sebastian Haase <[EMAIL PROTECTED]> wrote: Thanks, that seems to be a handy "dictionary-like object"Just for the record - in the meantime I found this: >>> N.dtype(N.int32).itemsize4And on x86_64 linux python ints are 8 bytes.In [15]: asarray([1])[0].itemsize Out[15]: 8Interesting.

[Numpy-discussion] C Api newbie question

2006-08-26 Thread Matt Knox
Hi there. I'm in the unfortunate situation of trying to track down a memory error in someone elses code, and to make matters worse I don't really know jack squat about C programming. The problem seems to arise when several numpy arrays are created from C arrays in the C api and returned to python

Re: [Numpy-discussion] [ANN] NumPy 1.0b4 now available

2006-08-26 Thread Robert Kern
Alan G Isaac wrote: > Did Albert's initiative get any traction? > http://www.mail-archive.com/numpy-discussion@lists.sourceforge.net/msg01616.html > If so, Les might profit from coordinating with him. Not so much. Not many people showed up to the sprints, and most of those that did were working

Re: [Numpy-discussion] Optimizing mean(axis=0) on a 3D array

2006-08-26 Thread Francesc Altet
A Dissabte 26 Agost 2006 12:26, Travis Oliphant va escriure: > If frameis is 1-D, then you should be able to use > > temp = data.take(frameis,axis=0) > > for the first step. This can be quite a bit faster (and is a big > reason why take is still around). There are several reasons for this > (on

Re: [Numpy-discussion] Deleting a row from a matrix

2006-08-26 Thread Francesc Altet
A Dissabte 26 Agost 2006 13:42, Bill Baxter va escriure: > On 8/26/06, Francesc Altet <[EMAIL PROTECTED]> wrote: > > I'm personally an addict to encapsulate as much functionality as possible > > in > > methods (but perhaps I'm biased by an insane use of TAB in ipython > > console). > > You can stil

Re: [Numpy-discussion] [ANN] NumPy 1.0b4 now available

2006-08-26 Thread Alan G Isaac
> Les Schaffer wrote: >> i'll pitch in some >> time to add docstrings, if i know they will be used. On Sat, 26 Aug 2006, Robert Kern apparently wrote: > Of course they will. Did Albert's initiative get any traction? http://www.mail-archive.com/numpy-discussion@lists.sourceforge.net/msg0161

Re: [Numpy-discussion] [ANN] NumPy 1.0b4 now available

2006-08-26 Thread Robert Kern
Les Schaffer wrote: > i'll pitch in some > time to add docstrings, if i know they will be used. Of course they will. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an u

Re: [Numpy-discussion] [ANN] NumPy 1.0b4 now available

2006-08-26 Thread Les Schaffer
Alan G Isaac wrote: > Of course I bothered to write because I read this list and > appreciate in addition to its helpfulness that it generally > maintains a more polite tone. This too has value. > > > so, you want to work on improving the documentation of this poorly documented module? then

Re: [Numpy-discussion] [ANN] NumPy 1.0b4 now available

2006-08-26 Thread Alan G Isaac
On Sat, 26 Aug 2006, Les Schaffer apparently wrote: > save the moral speech I did not say anything about morals. I spoke only of *advantages* of politeness, which someone age 52 might still need to ponder. Of course I bothered to write because I read this list and appreciate in addition to its

Re: [Numpy-discussion] [ANN] NumPy 1.0b4 now available

2006-08-26 Thread Les Schaffer
Alan G Isaac wrote: > I am always mystified when someone requesting free help > adopts a pissy tone if they do not immediately > get what they wish. > > It reminds me a bit of my youngest child, age 7, > whom I am still teaching the advantages of politeness. > you are refering to robert kern i

Re: [Numpy-discussion] [ANN] NumPy 1.0b4 now available

2006-08-26 Thread Alan G Isaac
On Sat, 26 Aug 2006, Les Schaffer apparently wrote: > congratulations, this can be the first docstring in > records. now what about the incompatibility between old > and new I am always mystified when someone requesting free help adopts a pissy tone if they do not immediately get what they wi

Re: [Numpy-discussion] [ANN] NumPy 1.0b4 now available

2006-08-26 Thread Les Schaffer
Robert Kern wrote: > http://www.scipy.org/RecordArrays > which didn't help one iota. look, someone is charging for documentation, but the claim is the free docstrings have docs. for the records module, this ain't so. documentation means someone knows what is the complete public interface. yes,

Re: [Numpy-discussion] [ANN] NumPy 1.0b4 now available

2006-08-26 Thread Robert Kern
Les Schaffer wrote: > 3. near zero docstrings for this module, hard to see how the new > records works. http://www.scipy.org/RecordArrays -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it

Re: [Numpy-discussion] [ANN] NumPy 1.0b4 now available

2006-08-26 Thread Robert Kern
Les Schaffer wrote: > 4. last year i made a case for the old records to return a list of the > column names. it looks like the column names are now attributes of the > record object, any chance of getting a list of them > recarrayObj.get_colNames() or some such? yes, in working code, we know > wha

Re: [Numpy-discussion] [ANN] NumPy 1.0b4 now available

2006-08-26 Thread Les Schaffer
Travis E. Oliphant wrote: > Porting is not difficult especially using the compatibility layers > numpy.oldnumeric and numpy.numarray and the alter_code1.py modules in > those packages. The full C-API of Numeric is supported as is the C-API > of Numarray. > this is not true of numpy.core.rec

[Numpy-discussion] Deleting a row from a matrix

2006-08-26 Thread Nick Fotopoulos
On Aug 26, 2006, at 7:05 AM, Keith Goodman wrote: > On 8/26/06, Bill Baxter <[EMAIL PROTECTED]> wrote: >> On 8/26/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: >> >>> >>> I've come up with adding the functions (not methods at this point) >>> >>> deletefrom >>> insertinto >> >> >> "delete" and "ins

Re: [Numpy-discussion] Optimizing mean(axis=0) on a 3D array

2006-08-26 Thread Tim Hochberg
Martin Spacek wrote: > Hello, > > I'm a bit ignorant of optimization in numpy. > > I have a movie with 65535 32x32 frames stored in a 3D array of uint8 > with shape (65535, 32, 32). I load it from an open file f like this: > > >>> import numpy as np > >>> data = np.fromfile(f, np.uint8, count=65

Re: [Numpy-discussion] std(axis=1) memory footprint issues + moving avg / stddev

2006-08-26 Thread Charles R Harris
On 8/26/06, Torgil Svensson <[EMAIL PROTECTED]> wrote: Hindarray.std(axis=1) seems to have memory issues on large 2D-arrays. Ifirst thought I had a performance issue but discovered that std() usedlots of memory and therefore caused lots of swapping.I want to get an array where element i is the stad

[Numpy-discussion] std(axis=1) memory footprint issues + moving avg / stddev

2006-08-26 Thread Torgil Svensson
Hi ndarray.std(axis=1) seems to have memory issues on large 2D-arrays. I first thought I had a performance issue but discovered that std() used lots of memory and therefore caused lots of swapping. I want to get an array where element i is the stadard deviation of row i in the 2D array. Using val

Re: [Numpy-discussion] memory corruption bug

2006-08-26 Thread Charles R Harris
Hi,On 8/26/06, Albert Strasheim <[EMAIL PROTECTED]> wrote: A complete code snippet that reproduces the bug would be most helpful.+1. I too suspect that what you have here is a reference/copy problem. The only thing that is local to the class is the reference (pointer), the data is global. Chuck --

Re: [Numpy-discussion] Deleting a row from a matrix

2006-08-26 Thread Charles R Harris
Hi,On 8/26/06, Keith Goodman <[EMAIL PROTECTED]> wrote: On 8/26/06, Bill Baxter <[EMAIL PROTECTED]> wrote:> On 8/26/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: >> >> > I've come up with adding the functions (not methods at this point)> >> > deletefrom> > insertinto>>> "delete" and "insert" reall

Re: [Numpy-discussion] memory corruption bug

2006-08-26 Thread Charles R Harris
Hi,On 8/26/06, Bill Baxter <[EMAIL PROTECTED]> wrote: You're sure it's not just pass-by-reference semantics biting you?If you make an array and pass it to another class or function, by default they just get a reference to the same array.so e.g.:a = numpy.array ([1,2,3])some_class.set_array(a)a[1]

Re: [Numpy-discussion] round() bug

2006-08-26 Thread Charles R Harris
Hi,On 8/26/06, Sven Schreiber <[EMAIL PROTECTED]> wrote: Hi,is this normal behavior?:>>> import numpy as n; print n.mat(0.075).round(2); printn.mat(0.575).round(2)[[ 0.08]][[ 0.57]]  In [7]: (arange(100)*.5).round()Out[7]: array([  0.,   0.,   1.,   2.,   2.,   2.,   3.,   4.,   4.,   4.,   5.,

Re: [Numpy-discussion] memory corruption bug

2006-08-26 Thread Albert Strasheim
A complete code snippet that reproduces the bug would be most helpful. If there is a memory corruption problem, it might show up if we run the problematic code under Valgrind. Regards, Albert > -Original Message- > From: [EMAIL PROTECTED] [mailto:numpy- > [EMAIL PROTECTED] On Behalf Of

Re: [Numpy-discussion] memory corruption bug

2006-08-26 Thread Sven Schreiber
I appreciate your warnings, thanks. However, they don't seem to apply here, or why would my described workaround work at all in that case? Also, afaict, the affected variable is not even passed to the class where the problematic assignment happens. -sven Bill Baxter schrieb: > You're sure it's not

Re: [Numpy-discussion] Deleting a row from a matrix

2006-08-26 Thread Keith Goodman
On 8/26/06, Bill Baxter <[EMAIL PROTECTED]> wrote: > On 8/26/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > > > > > I've come up with adding the functions (not methods at this point) > > > > deletefrom > > insertinto > > > "delete" and "insert" really would be better. The current "insert" > fun

Re: [Numpy-discussion] memory corruption bug

2006-08-26 Thread Bill Baxter
You're sure it's not just pass-by-reference semantics biting you?If you make an array and pass it to another class or function, by default they just get a reference to the same array.so e.g.:a = numpy.array ([1,2,3])some_class.set_array(a)a[1] = 10Then both the local 'a' and the 'a' that some_class

Re: [Numpy-discussion] tensor dot ?

2006-08-26 Thread Nadav Horesh
I once wrote a function "tensormultiply" which is a part of numarray (undocumented). You can borrow it from there. Nadav -Original Message- From: [EMAIL PROTECTED] on behalf of Simon Burton Sent: Fri 25-Aug-06 14:42 To: numpy-discussion@lists.sourceforge.net Cc: Subject:

[Numpy-discussion] round() bug

2006-08-26 Thread Sven Schreiber
Hi, is this normal behavior?: >>> import numpy as n; print n.mat(0.075).round(2); print n.mat(0.575).round(2) [[ 0.08]] [[ 0.57]] Again, yesterday's svn on windows. cheers, Sven - Using Tomcat but need to do more? Need to

[Numpy-discussion] memory corruption bug

2006-08-26 Thread Sven Schreiber
Hi, I experienced this strange bug which caused a totally unrelated variable to be overwritten (no exception or error was raised, so it took me while to rule out any errors of my own). The context where this is in is a method of a class (Vecm.getSW()), and the instance of Vecm is created within a

Re: [Numpy-discussion] Deleting a row from a matrix

2006-08-26 Thread Bill Baxter
On 8/26/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: I've come up with adding the functions (not methods at this point)deletefrominsertinto"delete" and "insert" really would be better.   The current "insert" function seems inaptly named.  What it does sounds more like "overlay" or "set_masked". .

Re: [Numpy-discussion] Deleting a row from a matrix

2006-08-26 Thread Bill Baxter
On 8/26/06, Francesc Altet <[EMAIL PROTECTED]> wrote: I'm personally an addict to encapsulate as much functionality as possible inmethods (but perhaps I'm biased by an insane use of TAB in ipython console).You can still get tab completion for functions:  numpy. Even if it's your custom to "from num

Re: [Numpy-discussion] Optimizing mean(axis=0) on a 3D array

2006-08-26 Thread Travis Oliphant
Martin Spacek wrote: > Hello, > > I'm a bit ignorant of optimization in numpy. > > I have a movie with 65535 32x32 frames stored in a 3D array of uint8 > with shape (65535, 32, 32). I load it from an open file f like this: > > >>> import numpy as np > >>> data = np.fromfile(f, np.uint8, count=65

[Numpy-discussion] Optimizing mean(axis=0) on a 3D array

2006-08-26 Thread Martin Spacek
Hello, I'm a bit ignorant of optimization in numpy. I have a movie with 65535 32x32 frames stored in a 3D array of uint8 with shape (65535, 32, 32). I load it from an open file f like this: >>> import numpy as np >>> data = np.fromfile(f, np.uint8, count=65535*32*32) >>> data = data.reshape(

[Numpy-discussion] [ANN] NumPy 1.0b4 now available

2006-08-26 Thread Travis E. Oliphant
The 4th beta release of NumPy 1.0 has just been made available. NumPy 1.0 represents the culmination of over 18 months of work to unify the Numeric and Numarray array packages into a single best-of-breed array package for Python. NumPy supports all the features of Numeric and Numarray with a he

Re: [Numpy-discussion] [RFE] Suport for version 3 of array protocol in numarray

2006-08-26 Thread Travis Oliphant
Francesc Altet wrote: > Hi, > > I've lately ran into problems in numarray-->numpy conversions which are due > to > a lack of suport of the array procol version 3 on behalf of numarray. For > more info on this issue see: > > http://projects.scipy.org/scipy/numpy/ticket/256 > > and > > http://proj

[Numpy-discussion] [RFE] Suport for version 3 of array protocol in numarray

2006-08-26 Thread Francesc Altet
Hi, I've lately ran into problems in numarray-->numpy conversions which are due to a lack of suport of the array procol version 3 on behalf of numarray. For more info on this issue see: http://projects.scipy.org/scipy/numpy/ticket/256 and http://projects.scipy.org/scipy/numpy/ticket/266 Ques

Re: [Numpy-discussion] Deleting a row from a matrix

2006-08-26 Thread Francesc Altet
Hi, A Dissabte 26 Agost 2006 01:55, Robert Kern va escriure: > Travis Oliphant wrote: > > I've come up with adding the functions (not methods at this point) > > > > deletefrom > > insertinto > > > > appendto (syntatic sugar for concatenate but with a separate argument > > for the array and the ex