Re: [Numpy-discussion] ufunc and errors

2009-09-30 Thread Pauli Virtanen
Wed, 30 Sep 2009 10:33:46 -0500, Robert Kern wrote: [clip] >> Also, will the arguments always be named x1, x2, x3, ..., or can I >> somehow give them custom names? > > The only place where names appear is in the docstring. Write whatever > text you like. The first line of the docstring is generat

Re: [Numpy-discussion] repr and object arrays

2009-09-30 Thread Charles R Harris
On Wed, Sep 30, 2009 at 8:52 PM, Robert Kern wrote: > On Wed, Sep 30, 2009 at 21:45, Charles R Harris > wrote: > > Hi All, > > > > It seems that repr applied do an object array does not provide the info > > needed to recreate it: > > > > In [22]: y = array([Decimal(1)]*2) > > > > In [23]: repr(y

[Numpy-discussion] More guestions on Chebyshev class.

2009-09-30 Thread Charles R Harris
The Chebyshev class is now working pretty well, but I would like to settle some things up front. 1) Order in which coefficients are stored/passed/accessed. The current poly1d class ctor is called with the coefficients in high to low order, yet the __getitem__ and __setitem__ methods access them i

Re: [Numpy-discussion] repr and object arrays

2009-09-30 Thread Robert Kern
On Wed, Sep 30, 2009 at 21:45, Charles R Harris wrote: > Hi All, > > It seems that repr applied do an object array does not provide the info > needed to recreate it: > > In [22]: y = array([Decimal(1)]*2) > > In [23]: repr(y) > Out[23]: 'array([1, 1], dtype=object)' > > And of course, there is goi

[Numpy-discussion] repr and object arrays

2009-09-30 Thread Charles R Harris
Hi All, It seems that repr applied do an object array does not provide the info needed to recreate it: In [22]: y = array([Decimal(1)]*2) In [23]: repr(y) Out[23]: 'array([1, 1], dtype=object)' And of course, there is going to be a problem with arrays of more than one dimension anyway. But I wo

Re: [Numpy-discussion] Convert data into rectangular grid

2009-09-30 Thread jah
On Wed, Sep 30, 2009 at 8:57 AM, denis bzowy wrote: > jah gmail.com> writes: > > > > > Hi,Suppose I have a set of x,y,c data ... matplotlib.pyplot.contour() ). > > > > JAH, is griddata() working and fast enough for you ? > How many points are you contouring ? > > > Thanks all. Robert, griddata i

Re: [Numpy-discussion] Another dumb structured array question

2009-09-30 Thread David Warde-Farley
On 30-Sep-09, at 9:51 AM, Travis Oliphant wrote: > Try (with a later version of NumPy --- possibly trunk): > > arr[['foo', 'bar']] > > (i.e. with a list instead of a tuple) Aha! Thanks Travis. I guess tuples for multi-dimensional indexing _and_ multi-field indexing would be semantically awkw

Re: [Numpy-discussion] [SciPy-dev] Deprecate chararray [was Plea for help]

2009-09-30 Thread David Goldsmith
On Wed, Sep 30, 2009 at 2:09 PM, Ralf Gommers wrote: > > On Wed, Sep 30, 2009 at 4:37 PM, David Goldsmith > wrote: > >> So, Ralf (or anyone), how, if at all, should we modify the status of the >> existing chararray objects/methods in the wiki? > > > Nothing has to be done until *after* Mike has c

Re: [Numpy-discussion] [SciPy-dev] Deprecate chararray [was Plea for help]

2009-09-30 Thread Ralf Gommers
On Wed, Sep 30, 2009 at 4:37 PM, David Goldsmith wrote: > So, Ralf (or anyone), how, if at all, should we modify the status of the > existing chararray objects/methods in the wiki? Nothing has to be done until *after* Mike has committed his changes to svn. Please see my previous email for what h

[Numpy-discussion] scipy.reddit.com

2009-09-30 Thread David Warde-Farley
In the spirit of the 'advice' site, and given that we're thinking of moving scipy.org to more static content (once I have some free time on my hands again, which should be soon!), I set up a 'subreddit' on reddit.com for Python-in-Science related links. I even came up with a somewhat spiffy

