[Numpy-discussion] Name of the file associated with a memmap

2010-04-12 Thread Nadav Horesh
Is there a way to get the file-name given a memmap array object? Nadav ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] rc2 for NumPy 1.4.1 and Scipy 0.7.2

2010-04-12 Thread Nadav Horesh
Tried of install numy-1.4.1-rc2 on python-2.7b1 and got an error: (64 bit linux on core2, gcc4.4.3) compile options: '-Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/include -I/usr/local/include/py

Re: [Numpy-discussion] rc2 for NumPy 1.4.1 and Scipy 0.7.2

2010-04-12 Thread David
On 04/12/2010 06:03 PM, Nadav Horesh wrote: > > Tried of install numy-1.4.1-rc2 on python-2.7b1 and got an error: > > (64 bit linux on core2, gcc4.4.3) > > > compile options: '-Inumpy/core/src/private -Inumpy/core/src -Inumpy/core > -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core

Re: [Numpy-discussion] rc2 for NumPy 1.4.1 and Scipy 0.7.2

2010-04-12 Thread Bruce Southey
On 04/12/2010 04:25 AM, David wrote: > On 04/12/2010 06:03 PM, Nadav Horesh wrote: > >> Tried of install numy-1.4.1-rc2 on python-2.7b1 and got an error: >> >> (64 bit linux on core2, gcc4.4.3) >> >> >> compile options: '-Inumpy/core/src/private -Inumpy/core/src -Inumpy/core >> -Inumpy/core/sr

[Numpy-discussion] Sum over array elements

2010-04-12 Thread Nicola Creati
Hello, I want to calculate, given a one dimension array, the sum over every two elements of the array. I found this working solution: a = N.arange(10) b = a.reshape(a, (5, 2)) c = b.sum(axis=1) Is there any better solution? Thanks, Nicola Creati ___

Re: [Numpy-discussion] Sum over array elements

2010-04-12 Thread Gökhan Sever
On Mon, Apr 12, 2010 at 9:21 AM, Nicola Creati wrote: > Hello, > I want to calculate, given a one dimension array, the sum over every two > elements of the array. > I found this working solution: > > a = N.arange(10) > b = a.reshape(a, (5, 2)) > c = b.sum(axis=1) > > Is there any better solution?

Re: [Numpy-discussion] Sum over array elements

2010-04-12 Thread Patrick Marsh
a = np.arange(10) b = (a[::2]).sum() Patrick On Mon, Apr 12, 2010 at 9:21 AM, Nicola Creati wrote: > Hello, > I want to calculate, given a one dimension array, the sum over every two > elements of the array. > I found this working solution: > > a = N.arange(10) > b = a.reshape(a, (5, 2)) >

Re: [Numpy-discussion] rc2 for NumPy 1.4.1 and Scipy 0.7.2

2010-04-12 Thread Ralf Gommers
On Mon, Apr 12, 2010 at 9:53 PM, Bruce Southey wrote: > > Hi, > I think this is due to the error: 'NameError: global name > 'DistutilsExecError' is not defined' > from: > File > "/home/bsouthey/python/numpy-1.4.1rc2/numpy/distutils/ccompiler.py", > line 64, in CCompiler_spawn > raise Distut

Re: [Numpy-discussion] rc2 for NumPy 1.4.1 and Scipy 0.7.2

2010-04-12 Thread Bruce Southey
On 04/12/2010 09:47 AM, Ralf Gommers wrote: On Mon, Apr 12, 2010 at 9:53 PM, Bruce Southey > wrote: Hi, I think this is due to the error: 'NameError: global name 'DistutilsExecError' is not defined' from: File "/home/bsouthey/python/numpy-

[Numpy-discussion] sparse.hstack with empty sparse matrices

2010-04-12 Thread David Koch
Hello, For scipy.sparse.csc_matrices, is there an equivalent for the following dense array operation? Example: tempA = scipy.empty((10,0)) tempB = scipy.random.random((10,1)) scipy.hstack((tempA, tempB)) i.e - you concatenate an empty n x 0 sparse matrix with a n x 1 sparse matrix to yield a n

[Numpy-discussion] Best dtype for Boolean values

2010-04-12 Thread John Jack
Hello all. I am (relatively) new to python, and 100% new to numpy. I need a way to store arrays of booleans and compare the arrays for equality. I assume I want arrays of dtype Boolean, and I should compare the arrays with array_equal >>> tmp.all_states array([False, True, False], dtype=bool)

Re: [Numpy-discussion] Name of the file associated with a memmap

