[Numpy-discussion] confusion about eigenvector

2008-02-27 Thread [EMAIL PROTECTED]
i all I am learning PCA method by reading up Turk&Petland papers etc while trying out PCA on a set of greyscale images using python, and numpy I tried to create eigenvectors and facespace. i have facesarray--- an NXP numpy.ndarray that contains data of images N=numof images,P=pixels in an

Re: [Numpy-discussion] loadtxt broken if file does not end in newline

2008-02-27 Thread Robert Kern
On Thu, Feb 28, 2008 at 12:12 AM, Alan G Isaac <[EMAIL PROTECTED]> wrote: > > On Wed, 27 Feb 2008, Robert Kern apparently wrote: > >> Fixed in r4827. > > > > > On Wed, Feb 27, 2008 at 6:31 PM, Christopher Barker wrote: > >> For the record, this is the fixed version: > >> comment_start =

Re: [Numpy-discussion] ANN: Enthought Python Distribution - Beta

2008-02-27 Thread Alan G Isaac
On Wed, 27 Feb 2008, Travis Vaught apparently wrote: > http://www.enthought.com/epd Looks good. An increasing number of my students are buying Macs, so the OSX support will be very welcome. Cheers, Alan Isaac ___ Numpy-discussion mailing list Numpy-

Re: [Numpy-discussion] Handling of numpy.power(0, )

2008-02-27 Thread Alan G Isaac
On Wed, 27 Feb 2008, Stuart Brorson apparently wrote: > ** 0^0: This is problematic. Accessible discussion: http://en.wikipedia.org/wiki/Exponentiation#Zero_to_the_zero_power> Cheers, Alan Isaac ___ Numpy-discussion mailing list Numpy-discussion@s

Re: [Numpy-discussion] loadtxt broken if file does not end in newline

