Re: [Numpy-discussion] Want cumsum-like function

2010-02-24 Thread Friedrich Romstedt
2010/2/25 Peter Shinners : > I want a function that works like cumsum, but starts at zero, instead of > starting with the first actual value. > > [...] > > tallies = np.cumsum(initial_array) > np.subtract(tallies, tallies[0], tallies) Also note that this wouln't work as the example result [0, 3, 6

Re: [Numpy-discussion] For-less code

2010-02-24 Thread Skipper Seabold
On Thu, Feb 25, 2010 at 12:52 AM, Gökhan Sever wrote: > Hello, > > I am working on a code shown at > http://code.google.com/p/ccnworks/source/browse/trunk/thesis/part1/logn-fit.py > > I use the code to analyse a couple dataset also placed in the same > directory. In the first part I use for-loops

[Numpy-discussion] For-less code

2010-02-24 Thread Gökhan Sever
Hello, I am working on a code shown at http://code.google.com/p/ccnworks/source/browse/trunk/thesis/part1/logn-fit.py I use the code to analyse a couple dataset also placed in the same directory. In the first part I use for-loops all over, but later decided to write them without using for loops.

Re: [Numpy-discussion] How to test f2py?

2010-02-24 Thread Charles R Harris
On Wed, Feb 24, 2010 at 1:15 AM, David Cournapeau wrote: > On Wed, Feb 24, 2010 at 1:51 PM, Charles R Harris > wrote: > > > > > Boy, that code is *old*, it still uses Numeric ;) I don't think it can > > really be considered a test suite, it needs lotsa love and it needs to > get > > installed. An

Re: [Numpy-discussion] Want cumsum-like function

2010-02-24 Thread Robert Kern
On Wed, Feb 24, 2010 at 23:03, Peter Shinners wrote: > On 02/24/2010 09:00 PM, Robert Kern wrote: >> On Wed, Feb 24, 2010 at 22:53, Peter Shinners  wrote: >> >>> I want a function that works like cumsum, but starts at zero, instead of >>> starting with the first actual value. >>> >>> For example;

Re: [Numpy-discussion] Want cumsum-like function

2010-02-24 Thread Peter Shinners
On 02/24/2010 09:00 PM, Robert Kern wrote: > On Wed, Feb 24, 2010 at 22:53, Peter Shinners wrote: > >> I want a function that works like cumsum, but starts at zero, instead of >> starting with the first actual value. >> >> For example; I have an array with [4,3,3,1]. >> Cumsum will give me an

Re: [Numpy-discussion] Want cumsum-like function