2010-04-12 Thread Robert Kern
On Mon, Apr 12, 2010 at 04:03, Nadav Horesh wrote: > > Is there a way to get the file-name given a memmap array object? Not at this time. This would be very useful, though, so patches are welcome. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that

Re: [Numpy-discussion] Best dtype for Boolean values

2010-04-12 Thread Robert Kern
On Mon, Apr 12, 2010 at 10:59, John Jack wrote: > Hello all. > I am (relatively) new to python, and 100% new to numpy. > I need a way to store arrays of booleans and compare the arrays for > equality. > I assume I want arrays of dtype Boolean, and I should compare the arrays > with array_equal >>>

Re: [Numpy-discussion] Name of the file associated with a memmap

2010-04-12 Thread Brent Pedersen
On Mon, Apr 12, 2010 at 9:49 AM, Robert Kern wrote: > On Mon, Apr 12, 2010 at 04:03, Nadav Horesh wrote: >> >> Is there a way to get the file-name given a memmap array object? > > Not at this time. This would be very useful, though, so patches are welcome. > > -- > Robert Kern > > "I have come to

Re: [Numpy-discussion] Name of the file associated with a memmap

2010-04-12 Thread Charles R Harris
On Mon, Apr 12, 2010 at 1:55 PM, Brent Pedersen wrote: > On Mon, Apr 12, 2010 at 9:49 AM, Robert Kern > wrote: > > On Mon, Apr 12, 2010 at 04:03, Nadav Horesh > wrote: > >> > >> Is there a way to get the file-name given a memmap array object? > > > > Not at this time. This would be very useful,

Re: [Numpy-discussion] Name of the file associated with a memmap

2010-04-12 Thread Charles R Harris
On Mon, Apr 12, 2010 at 2:37 PM, Charles R Harris wrote: > > > On Mon, Apr 12, 2010 at 1:55 PM, Brent Pedersen wrote: > >> On Mon, Apr 12, 2010 at 9:49 AM, Robert Kern >> wrote: >> > On Mon, Apr 12, 2010 at 04:03, Nadav Horesh >> wrote: >> >> >> >> Is there a way to get the file-name given a me

Re: [Numpy-discussion] Best dtype for Boolean values

2010-04-12 Thread Anne Archibald
On 12 April 2010 11:59, John Jack wrote: > Hello all. > I am (relatively) new to python, and 100% new to numpy. > I need a way to store arrays of booleans and compare the arrays for > equality. > I assume I want arrays of dtype Boolean, and I should compare the arrays > with array_equal tmp.a

Re: [Numpy-discussion] Name of the file associated with a memmap

2010-04-12 Thread Robert Kern
On Mon, Apr 12, 2010 at 15:52, Charles R Harris wrote: > > On Mon, Apr 12, 2010 at 2:37 PM, Charles R Harris > wrote: >> >> On Mon, Apr 12, 2010 at 1:55 PM, Brent Pedersen >> wrote: >>> >>> On Mon, Apr 12, 2010 at 9:49 AM, Robert Kern >>> wrote: >>> > On Mon, Apr 12, 2010 at 04:03, Nadav Horesh

Re: [Numpy-discussion] Name of the file associated with a memmap

2010-04-12 Thread Brent Pedersen
On Mon, Apr 12, 2010 at 1:59 PM, Robert Kern wrote: > On Mon, Apr 12, 2010 at 15:52, Charles R Harris > wrote: >> >> On Mon, Apr 12, 2010 at 2:37 PM, Charles R Harris >> wrote: >>> >>> On Mon, Apr 12, 2010 at 1:55 PM, Brent Pedersen >>> wrote: On Mon, Apr 12, 2010 at 9:49 AM, Robert K

Re: [Numpy-discussion] Name of the file associated with a memmap

2010-04-12 Thread Peter
On Mon, Apr 12, 2010 at 9:52 PM, Charles R Harris wrote: > >> >> Looks OK, I applied it. Could you add some documentation? >> > > And maybe the filename should be the whole path? Thoughts? > > Chuck Why is the new property "filename" and not "name" to match the way the Python handle work? e.g. >

Re: [Numpy-discussion] Name of the file associated with a memmap

2010-04-12 Thread Robert Kern
On Mon, Apr 12, 2010 at 16:15, Peter wrote: > On Mon, Apr 12, 2010 at 9:52 PM, Charles R Harris > wrote: >> >>> >>> Looks OK, I applied it. Could you add some documentation? >>> >> >> And maybe the filename should be the whole path? Thoughts? >> >> Chuck > > Why is the new property "filename" and

Re: [Numpy-discussion] Name of the file associated with a memmap

