Re: [Numpy-discussion] update on the transition to git/github

2010-08-04 Thread Ondrej Certik
On Tue, Jul 13, 2010 at 7:50 PM, Joshua Holbrook wrote: > This is awesome! I love github. I really wanted to champion for its > use at the BoF but unfortunately missed it. Indeed, that's awesome. I should say finally! :) Ondrej ___ NumPy-Discussion mai

Re: [Numpy-discussion] Quick array value assignment based on common values

2010-08-04 Thread PHobson
I've deleted the code b/c it was absurdly slow. It was pretty brute-force. -Looped through each row (r) of y -check to see where y[r,0] - x[:,0] < eps (call that row r_hit) -set y[r,1] = x[r_hit,1] There was kind of a short fuse on this, and I was already reading the data from a text file. So I j

Re: [Numpy-discussion] Quick array value assignment based on common values

2010-08-04 Thread John Salvatier
Perhaps try the following: 1) sort x by x[:,0] 2) sort y by y[:,0] 3) loop through both at the same time building an array of indexes A that tells you the index of y[i,0] in x or just building a new array z with the value if you don't need them in order 4) if you do need them in order, unsort A by

Re: [Numpy-discussion] Quick array value assignment based on common values

2010-08-04 Thread John Salvatier
How exactly are you looping? That sounds absurdly slow. What you need is a fast dictionary. On Wed, Aug 4, 2010 at 6:00 PM, Gökhan Sever wrote: > > > On Wed, Aug 4, 2010 at 6:59 PM, wrote: > >> Hey folks, >> >> I've one array, x, that you could define as follows: >> [[1, 2.25], >> [2, 2.50],

Re: [Numpy-discussion] Quick array value assignment based on common values

2010-08-04 Thread Gökhan Sever
On Wed, Aug 4, 2010 at 8:00 PM, Gökhan Sever wrote: > > > On Wed, Aug 4, 2010 at 6:59 PM, wrote: > >> Hey folks, >> >> I've one array, x, that you could define as follows: >> [[1, 2.25], >> [2, 2.50], >> [3, 2.25], >> [4, 0.00], >> [8, 0.00], >> [9, 2.75]] >> >> Then my second array, y, is:

Re: [Numpy-discussion] Quick array value assignment based on common values

2010-08-04 Thread Gökhan Sever
On Wed, Aug 4, 2010 at 6:59 PM, wrote: > Hey folks, > > I've one array, x, that you could define as follows: > [[1, 2.25], > [2, 2.50], > [3, 2.25], > [4, 0.00], > [8, 0.00], > [9, 2.75]] > > Then my second array, y, is: > [[1, 0.00], > [2, 0.00], > [3, 0.00], > [4, 0.00], > [5, 0.00], >

Re: [Numpy-discussion] Quick array value assignment based on common values

2010-08-04 Thread PHobson
John, Thanks for the quick reply. Unfortunately, no, they're not indexed like that. The first columns are actually floating-point date numbers from matplotlib.dates.date2num. Looks like this is just going to be painful... Thanks for the tip though. That'll definitely be useful elsewhere. -paul

Re: [Numpy-discussion] Quick array value assignment based on common values

2010-08-04 Thread Sturla Molden
> Is there a concise, Numpythonic way to copy the values of x[:,1] over to > y[:,1] where x[:,0] = y[:,0]? Resulting in, z: First use mask = (x[:,0] == y[:,0]) # integers or mask = np.abs(x[:,0] - y[:,0]) < eps # floats and then y[mask,1] = x[mask,1] Sturla __

Re: [Numpy-discussion] Quick array value assignment based on common values

2010-08-04 Thread John Salvatier
Are they numbered like that? If so you can index into the first array by the second one. x[y[:,0], 1] if you can't get them into an indexable format, I think it's going to be slow no matter how you do it. On Wed, Aug 4, 2010 at 4:59 PM, wrote: > Hey folks, > > I've one array, x, that you could d

[Numpy-discussion] Quick array value assignment based on common values

2010-08-04 Thread PHobson
Hey folks, I've one array, x, that you could define as follows: [[1, 2.25], [2, 2.50], [3, 2.25], [4, 0.00], [8, 0.00], [9, 2.75]] Then my second array, y, is: [[1, 0.00], [2, 0.00], [3, 0.00], [4, 0.00], [5, 0.00], [6, 0.00], [7, 0.00], [8, 0.00], [9, 0.00], [10,0.00]] Is there a

Re: [Numpy-discussion] distutils issue - python 3.1 on windows

