Re: [Numpy-discussion] Changes in PyArray_FromAny between 1.5.x and 1.6.x

2012-06-04 Thread Mike Hansen
On Mon, Jun 4, 2012 at 9:30 PM, Travis Oliphant wrote: > Can you raise an issue on the Github issue tracker for NumPy?   These issues > will be looked at more closely.   This kind of change should not have made it > in to the release. Thanks Travis! I've made this https://github.com/numpy/nump

Re: [Numpy-discussion] some typestrings not recognized anymore

2012-06-04 Thread Travis Oliphant
Using the 'h2' is redundant, but it should not have been changed so quickly. I could see raising a deprecation warning and communicating the correct spelling ('i2'). -Travis On Jun 3, 2012, at 6:45 PM, Benjamin Root wrote: > > > On Sunday, June 3, 2012, Ralf Gommers wrote: > > > On

Re: [Numpy-discussion] Changes in PyArray_FromAny between 1.5.x and 1.6.x

2012-06-04 Thread Travis Oliphant
Can you raise an issue on the Github issue tracker for NumPy? These issues will be looked at more closely. This kind of change should not have made it in to the release. Given the lack of availability of time from enough experts in NumPy, this is the sort of thing that can happen. I w

Re: [Numpy-discussion] 1D array sorting ascending and descending by fields

2012-06-04 Thread Benjamin Root
On Monday, June 4, 2012, Chris Barker wrote: > On Mon, Jun 4, 2012 at 11:10 AM, Patrick Redmond > > > wrote: > > Here's how I sorted primarily by field 'a' descending and secondarily by > > field 'b' ascending: > > could you multiply the numeric field by -1, sort, then put it back -- > somethign

Re: [Numpy-discussion] [EXTERNAL] Numpy + SWIG

2012-06-04 Thread Bill Spotz
Gideon, For these use cases, you will need to write short wrapper functions yourself. In the online docs, http://docs.scipy.org/doc/numpy/reference/swig.interface-file.html in the section entitled "Beyond the Provided Typemaps", subsection "A Common Example", there is an example of how to

Re: [Numpy-discussion] 1D array sorting ascending and descending by fields

2012-06-04 Thread Chris Barker
On Mon, Jun 4, 2012 at 11:10 AM, Patrick Redmond wrote: > Here's how I sorted primarily by field 'a' descending and secondarily by > field 'b' ascending: could you multiply the numeric field by -1, sort, then put it back -- somethign like: data *- -1 data_sorted = np.sort(data, order=['a','b'])

Re: [Numpy-discussion] Numpy + SWIG

2012-06-04 Thread Chris Barker
HAVe you discovered the numpy.i interface files? I haven't done SWIG in a while, but they should take care of at least some of this for you. They used to be distributed with numpy (in docs?), but some googling should find then in any case. -Chris On Mon, Jun 4, 2012 at 2:00 PM, Gideon Simpson

Re: [Numpy-discussion] better error message possible?

2012-06-04 Thread Nathaniel Smith
On Mon, Jun 4, 2012 at 10:00 PM, Thouis (Ray) Jones wrote: > On Mon, Jun 4, 2012 at 4:27 PM, Thouis (Ray) Jones wrote: >> I could look into this.  There are only ~10 places the code generates >> this error, so it should be a pretty minor change. > > My initial estimate was low, but not overly so.

Re: [Numpy-discussion] Changes in PyArray_FromAny between 1.5.x and 1.6.x