2010-04-12 Thread Charles R Harris
On Mon, Apr 12, 2010 at 3:14 PM, Brent Pedersen wrote: > On Mon, Apr 12, 2010 at 1:59 PM, Robert Kern > wrote: > > On Mon, Apr 12, 2010 at 15:52, Charles R Harris > > wrote: > >> > >> On Mon, Apr 12, 2010 at 2:37 PM, Charles R Harris > >> wrote: > >>> > >>> On Mon, Apr 12, 2010 at 1:55 PM, Bre

Re: [Numpy-discussion] Name of the file associated with a memmap

2010-04-12 Thread Peter
On Mon, Apr 12, 2010 at 10:22 PM, Robert Kern wrote: > >Peter wrote: >> >> Why is the new property "filename" and not "name" to match >> the way the Python handle work? e.g. >> > handle = open("Documents/review.pdf") > handle.name >> 'Documents/review.pdf' >> >> I concede that "filename" is

Re: [Numpy-discussion] Name of the file associated with a memmap

2010-04-12 Thread Robert Kern
On Mon, Apr 12, 2010 at 16:14, Brent Pedersen wrote: > On Mon, Apr 12, 2010 at 1:59 PM, Robert Kern wrote: >> On Mon, Apr 12, 2010 at 15:52, Charles R Harris >> wrote: >>> >>> On Mon, Apr 12, 2010 at 2:37 PM, Charles R Harris >>> wrote: On Mon, Apr 12, 2010 at 1:55 PM, Brent Pedersen

Re: [Numpy-discussion] Name of the file associated with a memmap

2010-04-12 Thread Gael Varoquaux
On Mon, Apr 12, 2010 at 04:39:23PM -0500, Robert Kern wrote: > > where should i write the docs? in the file itself or through the doc > > editor? also re path, since it can be a file-like, that would have to > > be something like: > > if isinstance(filename, basestring): > >    filename = os.path.

Re: [Numpy-discussion] Name of the file associated with a memmap

2010-04-12 Thread Robert Kern
On Mon, Apr 12, 2010 at 16:43, Gael Varoquaux wrote: > On Mon, Apr 12, 2010 at 04:39:23PM -0500, Robert Kern wrote: >> > where should i write the docs? in the file itself or through the doc >> > editor? also re path, since it can be a file-like, that would have to >> > be something like: > >> > if

Re: [Numpy-discussion] Name of the file associated with a memmap

2010-04-12 Thread Brent Pedersen
On Mon, Apr 12, 2010 at 2:46 PM, Robert Kern wrote: > On Mon, Apr 12, 2010 at 16:43, Gael Varoquaux > wrote: >> On Mon, Apr 12, 2010 at 04:39:23PM -0500, Robert Kern wrote: >>> > where should i write the docs? in the file itself or through the doc >>> > editor? also re path, since it can be a fil

Re: [Numpy-discussion] Name of the file associated with a memmap

2010-04-12 Thread Robert Kern
On Mon, Apr 12, 2010 at 17:00, Brent Pedersen wrote: > On Mon, Apr 12, 2010 at 2:46 PM, Robert Kern wrote: >> On Mon, Apr 12, 2010 at 16:43, Gael Varoquaux >> wrote: >>> On Mon, Apr 12, 2010 at 04:39:23PM -0500, Robert Kern wrote: > where should i write the docs? in the file itself or throu

Re: [Numpy-discussion] Math Library

2010-04-12 Thread Travis Oliphant
On Apr 11, 2010, at 4:17 PM, Sebastian Walter wrote: > > Ermm, the reply above is quite poor, sorry about that. > What I meant to say is the following: > > If there is going to be a discussion about creating a pure C numpy > library I'd like to join ;) Great. I would really like to get the dis

Re: [Numpy-discussion] Proposal for new ufunc functionality

2010-04-12 Thread Travis Oliphant
On Apr 11, 2010, at 2:56 PM, Anne Archibald wrote: 2010/4/10 Stéfan van der Walt : On 10 April 2010 19:45, Pauli Virtanen wrote: Another addition to ufuncs that should be though about is specifying the Python-side interface to generalized ufuncs. This is an interesting idea; what do you

Re: [Numpy-discussion] Math Library

2010-04-12 Thread Charles R Harris
On Mon, Apr 12, 2010 at 4:19 PM, Travis Oliphant wrote: > > On Apr 11, 2010, at 4:17 PM, Sebastian Walter wrote: > > > > > Ermm, the reply above is quite poor, sorry about that. > > What I meant to say is the following: > > > > If there is going to be a discussion about creating a pure C numpy > >

