Re: [Numpy-discussion] Structured array with no fields - possible?

2009-05-04 Thread S. Chris Colbert
you can create an array without changing the values of the allocated memory by using numpy.empty() or numpy.ndarray() this will allow you to create an array of any size without specifying the contents beforehand. I'm not sure what you mean by "empty", because any memory address will have a val

Re: [Numpy-discussion] Structured array with no fields - possible?

2009-05-04 Thread Matthew Brett
Hi, >> I'm trying to fix a bug in the scipy matlab loading routines, and this >> requires me to somehow represent an empty structured array. >> > > Do you need the struct to be empty (size is 0) or to have no fields ? > What would you expect np.zeros((), dtype=np.dtype([])) to return, for > exampl

Re: [Numpy-discussion] SVD failure

2009-05-04 Thread Philipp K. Janert
Thanks for the quick reply. I'll try upgrading. Best, Ph. On Monday 04 May 2009 04:21:29 pm Stéfan van der Walt wrote: > Hi Philipp > > 2009/5/5 Philipp K. Janert : > > If I see this correctly, my SciPy version > > is 0.6.0; running on 64bit Suse 11. > > SciPy 0.6 is quite old

Re: [Numpy-discussion] FaceL - Facile Face Labeling

2009-05-04 Thread Stéfan van der Walt
2009/5/5 David Bolme : > I have been working on a open source face recognition demo tool called > FaceL for the past few months.   FaceL is a simple and fun face processing > and labeling tool that labels faces in a live video from an iSight camera or > webcam. That's really neat -- I've always wa

Re: [Numpy-discussion] SVD failure