2010-02-24 Thread Robert Kern
On Wed, Feb 24, 2010 at 22:53, Peter Shinners wrote: > I want a function that works like cumsum, but starts at zero, instead of > starting with the first actual value. > > For example; I have an array with [4,3,3,1]. > Cumsum will give me an array with [4,7,10,11]. > I want an array that is like [

[Numpy-discussion] Want cumsum-like function

2010-02-24 Thread Peter Shinners
I want a function that works like cumsum, but starts at zero, instead of starting with the first actual value. For example; I have an array with [4,3,3,1]. Cumsum will give me an array with [4,7,10,11]. I want an array that is like [0,4,7,8]. It looks like I could indirectly do this: tallies =

Re: [Numpy-discussion] RHEL 5.3+ build?

2010-02-24 Thread David Carmean
On Wed, Feb 24, 2010 at 06:37:08AM -0800, David Carmean wrote: > On Wed, Feb 24, 2010 at 08:59:05AM -0500, Michael Droettboom wrote: > > > > We (STScI) routinely build Numpy on RHEL5.x 64-bit systems for our internal > > use. We need more detail about what you're doing and what errors you're >

[Numpy-discussion] What are the 'p', 'P' types?

2010-02-24 Thread Charles R Harris
They are now typecodes but have no entries in the typename dictionary. The 'm', 'M' types also lack dictionary entries. Chuck ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Numpy array performance issue

2010-02-24 Thread Robert Kern
On Wed, Feb 24, 2010 at 12:38, Bruno Santos wrote: > This is probably me just being stupid. But what is the reason for this peace > of code not to be working: > index_nSize=numpy.arange(0,length,nSize) > lsPhasedValues = set([aLoci[i] for i in xrange(length) if (i%nSize==0 and > aLoci[i]>0)]) > ls

Re: [Numpy-discussion] Numpy array performance issue

2010-02-24 Thread Bruno Santos
This is probably me just being stupid. But what is the reason for this peace of code not to be working: index_nSize=numpy.arange(0,length,nSize) lsPhasedValues = set([aLoci[i] for i in xrange(length) if (i%nSize==0 and aLoci[i]>0)]) lsPhasedValues1 = numpy.where(aLoci[index_nSize]>0) print aLoci[in

Re: [Numpy-discussion] Numpy array performance issue

2010-02-24 Thread Bruno Santos
2010/2/24 Chris Colbert > In [4]: %timeit a = np.random.randint(0, 20, 100) > 10 loops, best of 3: 4.32 us per loop > > In [5]: %timeit (a>=10).sum() > 10 loops, best of 3: 7.32 us per loop > > In [8]: %timeit np.where(a>=10) > 10 loops, best of 3: 5.36 us per loop > > > am i missing

Re: [Numpy-discussion] Numpy array performance issue

2010-02-24 Thread Robert Kern
On Wed, Feb 24, 2010 at 11:50, Bruno Santos wrote: > In both versions your lsPhasedValues contains the number of positions in the > array that match a certain criteria. What I need in that step is the unique > values and not their positions. Oops! lsPhasedValues = np.unique1d(aLoci[j_nSize_mask

Re: [Numpy-discussion] Numpy array performance issue

2010-02-24 Thread Chris Colbert
In [4]: %timeit a = np.random.randint(0, 20, 100) 10 loops, best of 3: 4.32 us per loop In [5]: %timeit (a>=10).sum() 10 loops, best of 3: 7.32 us per loop In [8]: %timeit np.where(a>=10) 10 loops, best of 3: 5.36 us per loop am i missing something? On Wed, Feb 24, 2010 at 12:50 PM

Re: [Numpy-discussion] Numpy array performance issue

2010-02-24 Thread Bruno Santos
In both versions your lsPhasedValues contains the number of positions in the array that match a certain criteria. What I need in that step is the unique values and not their positions. 2010/2/24 Robert Kern > On Wed, Feb 24, 2010 at 11:19, Bruno Santos wrote: > > It seems that the python 2.6.4

Re: [Numpy-discussion] distutils problem with NumPy-1.4 & Py-2.7a3 (Snow Leopard)

2010-02-24 Thread Bruce Southey
On Wed, Feb 24, 2010 at 11:21 AM, Bruce Southey wrote: > On 02/23/2010 04:47 PM, Robert Kern wrote: >> >> On Tue, Feb 23, 2010 at 13:18, Tom Loredo >>  wrote: >> >>> >>> Hi- >>> >>> I've been testing Python-2.7a3 on Mac OS 10.6.2.  NumPy-1.4.0 will >>> not install; it appears something has changed

Re: [Numpy-discussion] Numpy array performance issue

2010-02-24 Thread Robert Kern
On Wed, Feb 24, 2010 at 11:19, Bruno Santos wrote: > It seems that the python 2.6.4 has a more efficient implementation of the > lists. It runs faster on this version and slower on 2.5.4 on the same > machine with debian. A lot faster in fact. > I was trying to change my headche for the last coupl

Re: [Numpy-discussion] distutils problem with NumPy-1.4 & Py-2.7a3 (Snow Leopard)

2010-02-24 Thread Bruce Southey
On 02/23/2010 04:47 PM, Robert Kern wrote: > On Tue, Feb 23, 2010 at 13:18, Tom Loredo wrote: > >> Hi- >> >> I've been testing Python-2.7a3 on Mac OS 10.6.2. NumPy-1.4.0 will >> not install; it appears something has changed within distutils that >> breaks it: >> File >> "/Volumes/System/Us

Re: [Numpy-discussion] Numpy array performance issue

2010-02-24 Thread Bruno Santos
It seems that the python 2.6.4 has a more efficient implementation of the lists. It runs faster on this version and slower on 2.5.4 on the same machine with debian. A lot faster in fact. I was trying to change my headche for the last couple of weeks. But you migth give me a lot more optimizations

Re: [Numpy-discussion] Numpy array performance issue

2010-02-24 Thread Robert Kern
On Wed, Feb 24, 2010 at 10:40, Bruno Santos wrote: > Funny. Which version of python are you using? Python 2.5.4 on OS X. -- 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

Re: [Numpy-discussion] Numpy array performance issue

2010-02-24 Thread Bruno Santos
Funny. Which version of python are you using? My python is still better for small lists. But you are rigth it gets better with size, here how the same code performs on mine computer: In [1]: N = 100 In [2]: import numpy as np In [3]: A = np.random.randint(0, 21, N) ...: In [4]: L = A.tolist

Re: [Numpy-discussion] Numpy array performance issue

2010-02-24 Thread Robert Kern
On Wed, Feb 24, 2010 at 10:21, Bruno Santos wrote: >> The idiomatic way of doing this for numpy arrays would be: >> >> def test2(arrx): >>    return (arrx >= 10).sum() >> >  Even this versions takes more time to run than my original python version > with arrays. Works fine for me, and gets bette

Re: [Numpy-discussion] Numpy array performance issue

2010-02-24 Thread Bruno Santos
> > > > The idiomatic way of doing this for numpy arrays would be: > > def test2(arrx): >return (arrx >= 10).sum() > > Even this versions takes more time to run than my original python version > with arrays. >>> def test3(listx): ... return (listx>=10).sum() >>> t = timeit.Timer("test3(l

Re: [Numpy-discussion] Numpy array performance issue

2010-02-24 Thread Robert Kern
On Wed, Feb 24, 2010 at 09:55, Bruno Santos wrote: > Hello everyone, > I am using numpy arrays whenever I demand performance from my > algorithms. Nevertheless, I am having a performance issue at the moment > mainly because I am iterating several times over numpy arrays. Fot that > reason I decide

[Numpy-discussion] Numpy array performance issue

2010-02-24 Thread Bruno Santos
Hello everyone, I am using numpy arrays whenever I demand performance from my algorithms. Nevertheless, I am having a performance issue at the moment mainly because I am iterating several times over numpy arrays. Fot that reason I decided to use timeit to see the performance of different versions

Re: [Numpy-discussion] RHEL 5.3+ build?

2010-02-24 Thread David Carmean
On Wed, Feb 24, 2010 at 08:59:05AM -0500, Michael Droettboom wrote: > We (STScI) routinely build Numpy on RHEL5.x 64-bit systems for our internal > use. We need more detail about what you're doing and what errors you're > seeing to diagnose the problem. OK, that's encouraging; it may take a f

Re: [Numpy-discussion] Building Windows binaries on OS X

2010-02-24 Thread Patrick Marsh
On Wed, Feb 24, 2010 at 5:19 AM, David Cournapeau wrote: > Ralf Gommers wrote: > > On Wed, Feb 24, 2010 at 3:42 PM, David Cournapeau > > wrote: > > > > > > So here is how I see things in the near future for release: > > - compile a simple binary installer for ma

Re: [Numpy-discussion] Building Windows binaries on OS X

2010-02-24 Thread Patrick Marsh
This sounds good to me. I also like the idea of doing this in parallel so we both have a complete set of binaries - at least on the Windows side. I'm still having issues with my MBP, but hope to have those resolved later today. Patrick On Wed, Feb 24, 2010 at 4:45 AM, Ralf Gommers wrote: >

Re: [Numpy-discussion] RHEL 5.3+ build?

2010-02-24 Thread Michael Droettboom
David Carmean wrote: > Does anyone use/build this stuff on RHEL 5.3+ (x64)? :) Seems not so much. > > I'd like to use numpy (and PyTables) for a few tasks where it would be much > more efficient to have much of the processing performed on the servers > generating > the data (about 400 systems)

Re: [Numpy-discussion] Building Windows binaries on OS X

2010-02-24 Thread David Cournapeau
Ralf Gommers wrote: > On Wed, Feb 24, 2010 at 3:42 PM, David Cournapeau > wrote: > > > So here is how I see things in the near future for release: > - compile a simple binary installer for mac os x and windows (no need > for doc or multiple archs) from 1.4.

Re: [Numpy-discussion] Building Windows binaries on OS X

2010-02-24 Thread Ralf Gommers
On Wed, Feb 24, 2010 at 3:42 PM, David Cournapeau wrote: > > So here is how I see things in the near future for release: > - compile a simple binary installer for mac os x and windows (no need > for doc or multiple archs) from 1.4.x > - test this with the scipy binary out there (running the full t

Re: [Numpy-discussion] How to test f2py?

2010-02-24 Thread Pauli Virtanen
ke, 2010-02-24 kello 18:04 +0900, David Cournapeau kirjoitti: [clip] > P.S: is it expected that numpy cannot be built in-place correctly under > py3k? Yes, unfortunately. 2to3 cannot really be run in-place, and I did not want to engage distutils in a fight how to read the sources from a different

Re: [Numpy-discussion] How to test f2py?

2010-02-24 Thread David Cournapeau
Pauli Virtanen wrote: > The best alternative, imho, is not to use "dict" as a variable name at > all. We should make that change manually in SVN sources, both for Py2 > and Py3. Agreed - the changes should be put in the sources. Will do so tonight after work unless someone beats me to it. > Gre

Re: [Numpy-discussion] How to test f2py?

2010-02-24 Thread Pauli Virtanen
ke, 2010-02-24 kello 17:33 +0900, David Cournapeau kirjoitti: > On Wed, Feb 24, 2010 at 5:19 PM, Pauli Virtanen wrote: > > I don't think the situation is that bad with f2py. I suppose it will > > be enough to erect unicode vs. Bytes barrier where the file i/o is > > done, and let f2py work intern

Re: [Numpy-discussion] How to test f2py?

2010-02-24 Thread David Cournapeau
On Wed, Feb 24, 2010 at 5:19 PM, Pauli Virtanen wrote: > I don't think the situation is that bad with f2py. I suppose it will be > enough to erect unicode vs. Bytes barrier where the file i/o is done, and let > f2py work internally with unicode. Doesn't sound so bad, but I'd have to take > a cl

Re: [Numpy-discussion] How to test f2py?

2010-02-24 Thread Pauli Virtanen
I don't think the situation is that bad with f2py. I suppose it will be enough to erect unicode vs. Bytes barrier where the file i/o is done, and let f2py work internally with unicode. Doesn't sound so bad, but I'd have to take a closer look. -- Pauli Virtanen - Alkuperäinen viesti - >

Re: [Numpy-discussion] How to test f2py?

2010-02-24 Thread David Cournapeau
On Wed, Feb 24, 2010 at 1:51 PM, Charles R Harris wrote: > > Boy, that code is *old*, it still uses Numeric ;) I don't think it can > really be considered a test suite, it needs lotsa love and it needs to get > installed. Anyway, f2py with py3k turns out to have string problems, and I > expect ot