Re: [Numpy-discussion] [SciPy-dev] Deprecate chararray [was Plea for help]

2009-09-30 Thread David Goldsmith
So, Ralf (or anyone), how, if at all, should we modify the status of the existing chararray objects/methods in the wiki? Assuming you have no problem sharing them with me, Michael, I could add those docstrings you created for the existing methods, and we can promote them to "Ready for Review"; the

Re: [Numpy-discussion] Compound conditional indexing

2009-09-30 Thread Gökhan Sever
On Wed, Sep 30, 2009 at 2:45 PM, Robert Kern wrote: > On Wed, Sep 30, 2009 at 14:40, Gökhan Sever wrote: > > Thanks this works. > > > > My second question how to access a second array using this condition? > > > > I am trying slice another array using a compound condition on the > reference > >

Re: [Numpy-discussion] Compound conditional indexing

2009-09-30 Thread Robert Kern
On Wed, Sep 30, 2009 at 14:40, Gökhan Sever wrote: > Thanks this works. > > My second question how to access a second array using this condition? > > I am trying slice another array using a compound condition on the reference > array. > > say: > > a = 1,2,3,4,5, > b = 20,30,40,50,60 > > I want to

Re: [Numpy-discussion] Compound conditional indexing

2009-09-30 Thread Gökhan Sever
Thanks this works. My second question how to access a second array using this condition? I am trying slice another array using a compound condition on the reference array. say: a = 1,2,3,4,5, b = 20,30,40,50,60 I want to get elements of a only when a = 3,4. I know I need indices but how ? O

Re: [Numpy-discussion] Compound conditional indexing