2009-05-04 Thread Stéfan van der Walt
Hi Philipp 2009/5/5 Philipp K. Janert : > If I see this correctly, my SciPy version > is 0.6.0; running on 64bit Suse 11. SciPy 0.6 is quite old, and it is likely that the problem was fixed in the mean time. On SciPy 0.7 I see: In [31]: u,s,v = linalg.svd(m) In [32]: u Out[32]: array([[-0.7071

[Numpy-discussion] FaceL - Facile Face Labeling

2009-05-04 Thread David Bolme
I have been working on a open source face recognition demo tool called FaceL for the past few months. FaceL is a simple and fun face processing and labeling tool that labels faces in a live video from an iSight camera or webcam. It uses OpenCV for face detection, ASEF correlation filters

[Numpy-discussion] SVD failure

2009-05-04 Thread Philipp K. Janert
The following code: from scipy import * from scipy import linalg m = matrix( [ [1,1,0,0], [1,1,0,0], [0,0,1,1], [0,0,1,1] ] ) u,s,v = linalg.svd( m ) fails with the following message: Traceback (most recent call last): File "boo.py", li

Re: [Numpy-discussion] object arrays and ==

2009-05-04 Thread Keith Goodman
On Mon, May 4, 2009 at 2:02 PM, Ryan May wrote: > On Mon, May 4, 2009 at 3:55 PM, David Warde-Farley > wrote: >> >> Hi, >> >> Is there a simple way to compare each element of an object array to a >> single object? objarray == None, for example, gives me a single >> "False". I couldn't find any re

Re: [Numpy-discussion] object arrays and ==

2009-05-04 Thread Ryan May
On Mon, May 4, 2009 at 3:55 PM, David Warde-Farley wrote: > Hi, > > Is there a simple way to compare each element of an object array to a > single object? objarray == None, for example, gives me a single > "False". I couldn't find any reference to it in the documentation, but > I'll admit, I wasn'

[Numpy-discussion] object arrays and ==

2009-05-04 Thread David Warde-Farley
Hi, Is there a simple way to compare each element of an object array to a single object? objarray == None, for example, gives me a single "False". I couldn't find any reference to it in the documentation, but I'll admit, I wasn't quite sure where to look. David _

Re: [Numpy-discussion] efficient 3d histogram creation

2009-05-04 Thread josef . pktd
On Mon, May 4, 2009 at 4:00 PM, Chris Colbert wrote: > i'll take a look at them over the next few days and see what i can hack out. > > Chris > > On Mon, May 4, 2009 at 3:18 PM, David Huard wrote: >> >> >> On Mon, May 4, 2009 at 7:00 AM, wrote: >>> >>> On Mon, May 4, 2009 at 12:31 AM, Chris Colb

Re: [Numpy-discussion] loadtxt example problem ?

2009-05-04 Thread Ryan May
On Mon, May 4, 2009 at 3:06 PM, bruno Piguet wrote: > Hello, > > I'm new to numpy, and considering using loadtxt() to read a data file. > > As a starter, I tried the example of the doc page ( > http://docs.scipy.org/doc/numpy/reference/generated/numpy.loadtxt.html) : > > > >>> from StringIO i

[Numpy-discussion] loadtxt example problem ?

2009-05-04 Thread bruno Piguet
Hello, I'm new to numpy, and considering using loadtxt() to read a data file. As a starter, I tried the example of the doc page ( http://docs.scipy.org/doc/numpy/reference/generated/numpy.loadtxt.html) : >>> from StringIO import StringIO # StringIO behaves like a file object >>> c = Strin

Re: [Numpy-discussion] efficient 3d histogram creation

2009-05-04 Thread Chris Colbert
i'll take a look at them over the next few days and see what i can hack out. Chris On Mon, May 4, 2009 at 3:18 PM, David Huard wrote: > > > On Mon, May 4, 2009 at 7:00 AM, wrote: > >> On Mon, May 4, 2009 at 12:31 AM, Chris Colbert >> wrote: >> > this actually sort of worked. Thanks for putti

Re: [Numpy-discussion] efficient 3d histogram creation

2009-05-04 Thread David Huard
On Mon, May 4, 2009 at 7:00 AM, wrote: > On Mon, May 4, 2009 at 12:31 AM, Chris Colbert > wrote: > > this actually sort of worked. Thanks for putting me on the right track. > > > > Here is what I ended up with. > > > > this is what I ended up with: > > > > def hist3d(imgarray): > > histarray

Re: [Numpy-discussion] stop criterion for an alternating signal

2009-05-04 Thread Charles R Harris
On Mon, May 4, 2009 at 10:59 AM, Nils Wagner wrote: > On Mon, 4 May 2009 10:52:59 -0600 > Charles R Harris wrote: > > On Mon, May 4, 2009 at 10:48 AM, Nils Wagner > > wrote: > > > >> Hi all, > >> > >> How can I define a stop criterion for an alternating > >>series ? > >> > >> Any pointer would b

Re: [Numpy-discussion] Really strange result

2009-05-04 Thread Christopher Barker
Neal Becker wrote: > In [3]: n=-7 > > In [4]: (np.linspace (0, 1023,1024).astype(np.uint64)*n).dtype > Out[4]: dtype('float64') what would you like (expect) to happen when you multiply an unsigned type by a negative number? -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Respon

Re: [Numpy-discussion] Efficient scaling of array

2009-05-04 Thread Johannes Bauer
Zachary Pincus schrieb: > scipy.ndimage.zoom (and related interpolation functions) would be a > good bet -- different orders of interpolation are available, too, > which can be useful. Thanks a lot - exactly what I was looking for! Kind regards, Johannes __

Re: [Numpy-discussion] stop criterion for an alternating signal

2009-05-04 Thread Nils Wagner
On Mon, 4 May 2009 10:52:59 -0600 Charles R Harris wrote: > On Mon, May 4, 2009 at 10:48 AM, Nils Wagner > wrote: > >> Hi all, >> >> How can I define a stop criterion for an alternating >>series ? >> >> Any pointer would be appreciated. >> > > Where does the series come from and what are you

Re: [Numpy-discussion] stop criterion for an alternating signal

2009-05-04 Thread Charles R Harris
On Mon, May 4, 2009 at 10:48 AM, Nils Wagner wrote: > Hi all, > > How can I define a stop criterion for an alternating series ? > > Any pointer would be appreciated. > Where does the series come from and what are you trying to do? Chuck ___ Numpy-discu

[Numpy-discussion] stop criterion for an alternating signal

2009-05-04 Thread Nils Wagner
Hi all, How can I define a stop criterion for an alternating series ? Any pointer would be appreciated. Nils from numpy import loadtxt, arange from pylab import plot, show A = loadtxt('alternate.dat') m = len(A) x = arange(0,m) plot(x,A) show() alternate.dat Description: MPEG movie ___

[Numpy-discussion] How to convert a list into a structured array?

2009-05-04 Thread Wei Su
Hi,All:   My first post! I am very excited to find out structured array (record array) in Python. Since I do data manipulation every day, this is truly great. However, I typically download data using pyodbc, the default output is a big list. So I am wondering how to convert that big list into a

Re: [Numpy-discussion] Efficient scaling of array

2009-05-04 Thread Zachary Pincus
scipy.ndimage.zoom (and related interpolation functions) would be a good bet -- different orders of interpolation are available, too, which can be useful. Zach On May 4, 2009, at 11:40 AM, Johannes Bauer wrote: > Hello list, > > is there a possibility to scale an array by interpolation, >

[Numpy-discussion] Efficient scaling of array

2009-05-04 Thread Johannes Bauer
Hello list, is there a possibility to scale an array by interpolation, automatically? For illustration a 1D-example would be an array of size 5, which is scaled to size 3: before: [ 1, 2, 3, 4, 5 ] 1/1 2/3 1/3 1 1/3 2/3 1 after : [ 2.

Re: [Numpy-discussion] Really strange result

2009-05-04 Thread Bruce Southey
Neal Becker wrote: > Charles R Harris wrote: > > >> On Fri, May 1, 2009 at 7:39 PM, Charles R Harris >> wrote: >> >> >>> On Fri, May 1, 2009 at 7:24 PM, Neal Becker wrote: >>> >>> Charles R Harris wrote: > On Fri, May 1, 2009 at 1:02 PM, Neal Becker

Re: [Numpy-discussion] Porting strategy for py3k

2009-05-04 Thread Dag Sverre Seljebotn
David Cournapeau wrote: > On Mon, May 4, 2009 at 1:24 AM, Dag Sverre Seljebotn > wrote: > >> David Cournapeau wrote: >> >>> On Fri, Apr 24, 2009 at 4:49 PM, Dag Sverre Seljebotn >>> One thing somebody *could* work on rather independently for some hours is proper PEP 3118 s

Re: [Numpy-discussion] apply table lookup to each element

2009-05-04 Thread Stéfan van der Walt
2009/5/4 Neal Becker : > Turns out that if A is an np.array and B is an np.array, then > A[B] will do exactly what I wanted. > > Is this mentioned anywhere in the documentation? http://docs.scipy.org/numpy/docs/numpy-docs/reference/arrays.indexing.rst/#arrays-indexing Stéfan _

Re: [Numpy-discussion] apply table lookup to each element

2009-05-04 Thread Neal Becker
Neal Becker wrote: > Suggestion for efficient way to apply a table lookup to each element of an > integer array? > > import numpy as np > _cos = np.empty ((2**rom_in_bits,), dtype=int) > _sin = np.empty ((2**rom_in_bits,), dtype=int) > for address in xrange (2**12): > _cos[address] = nint ((2

Re: [Numpy-discussion] efficient 3d histogram creation

2009-05-04 Thread josef . pktd
On Mon, May 4, 2009 at 12:31 AM, Chris Colbert wrote: > this actually sort of worked. Thanks for putting me on the right track. > > Here is what I ended up with. > > this is what I ended up with: > > def hist3d(imgarray): >     histarray = N.zeros((16, 16, 16)) >     temp = imgarray.copy() > b