Re: [Numpy-discussion] Name of the file associated with a memmap

2010-04-12 Thread Brent Pedersen
On Mon, Apr 12, 2010 at 3:08 PM, Robert Kern wrote: > On Mon, Apr 12, 2010 at 17:00, Brent Pedersen wrote: >> On Mon, Apr 12, 2010 at 2:46 PM, Robert Kern wrote: >>> On Mon, Apr 12, 2010 at 16:43, Gael Varoquaux >>> wrote: On Mon, Apr 12, 2010 at 04:39:23PM -0500, Robert Kern wrote: >

Re: [Numpy-discussion] Proposal for new ufunc functionality

2010-04-12 Thread Robert Kern
On Mon, Apr 12, 2010 at 17:26, Travis Oliphant wrote: > > On Apr 11, 2010, at 2:56 PM, Anne Archibald wrote: > > 2010/4/10 Stéfan van der Walt : > > On 10 April 2010 19:45, Pauli Virtanen wrote: > > Another addition to ufuncs that should be though about is specifying the > > Python-side interface

Re: [Numpy-discussion] Proposal for new ufunc functionality

2010-04-12 Thread Anne Archibald
On 12 April 2010 18:26, Travis Oliphant wrote: > We should collect all of these proposals into a NEP. Or several NEPs, since I think they are quasi-orthogonal. > To clarify what I > mean by "group-by" behavior. > Suppose I have an array of floats and an array of integers.   Each element > in th

[Numpy-discussion] Duplicate functions

2010-04-12 Thread Charles R Harris
Hi All, What do we do about duplicate functions? There are currently three log2's in numpy, one ufunc, one ufunclike, and one in emath. The emath version isn't automatically imported so I don't think we need to worry about it, but the ufunclike version is imported after the ufunc version and shado

Re: [Numpy-discussion] Proposal for new ufunc functionality

2010-04-12 Thread Warren Weckesser
Robert Kern wrote: > On Mon, Apr 12, 2010 at 17:26, Travis Oliphant wrote: > >> On Apr 11, 2010, at 2:56 PM, Anne Archibald wrote: >> >> 2010/4/10 Stéfan van der Walt : >> >> On 10 April 2010 19:45, Pauli Virtanen wrote: >> >> Another addition to ufuncs that should be though about is specifyin

Re: [Numpy-discussion] Proposal for new ufunc functionality

2010-04-12 Thread Robert Kern
On Mon, Apr 12, 2010 at 17:54, Warren Weckesser wrote: > A bit more generalization of `by` gives behavior like matlab's accumarray > (http://www.mathworks.com/access/helpdesk/help/techdoc/ref/accumarray.html), > which I partly cloned here: > [This would be a link to the scipy cookbook, but scipy.

Re: [Numpy-discussion] Name of the file associated with a memmap

2010-04-12 Thread Brent Pedersen
On Mon, Apr 12, 2010 at 3:31 PM, Brent Pedersen wrote: > On Mon, Apr 12, 2010 at 3:08 PM, Robert Kern wrote: >> On Mon, Apr 12, 2010 at 17:00, Brent Pedersen wrote: >>> On Mon, Apr 12, 2010 at 2:46 PM, Robert Kern wrote: On Mon, Apr 12, 2010 at 16:43, Gael Varoquaux wrote: > On M

[Numpy-discussion] indexing to sort with argsort(..., axis=1)

2010-04-12 Thread Angus McMorland
Hi all, I want to sort a 2d array along one dimension, with the indices returned by argsort, but the subsequent indexing syntax to get the sorted array is not obvious. The following works, but I wonder if there is a simpler way: a = np.random.random(size=(5,3)) s = np.argsort(a, axis=1) sorted =

Re: [Numpy-discussion] indexing to sort with argsort(..., axis=1)

2010-04-12 Thread josef . pktd
On Mon, Apr 12, 2010 at 10:41 PM, Angus McMorland wrote: > Hi all, > I want to sort a 2d array along one dimension, with the indices returned by > argsort, but the subsequent indexing syntax to get the sorted array is not > obvious. > The following works, but I wonder if there is a simpler way: >

Re: [Numpy-discussion] indexing to sort with argsort(..., axis=1)

2010-04-12 Thread Gökhan Sever
On Mon, Apr 12, 2010 at 9:41 PM, Angus McMorland wrote: > Hi all, > > I want to sort a 2d array along one dimension, with the indices returned by > argsort, but the subsequent indexing syntax to get the sorted array is not > obvious. > > The following works, but I wonder if there is a simpler way