2009-09-30 Thread Christopher Barker
Gökhan Sever wrote: > How to conditionally index an array as shown below : > > a = arange(10) > a[5 > to get > array([6,7]) In [56]: a[(5http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Compound conditional indexing

2009-09-30 Thread Joe Kington
There may be a more elegant way, but: In [2]: a = np.arange(10) In [3]: a[(a>5) & (a<8)] Out[3]: array([6, 7]) On Wed, Sep 30, 2009 at 1:27 PM, Gökhan Sever wrote: > Hello, > > How to conditionally index an array as shown below : > > a = arange(10) > a[5 > to get > array([6,7]) > > I can't do

[Numpy-discussion] Compound conditional indexing

2009-09-30 Thread Gökhan Sever
Hello, How to conditionally index an array as shown below : a = arange(10) a[5___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Question about improving genfromtxt errors

2009-09-30 Thread Skipper Seabold
On Wed, Sep 30, 2009 at 12:56 PM, Bruce Southey wrote: > On 09/30/2009 10:22 AM, Skipper Seabold wrote: >> On Tue, Sep 29, 2009 at 4:36 PM, Bruce Southey  wrote: >> >> >>> Hi, >>> The first case just has to handle a missing delimiter - actually I expect >>> that most of my cases would relate this

Re: [Numpy-discussion] Question about improving genfromtxt errors

2009-09-30 Thread Bruce Southey
On 09/30/2009 10:22 AM, Skipper Seabold wrote: > On Tue, Sep 29, 2009 at 4:36 PM, Bruce Southey wrote: > > >> Hi, >> The first case just has to handle a missing delimiter - actually I expect >> that most of my cases would relate this. So here is simple Python code to >> generate arbitrary lar

Re: [Numpy-discussion] Another dumb structured array question

2009-09-30 Thread Skipper Seabold
On Wed, Sep 30, 2009 at 12:00 PM, Ralf Gommers wrote: > No, all the docs should be in the wiki. The page corresponding to the link > you gave is http://docs.scipy.org/numpy/docs/numpy.doc.structured_arrays/ > > And if you use "diff to svn" on that page you can see that it already > contains improv

Re: [Numpy-discussion] Another dumb structured array question

2009-09-30 Thread Ralf Gommers
On Wed, Sep 30, 2009 at 11:47 AM, Skipper Seabold wrote: > On Wed, Sep 30, 2009 at 11:01 AM, Ralf Gommers > wrote: > >> That's really helpful to know. Is it too early to document this on > >> the wiki ? > > > > Not at all. If it works in trun

Re: [Numpy-discussion] Convert data into rectangular grid

2009-09-30 Thread denis bzowy
jah gmail.com> writes: > > Hi,Suppose I have a set of x,y,c data ... matplotlib.pyplot.contour() ). > JAH, is griddata() working and fast enough for you ? How many points are you contouring ? ___ NumPy-Discussion mailing list NumPy-Discussion@scipy

Re: [Numpy-discussion] Another dumb structured array question

2009-09-30 Thread Skipper Seabold
On Wed, Sep 30, 2009 at 11:01 AM, Ralf Gommers wrote: > > > On Wed, Sep 30, 2009 at 10:24 AM, Skipper Seabold > wrote: >> >> On Wed, Sep 30, 2009 at 9:51 AM, Travis Oliphant >> wrote: >> > >> > On Sep 29, 2009, at 3:32 PM, David Warde-Farley wrote: >> > >> >> Is there an easy way to get multiple

Re: [Numpy-discussion] Question about improving genfromtxt errors

2009-09-30 Thread Skipper Seabold
On Tue, Sep 29, 2009 at 4:36 PM, Bruce Southey wrote: > > Hi, > The first case just has to handle a missing delimiter - actually I expect > that most of my cases would relate this. So here is simple Python code to > generate arbitrary large list with the occasional missing delimiter. > > I set it

Re: [Numpy-discussion] numpy macosx10.5 binaries: compa tible with 10.4?

2009-09-30 Thread denis bzowy
> Russell E. Owen wrote: > > All the official numpy 1.3.0 Mac binaries are labelled "macosx10.5". > > Does anyone know if these are backwards compatible with MacOS X 10.4 numpy-1.3.0-py2.5-macosx10.5.dmg works fine on macosx 10.4.11 ppc (with Python 2.5.1) -- denis

Re: [Numpy-discussion] ufunc and errors

2009-09-30 Thread Robert Kern
On Wed, Sep 30, 2009 at 09:34, Dag Sverre Seljebotn wrote: > I looked and looked in the docs, but couldn't find an answer to this: > When writing a ufunc, is it possible somehow to raise a Python exception > (by acquiring the GIL first to raise it, set a flag and a callback which > will be called

Re: [Numpy-discussion] Question about improving genfromtxt errors

2009-09-30 Thread Skipper Seabold
On Tue, Sep 29, 2009 at 4:36 PM, Bruce Southey wrote: > > Hi, > The first case just has to handle a missing delimiter - actually I expect > that most of my cases would relate this. So here is simple Python code to > generate arbitrary large list with the occasional missing delimiter. > > I set it

Re: [Numpy-discussion] Another dumb structured array question

2009-09-30 Thread Ralf Gommers
On Wed, Sep 30, 2009 at 10:24 AM, Skipper Seabold wrote: > On Wed, Sep 30, 2009 at 9:51 AM, Travis Oliphant > wrote: > > > > On Sep 29, 2009, at 3:32 PM, David Warde-Farley wrote: > > > >> Is there an easy way to get multiple subdtypes out? e.g. if I have a > >> dtype > >> > >> dtype([('foo', 'i4

[Numpy-discussion] ufunc and errors

2009-09-30 Thread Dag Sverre Seljebotn
I looked and looked in the docs, but couldn't find an answer to this: When writing a ufunc, is it possible somehow to raise a Python exception (by acquiring the GIL first to raise it, set a flag and a callback which will be called with the GIL, or otherwise?). Or should one always use NaN even

Re: [Numpy-discussion] Another dumb structured array question

2009-09-30 Thread Skipper Seabold
On Wed, Sep 30, 2009 at 9:51 AM, Travis Oliphant wrote: > > On Sep 29, 2009, at 3:32 PM, David Warde-Farley wrote: > >> Is there an easy way to get multiple subdtypes out? e.g. if I have a >> dtype >> >> dtype([('foo', 'i4'), ('bar', 'i8'), ('baz', 'S100')]) >> >> and an array with that dtype, is

Re: [Numpy-discussion] [SciPy-dev] Deprecate chararray [was Plea for help]

2009-09-30 Thread Michael Droettboom
Ralf Gommers wrote: > > > On Wed, Sep 30, 2009 at 9:03 AM, Michael Droettboom > wrote: > > In the source in my working copy. Is that going to cause problems? I > wasn't sure if it was possible to document methods that didn't yet > exist > in the code in th

Re: [Numpy-discussion] how does numpy handle views and garbage collection?

2009-09-30 Thread Travis Oliphant
On Sep 30, 2009, at 6:43 AM, Chris Colbert wrote: Lets say I have function that applies a homogeneous transformation matrix to an Nx3 array of points using np.dot. since the matrix is 4x4 I have to add a 4 column of ones to the array so the function looks something like this: def foo(): <

[Numpy-discussion] MemoryError with fancy indexing

2009-09-30 Thread Sebastian Haase
Hi, Maybe someone could explain to me what is going on here!? >>> N.who() NameShape BytesType SLmap 2048 x 2048 16777216 int32 SLmap_fast 2048 x 2048 16777216

Re: [Numpy-discussion] max value of np scalars

2009-09-30 Thread Travis Oliphant
On Sep 29, 2009, at 4:14 PM, Charles R Harris wrote: On Tue, Sep 29, 2009 at 2:52 PM, Neal Becker wrote: I need the max value of an np scalar type. I had used this code: def get_max(is_signed, base_type, total_bits): print 'get_max:', is_signed, base_type, total_bits if is_signed:

Re: [Numpy-discussion] Another dumb structured array question

2009-09-30 Thread Travis Oliphant
On Sep 29, 2009, at 3:32 PM, David Warde-Farley wrote: > Is there an easy way to get multiple subdtypes out? e.g. if I have a > dtype > > dtype([('foo', 'i4'), ('bar', 'i8'), ('baz', 'S100')]) > > and an array with that dtype, is there a way to only get the 'foo' and > 'bar'? > > arr[('foo','bar'

Re: [Numpy-discussion] [SciPy-dev] Deprecate chararray [was Plea for help]

2009-09-30 Thread Ralf Gommers
On Wed, Sep 30, 2009 at 9:03 AM, Michael Droettboom wrote: > In the source in my working copy. Is that going to cause problems? I > wasn't sure if it was possible to document methods that didn't yet exist > in the code in the wiki. > > That is fine. New functions will automatically show up in t

Re: [Numpy-discussion] fixed_pt prototype using aggregation

2009-09-30 Thread Neal Becker
I have implemented lots more fixed_pt operations, code attached (sorry for long lines, hope that's not a problem)import numpy as np import copy def rnd (x, frac_bits, _max): "A rounding policy" x1 = x >> (frac_bits-1) if (x1 == _max): return x1 >> 1 else: r

Re: [Numpy-discussion] [SciPy-dev] Deprecate chararray [was Plea for help]

2009-09-30 Thread Michael Droettboom
In the source in my working copy. Is that going to cause problems? I wasn't sure if it was possible to document methods that didn't yet exist in the code in the wiki. Mike David Goldsmith wrote: > On Tue, Sep 29, 2009 at 10:55 AM, Michael Droettboom > wrote: > > 2

[Numpy-discussion] how does numpy handle views and garbage collection?

2009-09-30 Thread Chris Colbert
Lets say I have function that applies a homogeneous transformation matrix to an Nx3 array of points using np.dot. since the matrix is 4x4 I have to add a 4 column of ones to the array so the function looks something like this: def foo(): <--snip--> pts = np.column_stack((Xquad, Yquad, Z

Re: [Numpy-discussion] __array_wrap__

2009-09-30 Thread Darren Dale
On Wed, Sep 30, 2009 at 2:57 AM, Pauli Virtanen wrote: > Tue, 29 Sep 2009 14:55:44 -0400, Neal Becker wrote: > >> This seems to work now, but I'm wondering if Charles is correct, that >> inheritance isn't such a great idea here. >> >> The advantage of inheritance is I don't have to implement forwa