[Numpy-discussion] Unwanted upcast from uint64 to float64

2006-08-30 Thread Torgil Svensson
I'm using windows datetimes (100nano-seconds since 0001,1,1) as time in a numpy array and was hit by this behaviour. >>> numpy.__version__ '1.0b4' >>> a=numpy.array([63292539433000L],numpy.uint64) >>> t=a[0] >>> t 63292539433000L >>> type(t) >>> t+1 6.3292539433e+017 >>> type(t+1) >>> t=

Re: [Numpy-discussion] upcast

2006-08-30 Thread Lars Friedrich
> To answer the original question, you need to use a higher precision > array or explicitly cast it to higher precision. > > In [49]:(a.astype(int)*100)/100 > Out[49]:array([200]) Thank you. This is what I wanted to know. Lars --

Re: [Numpy-discussion] Use of numarray from numpy package [# INC NO 24609]

2006-08-30 Thread Sebastian Haase
Andrew Straw wrote: > LANDRIU David SAp wrote: >> Hello, >> >> I come back to my question : how to use numarray >> with the numpy installation ? >> >> {ccali22}~(0)>setenv PYTHONPATH /usr/local/lib/python2.3/site-packages/numpy >> > Here's where you went wrong. You want: > > setenv P

Re: [Numpy-discussion] amd64 support

2006-08-30 Thread Sebastian Haase
Keith Goodman wrote: > I plan to build an amd64 box and run debian etch. Are there any big, > 64-bit, show-stopping problems in numpy? Any minor annoyances? > I am not aware of any - we use fine on 32bit and 64bit with debian sarge and etch. -Sebastian Haase

Re: [Numpy-discussion] upcast

2006-08-30 Thread Charles R Harris
On 8/30/06, Lars Friedrich <[EMAIL PROTECTED]> wrote: Hello,I would like to discuss the following code:#***start***import numpy as Na = N.array((200), dtype = N.uint8)print (a * 100) / 100b = N.array((200, 200), dtype = N.uint8)print (b * 100) / 100 #***stop***The first print statement will print "

Re: [Numpy-discussion] upcast

2006-08-30 Thread Charles R Harris
On 8/30/06, Lars Friedrich <[EMAIL PROTECTED]> wrote: Hello,I would like to discuss the following code:#***start***import numpy as Na = N.array((200), dtype = N.uint8)print (a * 100) / 100This is actually a scalar, i.e., a zero dimensional array. N.uint8(200) would give you the same thing, because

Re: [Numpy-discussion] Changing Fatal error into ImportError?

2006-08-30 Thread Fernando Perez
On 8/30/06, Robert Kern <[EMAIL PROTECTED]> wrote: > I don't see where we're calling Py_FatalError. The problem might be in Python > or > mwadap. Indeed, import_array() raises a PyExc_ImportError. Sorry for the noise: it looks like this was already fixed: http://projects.scipy.org/scipy/numpy/c

Re: [Numpy-discussion] Changing Fatal error into ImportError?

2006-08-30 Thread Robert Kern
Fernando Perez wrote: > Hi all, > > this was mentioned in the past, but I think it fell through the cracks: > > Python 2.3.4 (#1, Mar 10 2006, 06:12:09) > [GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import mwadap

[Numpy-discussion] Changing Fatal error into ImportError?

2006-08-30 Thread Fernando Perez
Hi all, this was mentioned in the past, but I think it fell through the cracks: Python 2.3.4 (#1, Mar 10 2006, 06:12:09) [GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mwadap Overwriting info= from scipy.misc (wa

Re: [Numpy-discussion] stumped numpy user seeks help

2006-08-30 Thread Bill Baxter
On 8/30/06, Sven Schreiber <[EMAIL PROTECTED]> wrote: > Mathew Yeates schrieb: > will be a numpy matrix, use if you don't like that. But here > it's really nice to work with matrices, because otherwise .sum() will > give you a 1-d array sometimes, and that will suddenly look like a row > to (inst

[Numpy-discussion] (no subject)

2006-08-30 Thread Thilo Wehrmann
Hi, currently I´m trying to compile the latest numpy version (1.0b4) under an SGI IRIX 6.5 environment. I´m using the gcc 3.4.6 compiler and python 2.4.3 (self compiled). During the compilation of numpy.core I get a nasty error message: ... copying build/src.irix64-6.5-2.4/numpy/__config__.py ->

Re: [Numpy-discussion] Interfacing with PIL?

2006-08-30 Thread Christopher Barker
Tim Hochberg wrote: > Johannes Loehnert wrote: >>> I'm somewhat new to both libraries...is there any way to create a 2D >>> array of pixel values from an image object from the Python Image >>> Library? I'd like to do some arithmetic on the values. the latest version of PIL (maybe not released yet)

Re: [Numpy-discussion] Interfacing with PIL?

2006-08-30 Thread Tim Hochberg
Johannes Loehnert wrote: > Am Mittwoch, 30. August 2006 19:20 schrieb Ghalib Suleiman: > >> I'm somewhat new to both libraries...is there any way to create a 2D >> array of pixel values from an image object from the Python Image >> Library? I'd like to do some arithmetic on the values. >> >

Re: [Numpy-discussion] Interfacing with PIL?

2006-08-30 Thread Johannes Loehnert
Am Mittwoch, 30. August 2006 19:20 schrieb Ghalib Suleiman: > I'm somewhat new to both libraries...is there any way to create a 2D > array of pixel values from an image object from the Python Image > Library? I'd like to do some arithmetic on the values. Yes. To transport the data: >>> import num

[Numpy-discussion] Interfacing with PIL?

2006-08-30 Thread Ghalib Suleiman
I'm somewhat new to both libraries...is there any way to create a 2D array of pixel values from an image object from the Python Image Library? I'd like to do some arithmetic on the values. - Using Tomcat but need to do mor

Re: [Numpy-discussion] Use of numarray from numpy package [# INC NO 24609]

2006-08-30 Thread Christopher Barker
Andrew Straw wrote: >> {ccali22}~(0)>setenv PYTHONPATH /usr/local/lib/python2.3/site-packages/numpy >> > Here's where you went wrong. You want: > > setenv PYTHONPATH /usr/local/lib/python2.3/site-packages Which you shouldn't need at all. site-packages should be on sys.path by default. -Chris

[Numpy-discussion] upcast

2006-08-30 Thread Lars Friedrich
Hello, I would like to discuss the following code: #***start*** import numpy as N a = N.array((200), dtype = N.uint8) print (a * 100) / 100 b = N.array((200, 200), dtype = N.uint8) print (b * 100) / 100 #***stop*** The first print statement will print "200" because the uint8-value is cast "upw

Re: [Numpy-discussion] fftfreq very slow; rfftfreq incorrect?

2006-08-30 Thread Stefan van der Walt
On Wed, Aug 30, 2006 at 12:04:22PM +0100, Andrew Jaffe wrote: > the current implementation of fftfreq (which is meant to return the > appropriate frequencies for an FFT) does the following: > > k = range(0,(n-1)/2+1)+range(-(n/2),0) > return array(k,'d')/(n*d) > > I have tried this wit

Re: [Numpy-discussion] Use of numarray from numpy package [# INC NO 24609]

2006-08-30 Thread Andrew Straw
LANDRIU David SAp wrote: > Hello, > > I come back to my question : how to use numarray > with the numpy installation ? > > {ccali22}~(0)>setenv PYTHONPATH /usr/local/lib/python2.3/site-packages/numpy > Here's where you went wrong. You want: setenv PYTHONPATH /usr/local/lib/python2.3/

[Numpy-discussion] amd64 support

2006-08-30 Thread Keith Goodman
I plan to build an amd64 box and run debian etch. Are there any big, 64-bit, show-stopping problems in numpy? Any minor annoyances? - Using Tomcat but need to do more? Need to support web services, security? Get stuff done qui

Re: [Numpy-discussion] possible bug with numpy.object_

2006-08-30 Thread Fernando Perez
On 8/30/06, Stefan van der Walt <[EMAIL PROTECTED]> wrote: > The current behaviour makes sense, but is maybe not consistent: > > N.array([],dtype=object).size == 1 > N.array([[],[]],dtype=object).size == 2 Yes, including one more term in this check: In [5]: N.array([],dtype=object).size Out[5]:

Re: [Numpy-discussion] stumped numpy user seeks help

2006-08-30 Thread Stefan van der Walt
On Tue, Aug 29, 2006 at 03:46:45PM -0700, Mathew Yeates wrote: > My head is about to explode. > > I have an M by N array of floats. Associated with the columns are > character labels > ['a','b','b','c','d','e','e','e'] note: already sorted so duplicates > are contiguous > > I want to replace t

Re: [Numpy-discussion] Use of numarray from numpy package [# INC NO 24609]

2006-08-30 Thread Perry Greenfield
On Aug 30, 2006, at 8:51 AM, LANDRIU David SAp wrote: > Hello, > > I come back to my question : how to use numarray > with the numpy installation ? > If you are using both at the same time, one thing you don't want to do is from numpy import * from numarray import * You can do that with on

Re: [Numpy-discussion] fromiter shape argument -- was Re: For loop tips

2006-08-30 Thread Tim Hochberg
Torgil Svensson wrote: >>return uL,asmatrix(fromiter((idx[x] for x in L),dtype=int)) >> > > Is it possible for fromiter to take an optional shape (or count) > argument in addition to the dtype argument? Yes. fromiter(iterable, dtype, count) works. > If both is given it could > preallocat

Re: [Numpy-discussion] Use of numarray from numpy package

2006-08-30 Thread Joris De Ridder
Hi David, Numeric, numarray and numpy are three different packages that can live independently, but that can also coexist if you like so. If you're new to this packages, you should stick to numpy, as the other ones are getting phased out. It's difficult to see what's going wrong without having se

Re: [Numpy-discussion] Use of numarray from numpy package [# INC NO 24609]

2006-08-30 Thread LANDRIU David SAp
Hello, I come back to my question : how to use numarray with the numpy installation ? After some update in the system there is another error message : >> AttributeError: 'module' object has no attribute 'NewAxis' It seems , from advice of the system manager, that an kind of ali

Re: [Numpy-discussion] stumped numpy user seeks help

2006-08-30 Thread Sven Schreiber
Mathew Yeates schrieb: > My head is about to explode. > > I have an M by N array of floats. Associated with the columns are > character labels > ['a','b','b','c','d','e','e','e'] note: already sorted so duplicates > are contiguous > > I want to replace the 2 'b' columns with the sum of the 2 c

Re: [Numpy-discussion] possible bug with numpy.object_

2006-08-30 Thread Stefan van der Walt
On Tue, Aug 29, 2006 at 10:49:58AM -0600, Travis Oliphant wrote: > Matt Knox wrote: > > is the following behaviour expected? or is this a bug with > > numpy.object_ ? I'm using numpy 1.0b1 > > > > >>> print numpy.array([],numpy.float64).size > > 0 > > > > >>> print numpy.array([],numpy.object_

Re: [Numpy-discussion] fftfreq very slow; rfftfreq incorrect?

2006-08-30 Thread Andrew Jaffe
[copied to the scipy list since rfftfreq is only in scipy] Andrew Jaffe wrote: > Hi all, > > the current implementation of fftfreq (which is meant to return the > appropriate frequencies for an FFT) does the following: > > k = range(0,(n-1)/2+1)+range(-(n/2),0) > return array(k,'d')/(

[Numpy-discussion] fftfreq very slow; rfftfreq incorrect?

2006-08-30 Thread Andrew Jaffe
Hi all, the current implementation of fftfreq (which is meant to return the appropriate frequencies for an FFT) does the following: k = range(0,(n-1)/2+1)+range(-(n/2),0) return array(k,'d')/(n*d) I have tried this with very long (2**24) arrays, and it is ridiculously slow. Should th

[Numpy-discussion] Use of numarray from numpy package

2006-08-30 Thread LANDRIU David SAp
Hello, is it necessary to install numarray separately to use numpy ? Indeed, after numpy installation, when I try to use it in the code, I get the same error as below : .../... Python 2.4.1 (#1, May 13 2005, 13:45:18) [GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-42)] on linux2 Type "help"

Re: [Numpy-discussion] array indexing problem

2006-08-30 Thread Sven Schreiber
Charles R Harris schrieb: > You can get what you expect using matrices: > ... > But generally it is best to just use arrays and get used to the conventions. > Well, there are different views on this subject, and I'm happy that the numpy crew is really trying (and good at it) to make array *and*

Re: [Numpy-discussion] Irregular arrays

2006-08-30 Thread rw679aq02
Travis, A sparse matrix is a different animal serving a different purpose, i.e., solution of linear systems. Those storage formats are geared for that application: upper diagonal, block diagonal, stripwise, etc. To be more specific: here tight numerical arrays are presumably discussed. Python a

Re: [Numpy-discussion] [ANN] NumPy 1.0b4 now available

2006-08-30 Thread bruce.who.hk
Hi, Travis I tried numpy1.0b4 and add this to setup.py includes = ["numpy.core._internal"] then it works! And all scripts can be packed into a single executables with "bundle_files":2, "skip_archive":0, zipfile = None, --skip_archive option is not needed now.