2012-06-04 Thread Dag Sverre Seljebotn
On 06/04/2012 09:06 PM, Mike Hansen wrote: > On Mon, May 28, 2012 at 3:15 AM, Mike Hansen wrote: >> In trying to upgrade NumPy within Sage, we notices some differences in >> behavior between 1.5 and 1.6. In particular, in 1.5, we have >> >> sage: f = 0.5 >> sage: f.__array_interface__ >> {'typest

Re: [Numpy-discussion] better error message possible?

2012-06-04 Thread Thouis (Ray) Jones
On Mon, Jun 4, 2012 at 4:27 PM, Thouis (Ray) Jones wrote: > On Fri, Jun 1, 2012 at 6:56 PM, Chris Withers wrote: >> On 01/06/2012 16:39, Benjamin Root wrote: >>> >>> >>>      > >>> import numpy >>>      > >>> numpy.zeros(10)[-123] >>>      > Traceback (most recent call last): >>>      >   File ""

[Numpy-discussion] Numpy + SWIG

2012-06-04 Thread Gideon Simpson
There are two types of swig problems that I was hoping to get some help with. First, suppose I have some C function void f(double *x, int nx, double *y, int ny); where we input one array, and we output another array, both of which should be the same size. I have used in my .i file: %apply(doub

Re: [Numpy-discussion] Debian/Ubuntu patch help

2012-06-04 Thread Ralf Gommers
On Wed, May 16, 2012 at 10:50 PM, Ralf Gommers wrote: > > > On Wed, May 16, 2012 at 9:57 PM, Julian Taylor < > jtaylor.deb...@googlemail.com> wrote: > >> On 05/16/2012 09:01 PM, Ralf Gommers wrote: >> > >> > >> > On Tue, May 15, 2012 at 10:35 PM, Julian Taylor >> > mailto:jtaylor.deb...@googlemail

Re: [Numpy-discussion] Changes in PyArray_FromAny between 1.5.x and 1.6.x

2012-06-04 Thread Mike Hansen
On Mon, May 28, 2012 at 3:15 AM, Mike Hansen wrote: > In trying to upgrade NumPy within Sage, we notices some differences in > behavior between 1.5 and 1.6.  In particular, in 1.5, we have > > sage: f = 0.5 > sage: f.__array_interface__ > {'typestr': '=f8'} > sage: numpy.array(f) > array(0.5) > sa

Re: [Numpy-discussion] 1D array sorting ascending and descending by fields

2012-06-04 Thread Patrick Redmond
Here's how I sorted primarily by field 'a' descending and secondarily by field 'b' ascending: (Note that 'a' is the second column, 'b' is the first) >>> data array([('b', 0.03), ('c', 0.03), ('f', 0.03), ('e', 0.01), ('d', 0.04), ('a', 0.04)], dtype=[('b',

Re: [Numpy-discussion] Issue tracking

2012-06-04 Thread Travis Oliphant
There is an interesting project called http://huboard.com/The projects suggests using a few Column Labels that provides a nice card-based window onto the Github issues. I have turned on issue tracking and started a few labels. Feel free to add more / adjust the names as appropriate.

[Numpy-discussion] 1D array sorting ascending and descending by fields

2012-06-04 Thread Patrick Redmond
Hi! I have a one-dimensional ndarray with two fields. I'd like to sort in descending order by field 'a', breaking ties by sorting in ascending order by field 'b'. I've found combinations of sorting and reversing followed by stable sorting that work, but there must be a straightforward way to do i

Re: [Numpy-discussion] How to remove any row or column of a numpy matrix whose sum is 3?

2012-06-04 Thread Chris Barker
On Mon, Jun 4, 2012 at 9:38 AM, Robert Kern wrote: >  # Now use the numpy.delete() function to get the matrix >  # with those rows and columns removed from the original matrix. >  P = np.delete(M, bad_rows, axis=0) >  P = np.delete(P, bad_cols, axis=1) ah yes, forgot about np.delete -- that is a

Re: [Numpy-discussion] How to remove any row or column of a numpy matrix whose sum is 3?

2012-06-04 Thread Chris Barker
On Mon, Jun 4, 2012 at 9:21 AM, bob tnur wrote: > Hello every body. I am new to python. > How to remove any row or column of a numpy matrix whose sum is 3. > To obtain and save new matrix P with (sum(anyrow)!=3 and sum(anycolumn)!=3 > elements. well, one question is -- do you want to remove the p

Re: [Numpy-discussion] Issue tracking

2012-06-04 Thread Ralf Gommers
On Mon, Jun 4, 2012 at 6:05 PM, Charles R Harris wrote: > > > On Mon, Jun 4, 2012 at 9:34 AM, Ralf Gommers > wrote: > >> >> >> On Sun, Jun 3, 2012 at 10:06 PM, Charles R Harris < >> charlesr.har...@gmail.com> wrote: >> >>> Hi All, >>> >>> The issue tracking discussion seems to have died. Since gi

Re: [Numpy-discussion] How to remove any row or column of a numpy matrix whose sum is 3?

2012-06-04 Thread Robert Kern
On Mon, Jun 4, 2012 at 5:21 PM, bob tnur wrote: > Hello every body. I am new to python. > How to remove any row or column of a numpy matrix whose sum is 3. > To obtain and save new matrix P with (sum(anyrow)!=3 and sum(anycolumn)!=3 > elements. > > I tried like this: > > P = M[np.logical_not( (M[n

Re: [Numpy-discussion] Issue tracking

2012-06-04 Thread Charles R Harris
On Mon, Jun 4, 2012 at 9:34 AM, Ralf Gommers wrote: > > > On Sun, Jun 3, 2012 at 10:06 PM, Charles R Harris < > charlesr.har...@gmail.com> wrote: > >> Hi All, >> >> The issue tracking discussion seems to have died. Since github issues >> looks to be a viable alternative at this point, I propose to

Re: [Numpy-discussion] Issue tracking

2012-06-04 Thread Ralf Gommers
On Sun, Jun 3, 2012 at 10:06 PM, Charles R Harris wrote: > Hi All, > > The issue tracking discussion seems to have died. Since github issues > looks to be a viable alternative at this point, I propose to turn it on for > the numpy repository and start directing people in that direction. > > Thoug

Re: [Numpy-discussion] better error message possible?

2012-06-04 Thread Paul Anton Letnes
On 4. juni 2012, at 16:27, Thouis (Ray) Jones wrote: > On Fri, Jun 1, 2012 at 6:56 PM, Chris Withers wrote: >> On 01/06/2012 16:39, Benjamin Root wrote: >>> >>> >>> > >>> import numpy >>> > >>> numpy.zeros(10)[-123] >>> > Traceback (most recent call last): >>> > File "",

Re: [Numpy-discussion] better error message possible?

2012-06-04 Thread Thouis (Ray) Jones
On Fri, Jun 1, 2012 at 6:56 PM, Chris Withers wrote: > On 01/06/2012 16:39, Benjamin Root wrote: >> >> >>      > >>> import numpy >>      > >>> numpy.zeros(10)[-123] >>      > Traceback (most recent call last): >>      >   File "", line 1, in >>      > IndexError: index out of bounds >>      > >>

Re: [Numpy-discussion] fast access and normalizing of ndarray slices

2012-06-04 Thread eat
Hi, On Mon, Jun 4, 2012 at 12:44 AM, srean wrote: > Hi Wolfgang, > > I think you are looking for reduceat( ), in particular add.reduceat() > Indeed OP could utilize add.reduceat(...), like: # tst.py import numpy as np def reduce(data, lengths): ind, ends= np.r_[lengths, lengths], len