2008-02-27 Thread Alan G Isaac
> On Wed, 27 Feb 2008, Robert Kern apparently wrote: >> Fixed in r4827. > On Wed, Feb 27, 2008 at 6:31 PM, Christopher Barker wrote: >> For the record, this is the fixed version: >> comment_start = line.find(comments) >> if comment_start > 0: >> line = line[:comments

[Numpy-discussion] ANN: Enthought Python Distribution - Beta

2008-02-27 Thread Travis Vaught
Greetings, Enthought is very excited about our pending wide-release of the Enthought Python Distribution (EPD). After much effort, we finally think we're close to the first non-beta release. As one more quality check, we'd love to impose on you guys one more time to try out a just- minted

Re: [Numpy-discussion] loadtxt broken if file does not end in newline

2008-02-27 Thread Robert Kern
On Wed, Feb 27, 2008 at 6:31 PM, Christopher Barker <[EMAIL PROTECTED]> wrote: > Robert Kern wrote: > > Fixed in r4827. > > Thanks Robert. For the record, this is the fixed version: > > comment_start = line.find(comments) > if comment_start > 0: > line = line[:commen

Re: [Numpy-discussion] Handling of numpy.power(0, )

2008-02-27 Thread Robert Kern
On Wed, Feb 27, 2008 at 5:10 PM, Stuart Brorson <[EMAIL PROTECTED]> wrote: > I have been poking at the limits of NumPy's handling of powers of > zero. I find some results which are disturbing, at least to me. > Here they are: > > In [67]: A = numpy.array([0, 0, 0]) > > In [68]: B = numpy.arra

Re: [Numpy-discussion] loadtxt broken if file does not end in newline

2008-02-27 Thread Christopher Barker
Robert Kern wrote: > Fixed in r4827. Thanks Robert. For the record, this is the fixed version: comment_start = line.find(comments) if comment_start > 0: line = line[:comments_start].strip() else: line = line.strip() Just as a matter of interest

[Numpy-discussion] Handling of numpy.power(0, )

2008-02-27 Thread Stuart Brorson
I have been poking at the limits of NumPy's handling of powers of zero. I find some results which are disturbing, at least to me. Here they are: In [67]: A = numpy.array([0, 0, 0]) In [68]: B = numpy.array([-1, 0, 1+1j]) In [69]: numpy.power(A, B) Out[69]: array([ 0.+0.j, 1.+0.j, 0.+0.j]) I

Re: [Numpy-discussion] loadtxt broken if file does not end in newline

2008-02-27 Thread Robert Kern
On Wed, Feb 27, 2008 at 4:04 PM, Travis E. Oliphant <[EMAIL PROTECTED]> wrote: > Did this discussion resolve with a fix that can go in before 1.0.5 is > released? Fixed in r4827. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible

Re: [Numpy-discussion] loadtxt broken if file does not end in newline

2008-02-27 Thread Travis E. Oliphant
Lisandro Dalcin wrote: > Well, after all that said, I'm also fine with either approach. Anyway, > I would say that my personal preference is for the one using > 'str.index', as it is the simplest one regarding the old code. > > Like Christopher, I rarelly (never?) use 'loadtxt'. But this issue > ma

Re: [Numpy-discussion] loadtxt broken if file does not end in newline

2008-02-27 Thread Lisandro Dalcin
Well, after all that said, I'm also fine with either approach. Anyway, I would say that my personal preference is for the one using 'str.index', as it is the simplest one regarding the old code. Like Christopher, I rarelly (never?) use 'loadtxt'. But this issue made a coworker to get crazy (he is

Re: [Numpy-discussion] loadtxt broken if file does not end in newline

2008-02-27 Thread Christopher Barker
David Huard wrote: > The advantage of using regular expressions is that in this case it gives > you some flexibility that wasn't there before. For instance, if for any > reason there are two type of characters that coexist in the file to mark > comments, using > pattern = re.compile(comments) >

Re: [Numpy-discussion] loadtxt broken if file does not end in newline

2008-02-27 Thread Christopher Barker
Alan Isaac wrote: Use index instead? yup, that'll work. enclosed is another test file, with that and one using string.split(comments) instead. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Wa

Re: [Numpy-discussion] loadtxt broken if file does not end in newline

2008-02-27 Thread Alan Isaac
On Wed, 27 Feb 2008, Christopher Barker wrote: > The issue here is a result of what I consider a wart in python's string > methods -- string.find() returns a valid index( -1 ) when > it fails to find anything. Use index instead? Cheers, Alan Isaac __

Re: [Numpy-discussion] loadtxt broken if file does not end in newline

2008-02-27 Thread David Huard
Hi Christopher, The advantage of using regular expressions is that in this case it gives you some flexibility that wasn't there before. For instance, if for any reason there are two type of characters that coexist in the file to mark comments, using pattern = re.compile(comments) for i,line in en

Re: [Numpy-discussion] loadtxt broken if file does not end in newline

2008-02-27 Thread Christopher Barker
David Huard wrote: Would everyone be satisfied with a solution using regular expressions ? Maybe it's because regular expressions make me itch, but I think it's overkill for this. The issue here is a result of what I consider a wart in python's string methods -- string.find() returns a vali

Re: [Numpy-discussion] loadtxt broken if file does not end in newline

2008-02-27 Thread David Huard
Lisandro, When you have some time, could you check this patch solves your problem (and does not introduce new ones) ? David Index: numpy/lib/io.py === --- numpy/lib/io.py (revision 4824) +++ numpy/lib/io.py (working copy) @

Re: [Numpy-discussion] loadtxt broken if file does not end in newline

2008-02-27 Thread David Huard
I can look at it. Would everyone be satisfied with a solution using regular expressions ? That is, looking for the following pattern: pattern = re.compile(r""" ^\s* # leading white space (.*) # Data %s? # Zero or one comment character (.*) # Comments \s*$ # Trailing white spa

Re: [Numpy-discussion] Trouble With MaskedArray and Shared Masks

2008-02-27 Thread Pierre GM
Alexander, > create the MaskedArray to: > >>> a = numpy.ma.MaskedArray( > > ... data=numpy.zeros((4,5), dtype=float), > ... mask=True, > ... fill_value=0.0 > ... ) By far the easiest indeed. > > So: should we introduce this extra parameter ? > > The propagation semantics and mechan

Re: [Numpy-discussion] A little help please?

2008-02-27 Thread Travis E. Oliphant
Neal Becker wrote: > Travis E. Oliphant wrote: > > > > > The code for this is a bit hard to understand. It does appear that it only > searches for a conversion on the 2nd argument. I don't think that's > desirable behavior. > > What I'm wondering is, this works fine for builtin types. What is

Re: [Numpy-discussion] Trouble With MaskedArray and Shared Masks

2008-02-27 Thread Alexander Michael
On Tue, Feb 26, 2008 at 2:32 PM, Pierre GM <[EMAIL PROTECTED]> wrote: > Alexander, > The rationale behind the current behavior is to avoid an accidental > propagation of the mask. Consider the following example: > > >>>m = numpy.array([1,0,0,1,0], dtype=bool_) > >>>x = numpy.array([1,2,3,4,5])

Re: [Numpy-discussion] Optimize speed of for loop using numpy

2008-02-27 Thread Trond Kristiansen
Hey all. I would just like to thank you all for extremely good feedback on my problem with optimizing loops. Thank you all for being so helpful. Cheers, Trond ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailma

Re: [Numpy-discussion] A little help please?

2008-02-27 Thread Neal Becker
Travis E. Oliphant wrote: > Neal Becker wrote: >> My user-defined type project has mostly gone well, but I'm stuck on >> mixed-type arithmetic. >> >> I have 2 types: cmplx_int32 and cmplx_int64. I have added basic >> arithmetic for those types, and for mix of those arrays and their >> respective