Re: [Numpy-discussion] Simple multi-arg wrapper for dot()

2007-03-23 Thread Bill Baxter
On 3/24/07, Anne Archibald <[EMAIL PROTECTED]> wrote: > On 24/03/07, Bill Baxter <[EMAIL PROTECTED]> wrote: > > I mentioned in another thread Travis started on the scipy list that I > > would find it useful if there were a function like dot() that could > > multiply more than just two things. > > >

[Numpy-discussion] nd_image.affine_transform edge effects

2007-03-23 Thread James Turner
Hi Zach, > Hmm, this is worrisome. There really shouldn't be ringing on > continuous-tone images like Lena -- right? (And at no step in an > image like that should gaussian filtering be necessary if you're > doing spline interpolation -- also right?) That's hard to say. Just because it's mainly

Re: [Numpy-discussion] Detect subclass of ndarray

2007-03-23 Thread Charles R Harris
On 3/23/07, Anne Archibald <[EMAIL PROTECTED]> wrote: On 23/03/07, Charles R Harris <[EMAIL PROTECTED]> wrote: > Anyone, > > What is the easiest way to detect in python/C if an object is a subclass of > ndarray? Um, how about isinstance or issubclass? (if you want strictness you can look at whe

Re: [Numpy-discussion] Detect subclass of ndarray

2007-03-23 Thread Anne Archibald
On 23/03/07, Charles R Harris <[EMAIL PROTECTED]> wrote: > Anyone, > > What is the easiest way to detect in python/C if an object is a subclass of > ndarray? Um, how about isinstance or issubclass? (if you want strictness you can look at whether x.__class__ is zeros(1).__class__) Anne ___

Re: [Numpy-discussion] Simple multi-arg wrapper for dot()

2007-03-23 Thread Anne Archibald
On 24/03/07, Bill Baxter <[EMAIL PROTECTED]> wrote: > I mentioned in another thread Travis started on the scipy list that I > would find it useful if there were a function like dot() that could > multiply more than just two things. > > Here's a sample implementation called 'mdot'. > > mdot(a,b,c,d)

[Numpy-discussion] Simple multi-arg wrapper for dot()

2007-03-23 Thread Bill Baxter
I mentioned in another thread Travis started on the scipy list that I would find it useful if there were a function like dot() that could multiply more than just two things. Here's a sample implementation called 'mdot'. mdot(a,b,c,d) ==> dot(dot(dot(a,b),c),d) mdot(a,(b,c),d) ==> dot(dot(a,dot(b,

[Numpy-discussion] Detect subclass of ndarray

2007-03-23 Thread Charles R Harris
Anyone, What is the easiest way to detect in python/C if an object is a subclass of ndarray? Chuck ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Array of Arrays

2007-03-23 Thread Alexander Michael
On 3/23/07, Sebastian Haase <[EMAIL PROTECTED]> wrote: > Hold on -- aren't the "..." at the *end* always implicit: > I you have > a.shape = (6,5,4,3) > a[3,2] is the same as a[3,2,:,:] is the same as a[3,2,...] > > only if you wanted a[...,3,2] you would have to change your code !? > Am I confus

Re: [Numpy-discussion] Array of Arrays

2007-03-23 Thread Sebastian Haase
On 3/23/07, Alexander Michael <[EMAIL PROTECTED]> wrote: > On 3/23/07, Nadav Horesh <[EMAIL PROTECTED]> wrote: > > How about > > > > a = empty((5,7,4)) > > c = a[...,-1] > > Solely because I want to use the array with code that assumes it is > working with two-dimensional arrays but yet only perf

[Numpy-discussion] swig svn commits

2007-03-23 Thread Sebastian Haase
Hi, this is regarding the svn commit by wfspotz. Author: [EMAIL PROTECTED] Date: 2007-03-23 13:04:37 -0500 (Fri, 23 Mar 2007) New Revision: 3593 Modified: trunk/numpy/doc/swig/numpy.i Log: Added typecheck typemaps to INPLACE_ARRAY typemap suites Hi wfspotz, I was just wondering if you consider

Re: [Numpy-discussion] Array of Arrays

2007-03-23 Thread Berthold Höllmann
"Alexander Michael" <[EMAIL PROTECTED]> writes: > How can I do something like the following? > > a = empty((5,7), dtype=<4 element array of floats>) > > c = a[:,-1] # last column of 4 element arrays > > a[0,0] = 2.0 > print a[0,0] > [2. 2. 2. 2.] > > a[1,0] = 3.0 > a[0,1] = a[0,0] * a[1,0] > > pri

Re: [Numpy-discussion] concatenating 1-D arrays to 2D

2007-03-23 Thread Bill Baxter
On 3/24/07, Sebastian Haase <[EMAIL PROTECTED]> wrote: > > > > Then of course, there's r_ and c_: > > > > c = numpy.c_[a,b] > > > > c = numpy.r_[a[None],b[None]].T > > > > --bb > So, > None is the same as newaxis - right? Yes, newaxis is None. None is newaxis. Same thing. I just don't see much

Re: [Numpy-discussion] nd_image.affine_transform edge effects

2007-03-23 Thread Zachary Pincus
Hello again, On Mar 23, 2007, at 7:56 AM, Travis Oliphant wrote: >> I'm not sure what people normally do in computer graphics, since I'm >> working more with natural band-limited images, but in the case of >> Stefan's "rotate_artifacts" example, wouldn't it be appropriate to >> use the 1st- or 0th

Re: [Numpy-discussion] assignment to array.dtype

2007-03-23 Thread Travis Oliphant
Jan Strube wrote: > Hi list, > maybe this is a really stupid idea, and I don't want to advertise > this, but what actually happens when I reassign the dtype of an object? > Does it return the same as array.view? Yes, it is the same. In fact, IIRC it uses very similar code. -Travis __

Re: [Numpy-discussion] concatenating 1-D arrays to 2D

2007-03-23 Thread Stefan van der Walt
On Fri, Mar 23, 2007 at 11:09:03AM -0400, Robert Pyle wrote: > > In [65]:concatenate((a.reshape(10,1),b.reshape(10,1)),axis=1) > > Out[65]: > > array([[ 0, -10], > > [ 1, -9], > > [ 2, -8], > > [ 3, -7], > > [ 4, -6], > > [ 5, -5], > > [ 6

Re: [Numpy-discussion] nd_image.affine_transform edge effects

2007-03-23 Thread Zachary Pincus
Hello all, On Mar 23, 2007, at 3:04 AM, Stefan van der Walt wrote: > On Thu, Mar 22, 2007 at 11:20:37PM -0700, Zachary Pincus wrote: >> The actual transform operators then use these coefficients to >> (properly) compute pixel values at different locations. I just >> assumed that the "pre-filterin

Re: [Numpy-discussion] concatenating 1-D arrays to 2D

2007-03-23 Thread Sebastian Haase
On 3/22/07, Bill Baxter <[EMAIL PROTECTED]> wrote: > On 3/23/07, Eric Firing <[EMAIL PROTECTED]> wrote: > > Sebastian Haase wrote: > > > On 3/22/07, Stefan van der Walt <[EMAIL PROTECTED]> wrote: > > >> On Thu, Mar 22, 2007 at 08:13:22PM -0400, Brian Blais wrote: > > >>> Hello, > > >>> > > >>> I'd

Re: [Numpy-discussion] Array of Arrays

2007-03-23 Thread Alexander Michael
On 3/23/07, Nadav Horesh <[EMAIL PROTECTED]> wrote: > How about > > a = empty((5,7,4)) > c = a[...,-1] Solely because I want to use the array with code that assumes it is working with two-dimensional arrays but yet only performs operations on the "outer" two-dimensional array that would be consi

Re: [Numpy-discussion] concatenating 1-D arrays to 2D

2007-03-23 Thread Robert Pyle
On Mar 22, 2007, at 8:13 PM, Brian Blais wrote: > Hello, > > I'd like to concatenate a couple of 1D arrays to make it a 2D > array, with two columns > (one for each of the original 1D arrays). I thought this would work: > > > In [47]:a=arange(0,10,1) > > In [48]:a > Out[48]:array([0, 1, 2, 3,

Re: [Numpy-discussion] nd_image.affine_transform edge effects

2007-03-23 Thread Travis Oliphant
James Turner wrote: >By the way, ringing at sharp edges is an intrinsic feature of higher- >order spline interpolation, right? I believe this kind of interpolant >is really intended for smooth (band-limited) data. I'm not sure why >the pre-filtering makes a difference though; I don't yet understan

Re: [Numpy-discussion] nd_image.affine_transform edge effects

2007-03-23 Thread Travis Oliphant
Stefan van der Walt wrote: >On Thu, Mar 22, 2007 at 04:33:53PM -0700, Travis Oliphant wrote: > > >>>I would rather opt for changing the spline fitting algorithm than for >>>padding with zeros. >>> >>> >>> >>> >> From what I understand, the splines used in ndimage have the implicit >>mirr

Re: [Numpy-discussion] Adapting algorithm to accept Scipy sparse matrix

2007-03-23 Thread David Koch
Hi, Ok, I got it to work now but - damn, it's ugly. I thought I'd have to watch the differences between ndarray and matrix type but it turns out sparseMatrix is yet again different from matrix in several respects when it comes to certain operations. Is this intended or something that will be mend

Re: [Numpy-discussion] Array of Arrays

2007-03-23 Thread Nadav Horesh
How about a = empty((5,7,4)) c = a[...,-1] . . . Nadav -Original Message- From: [EMAIL PROTECTED] on behalf of Alexander Michael Sent: Fri 23-Mar-07 15:33 To: Discussion of Numerical Python Cc: Subject:[Numpy-discussion] Array of Arrays How can I do something lik

Re: [Numpy-discussion] histogramdd shapes

2007-03-23 Thread David Huard
Thanks Ben, I submitted a patch with your fix. Ticket 189 David 2007/3/17, Ben Granett <[EMAIL PROTECTED]>: Hi, There seems to be a problem with histogramdd (numpy 1.0.1). Depending on the number of bins in each axis, it may not produce an a

[Numpy-discussion] Array of Arrays

2007-03-23 Thread Alexander Michael
How can I do something like the following? a = empty((5,7), dtype=<4 element array of floats>) c = a[:,-1] # last column of 4 element arrays a[0,0] = 2.0 print a[0,0] [2. 2. 2. 2.] a[1,0] = 3.0 a[0,1] = a[0,0] * a[1,0] print a[0,1] [6. 6. 6. 6.] etc. As always, thanks for the help! Alex

[Numpy-discussion] nd_image.affine_transform edge effects

2007-03-23 Thread James Turner
Thanks for the explanation, Travis. It now looks like there are 2 distinct issues getting mixed up here, however. First, there is the issue of the mirror symmetry of the spline algorithm affecting the data towards the edges, as described by Peter and Travis (this is probably also what Anne is refe

Re: [Numpy-discussion] nd_image.affine_transform edge effects

2007-03-23 Thread Stefan van der Walt
On Thu, Mar 22, 2007 at 11:20:37PM -0700, Zachary Pincus wrote: > The actual transform operators then use these coefficients to > (properly) compute pixel values at different locations. I just > assumed that the "pre-filtering" was broken (even on natural images > with smooth variations) beca

[Numpy-discussion] nd_image.affine_transform edge effects

2007-03-23 Thread James Turner
Hi Zach, > further I'm sorry to have caused Peter to be further bothered about > this non-issue. Don't worry -- I have let him know that we've probably figured it out. I hope Stefan agrees. > I now (hopefully) understand that the spline "pre-filter", while > explicitly analogous to a traditi