Re: [Numpy-discussion] histogram using decending range -- what do the results mean?

2007-10-05 Thread Stuart Brorson
>> OK. I don't know if you have a patch tracking system, so I'll just >> post it here. If you have a patch tracker, point me to it and I'll >> enter the patch there. > > http://projects.scipy.org/scipy/numpy OK, entered as ticket #586. Cheers, Stuart ___

Re: [Numpy-discussion] histogram using decending range -- what do the results mean?

2007-10-05 Thread Robert Kern
Stuart Brorson wrote: > Robert, > > Thanks for your answers about histogram's meaning for range=(7, 0)! > >>> * If it truely isn't meaningful, why not catch the case and reject >>> input? Maybe this is a bug ??? >> Patches are welcome. > > OK. I don't know if you have a patch tracking sy

Re: [Numpy-discussion] histogram using decending range -- what do the results mean?

2007-10-05 Thread Stuart Brorson
Robert, Thanks for your answers about histogram's meaning for range=(7, 0)! >> * If it truely isn't meaningful, why not catch the case and reject >> input? Maybe this is a bug ??? > > Patches are welcome. OK. I don't know if you have a patch tracking system, so I'll just post it here. I

[Numpy-discussion] Python Magazine

2007-10-05 Thread Christopher Barker
Hey folks, There is a new Python Magazine out there: http://www.pythonmagazine.com/ Let's get a numpy article in there! NOTE: I have nothing to do with the production of the magazine, I'd just like to have it be a success so I can read it. -- Christopher Barker, Ph.D. Oceanographer Emergen

Re: [Numpy-discussion] histogram using decending range -- what do the results mean?

2007-10-05 Thread Mark.Miller
My bad...I also note that I forgot to decrement the descending list in my example. Ignore Robert Kern wrote: > Mark.Miller wrote: >> Check how you're implementing the histogram function with respect to >> that range statement. It seems to make a difference, desirable or not. >> >> >>> imp

Re: [Numpy-discussion] histogram using decending range -- what do the results mean?

2007-10-05 Thread Robert Kern
Mark.Miller wrote: > Check how you're implementing the histogram function with respect to > that range statement. It seems to make a difference, desirable or not. > > >>> import numpy > >>> numpy.__version__ > '1.0.4.dev3982' > >>> A = numpy.array([1, 2, 3, 4, 5, 6, 5, 4, 5, 4, 3, 2, 1]) > >

Re: [Numpy-discussion] histogram using decending range -- what do the results mean?

2007-10-05 Thread Mark.Miller
Check how you're implementing the histogram function with respect to that range statement. It seems to make a difference, desirable or not. >>> import numpy >>> numpy.__version__ '1.0.4.dev3982' >>> A = numpy.array([1, 2, 3, 4, 5, 6, 5, 4, 5, 4, 3, 2, 1]) >>> (x, y) = numpy.histogram(A, rang

Re: [Numpy-discussion] histogram using decending range -- what do the results mean?

2007-10-05 Thread Robert Kern
Stuart Brorson wrote: > Guys -- > > I'm a little puzzled by a NumPy behavior. Perhaps the gurus on this > list can enlighten me, please! > > I am working with numpy.histogram. I have a decent understanding of > how it works when given an ascending range to bin into. However, when > I give it a

[Numpy-discussion] bug in vectorize? (was: Re: Casting a float array into a string array)

