Re: [Numpy-discussion] bug using array with a PIL Image (misc.imread)

2009-07-07 Thread David Warde-Farley
That is some weird mojo; I'm guessing that numpy simply doesn't recognize the 'LA' type (luminance+alpha) as it's pretty uncommon. In the meantime you probably want to convert to RGBA, since that file giving you problems is grayscale+alpha channel, and a conversion to RGB might lose the alp

[Numpy-discussion] Mathematica vs Matlab vs Python

2009-07-07 Thread alan
Mathematica vs Matlab vs Python http://www.larssono.com/musings/matmatpy/index.html -- --- | Alan K. Jackson| To see a World in a Grain of Sand | | a...@ajackson.org | And a Heaven in a Wild Flower,

Re: [Numpy-discussion] median object

2009-07-07 Thread keflavich
Robert Kern-2 wrote: > > Mostly just history. Many, though certainly not all, single-argument > functions from Numeric became ndarray methods. I believe that median > was added after that event, and there is some resistance to adding yet > another method to ndarray. The implementor of numpy.ma

Re: [Numpy-discussion] Creating PyArrayObject in C++

2009-07-07 Thread Lisandro Dalcin
2009/7/7 Stéfan van der Walt : > Hi Kenny > > 2009/7/7 Kenny Abernathy : >> I can guarantee that all analysis will be finished before the Unit object is >> destroyed and delete[] is called, so I don't think that's a problem. > > There is a neat trick to make sure things don't get deallocated out of

Re: [Numpy-discussion] Even Sphere Volume

2009-07-07 Thread Chris Colbert
I figured I'd contribute something similar: the "even" distribution of points on a sphere. I can't take credit for the algorithm though, I got it from the following page and just vectorized it, and tweaked it so it uses the golden ration properly: http://www.xsi-blog.com/archives/115 It makes us

Re: [Numpy-discussion] argwhere does not accept py list

2009-07-07 Thread Robert Kern
2009/7/4 Stéfan van der Walt : > Thanks, Scott.  This should now be fixed in SVN. You should probably change that to asanyarray() before the masked array crowd gets upset. :-) -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by ou

Re: [Numpy-discussion] median object

2009-07-07 Thread Robert Kern
On Tue, Jul 7, 2009 at 01:34, Scott Sinclair wrote: >> 2009/7/7 keflavich : >> >> Hi, I want to be able to do something like: >> >> import numpy >> x=numpy.array([1,4,4,6,7,3,4,2]) >> x.median() >> >> rather than >> numpy.median(x) >> >> so that in a function, I can call >> x.median() >> and allow

Re: [Numpy-discussion] median object

2009-07-07 Thread Robert Kern
On Mon, Jul 6, 2009 at 18:00, keflavich wrote: > > Hi, I want to be able to do something like: > > import numpy > x=numpy.array([1,4,4,6,7,3,4,2]) > x.median() > > rather than > numpy.median(x) > > so that in a function, I can call > x.median() > and allow x to be a masked array or a numpy array. >

Re: [Numpy-discussion] custom allocation of numpy array

2009-07-07 Thread Robert Kern
On Tue, Jul 7, 2009 at 17:50, Trevor Clarke wrote: > I'm embedding python and numpy in a C++ program and I want to share some > data owned by C++. I'm able to get the allocation/deallocation and memory > sharing working for a contiguous array. However, I have non-contiguous data > (random sub-array

[Numpy-discussion] bug using array with a PIL Image (misc.imread)

2009-07-07 Thread Nicolas Pinto
Dear all, For some reason I have a problem converting a specific png image using array(). Here is what I am getting (using numpy 1.3.0 and scipy 0.7.0). % wget http://files.getdropbox.com/u/167753/spiky_adj_023.png % python -c "import numpy as np; import Image; print np.array(Image.open('spiky_a

[Numpy-discussion] custom allocation of numpy array

2009-07-07 Thread Trevor Clarke
I'm embedding python and numpy in a C++ program and I want to share some data owned by C++. I'm able to get the allocation/deallocation and memory sharing working for a contiguous array. However, I have non-contiguous data (random sub-array locations, not a fixed skip factor) and I may not have all

Re: [Numpy-discussion] Question for David re npy_funcs

2009-07-07 Thread Charles R Harris
On Tue, Jul 7, 2009 at 3:43 PM, wrote: > > Hi, Charles. Which David? We have at least three lurking on this list. > ;-) I mean, I know I can't answer this, but... > That would be David C. I figured the subject line would give it away ;) Chuck ___ N

Re: [Numpy-discussion] Creating PyArrayObject in C++

2009-07-07 Thread Stéfan van der Walt
Hi Kenny 2009/7/7 Kenny Abernathy : > I can guarantee that all analysis will be finished before the Unit object is > destroyed and delete[] is called, so I don't think that's a problem. There is a neat trick to make sure things don't get deallocated out of order: http://blog.enthought.com/?p=62

Re: [Numpy-discussion] Question for David re npy_funcs

2009-07-07 Thread d_l_goldsmith
Hi, Charles.  Which David? We have at least three lurking on this list. ;-) I mean, I know I can't answer this, but... DG --- On Tue, 7/7/09, Charles R Harris wrote: > From: Charles R Harris > Subject: [Numpy-discussion] Question for David re npy_funcs > To: "numpy-discussion" > Date: Tue

[Numpy-discussion] Question for David re npy_funcs

2009-07-07 Thread Charles R Harris
David, Should any standard c functions used in loops.c.src be the npy_* version? I've been using fabs, but I'm wondering if that should be npy_fabs. Chuck ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://mail.scipy.org/mailman/listinf

Re: [Numpy-discussion] transpose of a matrix should be another matrix

2009-07-07 Thread David Goldsmith
There is no one that doesn't (have a lot to learn, that is) - we're all here to help each other do that. ;-) DG --- On Tue, 7/7/09, Phillip M. Feldman wrote: > From: Phillip M. Feldman > Subject: Re: [Numpy-discussion] transpose of a matrix should be another matrix > To: "Discussion of Numer

[Numpy-discussion] Creating PyArrayObject in C++

2009-07-07 Thread Kenny Abernathy
I've built an analysis framework for studying electrophysiogical data, and I'd like to add NumPy (and SciPy, although that's not germane to my current question) as an engine so users can more easily add their own functions to the program. I'm at the point now of trying to share the data between th

Re: [Numpy-discussion] transpose of a matrix should be another matrix

2009-07-07 Thread Phillip M. Feldman
Chris and David- I've verified that both of your solutions work. I have a lot to learn! Thanks! Phillip David Goldsmith wrote: Also, there is a "non-method" way: the .T property: a = np. matrix([[1,2,3],[4,5,6],[7,8,9]]) a matrix([[1, 2, 3], [4, 5, 6], [7, 8,