2010-08-04 Thread Pauli Virtanen
Wed, 04 Aug 2010 23:34:15 +0800, Ralf Gommers wrote: [clip] > I haven't started using py3k yet so I'm still a bit fuzzy about bytes > vs string. But it's easy to try in the interpreter: > import re RE_VERSION = re.compile('(\d+\.\d+(\.\d+)*)') In the Python 3.1 version I have, this lin

Re: [Numpy-discussion] ndarray.resize that preserve view content ?

2010-08-04 Thread Zachary Pincus
Oh and PS. Robert's right that there's no general way to do this! What I have only works because the data existing in the first 25 elements of A that get clobbered by the copy operation aren't the same data that are being copied (or where they are, the new copy is identical to the old one).

Re: [Numpy-discussion] ndarray.resize that preserve view content ?

2010-08-04 Thread Zachary Pincus
> Yes it is, but is there a way to do it in-place? So you want the first 25 elements of the array (in a flat "contiguous" view) to contain the 25 elements of A[:5,:5]? This will do that, but having to do stuff like this (rather than just copying the memory region) might be indicative that ma

Re: [Numpy-discussion] ndarray.resize that preserve view content ?

2010-08-04 Thread Robert Kern
On Wed, Aug 4, 2010 at 10:31, Antoine Dechaume wrote: > Yes it is, but is there a way to do it in-place? No. -- 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 underlying t

Re: [Numpy-discussion] ANN: NumPy 1.5.0 beta 1

2010-08-04 Thread Ralf Gommers
On Wed, Aug 4, 2010 at 7:03 AM, sam tygier wrote: > On 01/08/10 17:38, Ralf Gommers wrote: > > I am pleased to announce the availability of the first beta of NumPy > > 1.5.0. This will be the first NumPy release to include support for > > Python 3, as well as for Python 2.7. Please try this beta

Re: [Numpy-discussion] distutils issue - python 3.1 on windows

2010-08-04 Thread Ralf Gommers
On Wed, Aug 4, 2010 at 6:25 AM, Pauli Virtanen wrote: > Mon, 02 Aug 2010 23:48:52 +0800, Ralf Gommers wrote: > > I'm trying to get building to work with Python 3.1 under Wine on OS X. > > The first thing you run into is a python distutils problem, which is > > fixed by replacing line 379 of cygw

Re: [Numpy-discussion] ndarray.resize that preserve view content ?

2010-08-04 Thread Antoine Dechaume
Yes it is, but is there a way to do it in-place? On Wed, Aug 4, 2010 at 5:20 PM, Zachary Pincus wrote: > > A[:5,:5] shows the data I want, but it's not contiguous in memory. > > A.resize(5,5) is contiguous, but do not contains the data I want. > > > > How to get both efficiently? > > A[:5,:5].cop

Re: [Numpy-discussion] ndarray.resize that preserve view content ?

2010-08-04 Thread Zachary Pincus
> A[:5,:5] shows the data I want, but it's not contiguous in memory. > A.resize(5,5) is contiguous, but do not contains the data I want. > > How to get both efficiently? A[:5,:5].copy() will give you a new, contiguous array that has the same contents as A[5:,5:], but in a new chunk of memory. Is

Re: [Numpy-discussion] ndarray.resize that preserve view content ?

2010-08-04 Thread Antoine Dechaume
I forgot to refer to resize, sorry about that. A[:5,:5] shows the data I want, but it's not contiguous in memory. A.resize(5,5) is contiguous, but do not contains the data I want. How to get both efficiently? On Wed, Aug 4, 2010 at 5:01 PM, Robert Kern wrote: > On Wed, Aug 4, 2010 at 09:29, A

Re: [Numpy-discussion] ndarray.resize that preserve view content ?

2010-08-04 Thread Robert Kern
On Wed, Aug 4, 2010 at 09:29, Antoine Dechaume wrote: > Hi, > > given A=empty([10,10]), I would like to keep A[:5,:5] as a contiguous memory > segment. > > How to do it efficiently? I'm not sure I understand what you want. Your Subject line and the body of your email conflict with each other. Can

[Numpy-discussion] ndarray.resize that preserve view content ?

2010-08-04 Thread Antoine Dechaume
Hi, given A=empty([10,10]), I would like to keep A[:5,:5] as a contiguous memory segment. How to do it efficiently? Thanks. ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Python 3.2 crashes numpy with undefined symbol PyCObject_AsVoidPtr

2010-08-04 Thread Bruce Southey
On Tue, Aug 3, 2010 at 4:10 PM, Bruce Southey wrote: >  Hi, > Since I was testing the 1.5 beta, I also tested the alpha release of Python > 3.2 on Linux 64-bit (gcc version 4.4.4 20100630 (Red Hat 4.4.4-10) (GCC)). > While my other Python versions passed the tests (once I copied the necessary > to