2007-10-05 Thread Anne Archibald
On 05/10/2007, Christopher Barker <[EMAIL PROTECTED]> wrote: > I don't know how to generalize this to n-d though -- maybe numpy.vectorize? Oops! Looks like there's a big somewhere: In [1]: from numpy import * In [2]: vectorize(lambda x: "%5.3g" % x)(ones((2,2,2))) Out[2]: array([[[' ', '\xc1'],

[Numpy-discussion] histogram using decending range -- what do the results mean?

2007-10-05 Thread Stuart Brorson
Guys -- I'm a little puzzled by a NumPy behavior. Perhaps the gurus on this list can enlighten me, please! I am working with numpy.histogram. I have a decent understanding of how it works when given an ascending range to bin into. However, when I give it a *decending* range, I can't figure out

Re: [Numpy-discussion] Casting a float array into a string array

2007-10-05 Thread Christopher Barker
Matthieu Brucher wrote: > And if there is a way to add a > formatting option ('1.1f' for instance), it would be > even better. For full control of the formatting, you can use python's string formatting, and a nested list comprehension: [ ["%.3f"%i

Re: [Numpy-discussion] howto convert float array to array of integers

2007-10-05 Thread Alan Isaac
On Fri, 05 Oct 2007, dmitrey wrote: > I have an array like array([ 1., 0., 2., -10.]) > what is most efficient (i.e. fastest) way to convert the one to array of > integers? > array([ 1, 0, 2, -10]) Use ``astype``. Cheers, Alan Isaac >>> import numpy as N >>> x = N.array([1,2,3],dtype='

Re: [Numpy-discussion] adding field to rec array

2007-10-05 Thread Robert Kern
John Hunter wrote: > On 9/26/07, Robert Kern <[EMAIL PROTECTED]> wrote: > >> Here is the straightforward way: >> >> In [15]: import numpy as np >> >> In [16]: dt = np.dtype([('foo', int), ('bar', float)]) >> >> In [17]: r = np.zeros((3,3), dtype=dt) > > Here is a (hopefully) simple question. If

Re: [Numpy-discussion] adding field to rec array

2007-10-05 Thread Barry Wark
Try r = r.view(numpy.recarray) barry On 10/5/07, John Hunter <[EMAIL PROTECTED]> wrote: > On 9/26/07, Robert Kern <[EMAIL PROTECTED]> wrote: > > > Here is the straightforward way: > > > > In [15]: import numpy as np > > > > In [16]: dt = np.dtype([('foo', int), ('bar', float)]) > > > > In [17]:

Re: [Numpy-discussion] adding field to rec array

2007-10-05 Thread John Hunter
On 9/26/07, Robert Kern <[EMAIL PROTECTED]> wrote: > Here is the straightforward way: > > In [15]: import numpy as np > > In [16]: dt = np.dtype([('foo', int), ('bar', float)]) > > In [17]: r = np.zeros((3,3), dtype=dt) Here is a (hopefully) simple question. If I create an array like this, how c

Re: [Numpy-discussion] More complex data types

2007-10-05 Thread Charles R Harris
On 10/5/07, Neal Becker <[EMAIL PROTECTED]> wrote: > > Charles R Harris wrote: > > > On 10/5/07, Neal Becker <[EMAIL PROTECTED]> wrote: > >> > >> Charles R Harris wrote: > >> > >> > On 10/5/07, Neal Becker <[EMAIL PROTECTED]> wrote: > >> >> > >> >> I'm thinking (again) about using numpy for signal

Re: [Numpy-discussion] More complex data types

2007-10-05 Thread Neal Becker
Charles R Harris wrote: > On 10/5/07, Neal Becker <[EMAIL PROTECTED]> wrote: >> >> Charles R Harris wrote: >> >> > On 10/5/07, Neal Becker <[EMAIL PROTECTED]> wrote: >> >> >> >> I'm thinking (again) about using numpy for signal processing >> >> applications. One issue is that there are more data t

Re: [Numpy-discussion] More complex data types

2007-10-05 Thread Charles R Harris
On 10/5/07, Neal Becker <[EMAIL PROTECTED]> wrote: > > Charles R Harris wrote: > > > On 10/5/07, Neal Becker <[EMAIL PROTECTED]> wrote: > >> > >> I'm thinking (again) about using numpy for signal processing > >> applications. One issue is that there are more data types that are > >> commonly used i

Re: [Numpy-discussion] Numpy-discussion Digest, Vol 13, Issue 11

2007-10-05 Thread Vincent Broman
On Friday, 05 October 2007, Neal Becker wrote: > I'm thinking (again) about using numpy for signal processing applications. > One issue is that there are more data types that are commonly used in > signal processing that are not available in numpy (or python). > Specifically, it is frequently req

Re: [Numpy-discussion] More complex data types

2007-10-05 Thread Neal Becker
Charles R Harris wrote: > On 10/5/07, Neal Becker <[EMAIL PROTECTED]> wrote: >> >> I'm thinking (again) about using numpy for signal processing >> applications. One issue is that there are more data types that are >> commonly used in signal processing that are not available in numpy (or >> python)

Re: [Numpy-discussion] ERROR in installation of NumPy

2007-10-05 Thread Simone Marras
Hi Gael, I will ask the guy who installed the system yesterday, so that I hope he can fix it on monday without me having to re-install all the libraries I installed already Thanks a lot for the help All the best Simone Gael Varoquaux wrote: > On Fri, Oct 05, 2007 at 05:35:46PM +0200, Simone Ma

Re: [Numpy-discussion] ERROR in installation of NumPy

2007-10-05 Thread Gael Varoquaux
On Fri, Oct 05, 2007 at 05:35:46PM +0200, Simone Marras wrote: >[EMAIL PROTECTED]:/home> df -h >FilesystemSize Used Avail Use% Mounted on >/dev/sda2 7.4G 7.0G 14M 100% / >udev 506M 112K 506M 1% /dev >/dev/sda6 69G 1

Re: [Numpy-discussion] ERROR in installation of NumPy

2007-10-05 Thread Simone Marras
Hi there, here the output, thanks [EMAIL PROTECTED]:/home> df -h FilesystemSize Used Avail Use% Mounted on /dev/sda2 7.4G 7.0G 14M 100% / udev 506M 112K 506M 1% /dev /dev/sda6 69G 14G 52G 22% /home /dev/sdb1 459G 295G

Re: [Numpy-discussion] ERROR in installation of NumPy

2007-10-05 Thread Gael Varoquaux
On Fri, Oct 05, 2007 at 05:11:25PM +0200, Simone Marras wrote: >thanks a lot for replying. Look, actually my machine is bare new, so I >dont understand why my /tmp gets full for every small operation I do. Now >I couldnt even send out an email. do you know what this problem could be? L

Re: [Numpy-discussion] ERROR in installation of NumPy

2007-10-05 Thread Simone Marras
Hi Emanuele, thanks a lot for replying. Look, actually my machine is bare new, so I dont understand why my /tmp gets full for every small operation I do. Now I couldnt even send out an email. do you know what this problem could be? Thank you, All the best Simone Emanuele Olivetti wrote: > Simo

Re: [Numpy-discussion] More complex data types

2007-10-05 Thread Charles R Harris
On 10/5/07, Neal Becker <[EMAIL PROTECTED]> wrote: > > I'm thinking (again) about using numpy for signal processing applications. > One issue is that there are more data types that are commonly used in > signal processing that are not available in numpy (or python). > Specifically, it is frequently

Re: [Numpy-discussion] Casting a float array into a string array

2007-10-05 Thread Matthieu Brucher
Thank you for the precision, I didn't thought of using 'Sxx' directly :( Matthieu 2007/10/5, lorenzo bolla <[EMAIL PROTECTED]>: > > gotcha. specify the number of bytes, then. > > In [20]: x > Out[20]: > array([[-2., 3.], >[ 4., 5.]]) > > In [21]: x.astype(numpy.dtype('S10')) > Out[21]:

Re: [Numpy-discussion] ERROR in installation of NumPy

2007-10-05 Thread Emanuele Olivetti
Simone Marras wrote: > Hello everyone, > > I am trying to install numpy on my Suse 10.2 using Python 2.5 > Python is correctly installed and when I launch > python setup.py > install, I get the following error: > > numpy/core/src/multiarraymodule.c:7604: fatal error: error writing > to /tmp/ccN

Re: [Numpy-discussion] Casting a float array into a string array

2007-10-05 Thread lorenzo bolla
gotcha. specify the number of bytes, then. In [20]: x Out[20]: array([[-2., 3.], [ 4., 5.]]) In [21]: x.astype(numpy.dtype('S10')) Out[21]: array([['-2.0', '3.0'], ['4.0', '5.0']], dtype='|S10') L. On 10/5/07, Matthieu Brucher <[EMAIL PROTECTED]> wrote: > > I'd like to hav

Re: [Numpy-discussion] Casting a float array into a string array

2007-10-05 Thread Anne Archibald
On 05/10/2007, Matthieu Brucher <[EMAIL PROTECTED]> wrote: > I'd like to have the '2.', because if the number is negative, only '-' is > returned, not the real value. For string arrays you need to specify the length of the string as part of the data type (and it defaults to length 1): In [11]: ra

[Numpy-discussion] ERROR in installation of NumPy

2007-10-05 Thread Simone Marras
Hello everyone, I am trying to install numpy on my Suse 10.2 using Python 2.5 Python is correctly installed and when I launch > python setup.py install, I get the following error: numpy/core/src/multiarraymodule.c:7604: fatal error: error writing to /tmp/ccNImg9Q.s: No space left on devicetee

Re: [Numpy-discussion] Casting a float array into a string array

2007-10-05 Thread Matthieu Brucher
I'd like to have the '2.', because if the number is negative, only '-' is returned, not the real value. Matthieu 2007/10/5, lorenzo bolla <[EMAIL PROTECTED]>: > > what's wrong with astype? > > In [3]: x = numpy.array([[2.,3.],[4.,5.]]) > > In [4]: x.astype(str) > Out[4]: > array([['2', '3'], >

[Numpy-discussion] More complex data types

2007-10-05 Thread Neal Becker
I'm thinking (again) about using numpy for signal processing applications. One issue is that there are more data types that are commonly used in signal processing that are not available in numpy (or python). Specifically, it is frequently required to convert floating point algorithms into integer

Re: [Numpy-discussion] Casting a float array into a string array

2007-10-05 Thread lorenzo bolla
what's wrong with astype? In [3]: x = numpy.array([[2.,3.],[4.,5.]]) In [4]: x.astype(str) Out[4]: array([['2', '3'], ['4', '5']], dtype='|S1') and if you want a list: In [5]: x.astype(str).tolist() Out[5]: [['2', '3'], ['4', '5']] L. On 10/5/07, Matthieu Brucher <[EMAIL PROTEC

Re: [Numpy-discussion] howto convert float array to array of integers

2007-10-05 Thread lorenzo bolla
what about astype? a.astype(t) -> Copy of array cast to type t. Cast array m to type t. t can be either a string representing a typecode, or a python type object of type int, float, or complex. L. On 10/5/07, dmitrey <[EMAIL PROTECTED]> wrote: > > hi all, > I have an array like > arra

Re: [Numpy-discussion] howto convert float array to array of integers

2007-10-05 Thread Christopher Hanley
I usually use the astype method. >>> import numpy as n >>> a = n.array([1.,0.,2.,-10.]) >>> a.dtype dtype('float64') >>> print a [ 1. 0. 2. -10.] >>> b = a.astype(n.integer) >>> b.dtype dtype('int32') >>> print b [ 1 0 2 -10] dmitrey wrote: > hi all, > I have an array like > arr

[Numpy-discussion] howto convert float array to array of integers

2007-10-05 Thread dmitrey
hi all, I have an array like array([ 1., 0., 2., -10.]) what is most efficient (i.e. fastest) way to convert the one to array of integers? array([ 1, 0, 2, -10]) Thx in advance, D. ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http:

[Numpy-discussion] Casting a float array into a string array

2007-10-05 Thread Matthieu Brucher
Hi, I'm trying to cast a float array into a string array (for instance transforming [[2., 3.], [4., 5.]] into [['2.', '3.'], ['4.', '5.']]), I tried with astype(str) and every variation (str_, string, string_, string0), but not luck. Is there a function or a method of the array class that can fulf