Re: [Numpy-discussion] Formatting uint64 number

2009-11-01 Thread Charles R Harris
On Sun, Nov 1, 2009 at 8:37 PM, Thomas Robitaille thomas.robitai...@gmail.com wrote: Hello, I have a question concerning uint64 numbers - let's say I want to format a uint64 number that is 2**31, at the moment it's necessary to wrap the numpy number inside long before formatting In [3]:

Re: [Numpy-discussion] Ignorance question

2009-11-01 Thread Charles R Harris
On Sun, Nov 1, 2009 at 7:26 PM, josef.p...@gmail.com wrote: On Sun, Nov 1, 2009 at 9:58 PM, David Goldsmith d.l.goldsm...@gmail.com wrote: I Googled scipy brownian and the top hit was the doc for numpy.random.wald, but said doc has a tone that suggests there are more sophisticated ways

[Numpy-discussion] November 6 EPD Webinar: How do I... use Envisage for GUIs?

2009-11-01 Thread Amenity Applewhite
Having trouble viewing this email? Click here Friday, November 6: How do I... use Envisage for GUIs? Dear Leah, Envisage is a Python-based framework for building extensible applications. The Envisage Core and corresponding Envisage Plugins are components of the Enthought Tool Suite. We've

[Numpy-discussion] Single view on multiple arrays

2009-11-01 Thread Bill Blinn
What is the best way to create a view that is composed of sections of many different arrays? For example, imagine I had a = np.array(range(0, 12)).reshape(3, 4) b = np.array(range(12, 24)).reshape(3, 4) c = np.array(range(24, 36)).reshape(3, 4) v = multiview((3, 4)) #the idea of the following

Re: [Numpy-discussion] Single view on multiple arrays

2009-11-01 Thread Anne Archibald
2009/11/1 Bill Blinn bbl...@gmail.com: What is the best way to create a view that is composed of sections of many different arrays? The short answer is, you can't. Numpy arrays must be located contiguous blocks of memory, and the elements along any dimension must be equally spaced. A view is

Re: [Numpy-discussion] Single view on multiple arrays

2009-11-01 Thread Sturla Molden
Anne Archibald skrev: The short answer is, you can't. Not really true. It is possible create an array (sub)class that stores memory addresses (pointers) instead of values. It is doable, but I am not wasting my time implementing it. Sturla ___

Re: [Numpy-discussion] Single view on multiple arrays

2009-11-01 Thread Sturla Molden
Bill Blinn skrev: v = multiview((3, 4)) #the idea of the following lines is that the 0th row of v is #a view on the first row of a. the same would hold true for #the 1st and 2nd row of v and the 0th rows of b and c, respectively v[0] = a[0] This would not even work, becuase a[0] does not

[Numpy-discussion] Random int64 and float64 numbers

2009-11-01 Thread Thomas Robitaille
Hi, I'm trying to generate random 64-bit integer values for integers and floats using Numpy, within the entire range of valid values for that type. To generate random 32-bit floats, I can use: np.random.uniform(low=np.finfo(np.float32).min,high=np.finfo (np.float32).max,size=10) which

[Numpy-discussion] Ignorance question

2009-11-01 Thread David Goldsmith
I Googled scipy brownian and the top hit was the doc for numpy.random.wald, but said doc has a tone that suggests there are more sophisticated ways to generate a random Brownian signal? Or is wald indeed SotA? Thanks! DG ___ NumPy-Discussion mailing

[Numpy-discussion] odd behaviour with basic operations

2009-11-01 Thread Benjamin Deschamps
I am getting strange behaviour with the following code: Pd = ((numpy.sign(C_02) == 1) * Pd_pos) + ((numpy.sign(C_02) == -1) * Pd_neg) Ps = ((numpy.sign(C_02) == 1) * Ps_pos) + ((numpy.sign(C_02) == -1) * Ps_neg) where Pd, Ps, C_02, Pd_pos, Pd_neg, Ps_pos and Ps_neg are all Float32 numpy

Re: [Numpy-discussion] odd behaviour with basic operations

2009-11-01 Thread Robert Kern
On Sun, Nov 1, 2009 at 21:09, Benjamin Deschamps bdesc...@gmail.com wrote: I am getting strange behaviour with the following code: Pd = ((numpy.sign(C_02) == 1) * Pd_pos) + ((numpy.sign(C_02) == -1) * Pd_neg) Ps = ((numpy.sign(C_02) == 1) * Ps_pos) + ((numpy.sign(C_02) == -1) * Ps_neg) where

Re: [Numpy-discussion] Ignorance question

2009-11-01 Thread josef . pktd
On Sun, Nov 1, 2009 at 9:58 PM, David Goldsmith d.l.goldsm...@gmail.com wrote: I Googled scipy brownian and the top hit was the doc for numpy.random.wald, but said doc has a tone that suggests there are more sophisticated ways to generate a random Brownian signal? Or is wald indeed SotA? 

Re: [Numpy-discussion] Ignorance question

2009-11-01 Thread josef . pktd
On Sun, Nov 1, 2009 at 10:26 PM, josef.p...@gmail.com wrote: On Sun, Nov 1, 2009 at 9:58 PM, David Goldsmith d.l.goldsm...@gmail.com wrote: I Googled scipy brownian and the top hit was the doc for numpy.random.wald, but said doc has a tone that suggests there are more sophisticated ways to

Re: [Numpy-discussion] Ignorance question

2009-11-01 Thread Robert Kern
On Sun, Nov 1, 2009 at 21:27, josef.p...@gmail.com wrote: On Sun, Nov 1, 2009 at 10:26 PM,  josef.p...@gmail.com wrote: On Sun, Nov 1, 2009 at 9:58 PM, David Goldsmith d.l.goldsm...@gmail.com wrote: I Googled scipy brownian and the top hit was the doc for numpy.random.wald, but said doc has

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-01 Thread Sturla Molden
Thomas Robitaille skrev: np.random.random_integers(np.iinfo(np.int32).min,high=np.iinfo (np.int32).max,size=10) which gives array([-1506183689, 662982379, -1616890435, -1519456789, 1489753527, -604311122, 2034533014, 449680073, -444302414, -1924170329]) This fails

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-01 Thread David Cournapeau
Thomas Robitaille wrote: Hi, I'm trying to generate random 64-bit integer values for integers and floats using Numpy, within the entire range of valid values for that type. To generate random 32-bit floats, I can use: np.random.uniform(low=np.finfo(np.float32).min,high=np.finfo

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-01 Thread josef . pktd
On Sun, Nov 1, 2009 at 10:20 PM, David Cournapeau da...@ar.media.kyoto-u.ac.jp wrote: Thomas Robitaille wrote: Hi, I'm trying to generate random 64-bit integer values for integers and floats using Numpy, within the entire range of valid values for that type. To generate random 32-bit floats,

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-01 Thread Robert Kern
On Sun, Nov 1, 2009 at 20:57, Thomas Robitaille thomas.robitai...@gmail.com wrote: Hi, I'm trying to generate random 64-bit integer values for integers and floats using Numpy, within the entire range of valid values for that type. 64-bit and larger integers could be done, but it requires

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-01 Thread David Cournapeau
josef.p...@gmail.com wrote: array([ Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf]) might actually be the right answer if you want a uniform distribution on the real line. Does it make sense to define a uniform random variable whose range is the extended real line ? It would not

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-01 Thread Sturla Molden
Robert Kern skrev: 64-bit and larger integers could be done, but it requires modification. The integer distributions were written to support C longs, not anything larger. You could also use .bytes() and np.fromstring(). But as of Python 2.6.4, even 32-bit integers fail, at least on

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-01 Thread Robert Kern
On Sun, Nov 1, 2009 at 22:17, Sturla Molden stu...@molden.no wrote: Robert Kern skrev: 64-bit and larger integers could be done, but it requires modification. The integer distributions were written to support C longs, not anything larger. You could also use .bytes() and np.fromstring(). But

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-01 Thread David Cournapeau
Sturla Molden wrote: Robert Kern skrev: 64-bit and larger integers could be done, but it requires modification. The integer distributions were written to support C longs, not anything larger. You could also use .bytes() and np.fromstring(). But as of Python 2.6.4, even 32-bit

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-01 Thread Sturla Molden
Robert Kern skrev: Then let me clarify: it was written to support integer ranges up to sys.maxint. Absolutely, it would be desirable to extend it. I know, but look at this: import sys sys.maxint 2147483647 2**31-1 2147483647L sys.maxint becomes a long, which is what confuses mtrand.

[Numpy-discussion] Formatting uint64 number

2009-11-01 Thread Thomas Robitaille
Hello, I have a question concerning uint64 numbers - let's say I want to format a uint64 number that is 2**31, at the moment it's necessary to wrap the numpy number inside long before formatting In [3]: %40i % np.uint64(2**64-1) Out[3]: ' -1' In [4]:

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-01 Thread josef . pktd
On Sun, Nov 1, 2009 at 10:55 PM, David Cournapeau da...@ar.media.kyoto-u.ac.jp wrote: josef.p...@gmail.com wrote: array([ Inf,  Inf,  Inf,  Inf,  Inf,  Inf,  Inf,  Inf,  Inf,  Inf]) might actually be the right answer if you want a uniform distribution on the real line. Does it make sense

Re: [Numpy-discussion] odd behaviour with basic operations

2009-11-01 Thread Benjamin Deschamps
Seems like this was a rookie mistake with code later in the function. Thanks for suggesting the use of numpy.where, that is a much better function for the purpose. Benjamin ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-01 Thread Sturla Molden
Robert Kern skrev: Then let me clarify: it was written to support integer ranges up to sys.maxint. Absolutely, it would be desirable to extend it. Actually it only supports integers up to sys.maxint-1, as random_integers call randint. random_integers includes the upper range, but randint

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-01 Thread Sturla Molden
Sturla Molden skrev: Robert Kern skrev: Then let me clarify: it was written to support integer ranges up to sys.maxint. Absolutely, it would be desirable to extend it. Actually it only supports integers up to sys.maxint-1, as random_integers call randint. random_integers

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-01 Thread Robert Kern
On Sun, Nov 1, 2009 at 23:14, Sturla Molden stu...@molden.no wrote: I'll call this a bug. Yes. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. --

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-01 Thread David Cournapeau
josef.p...@gmail.com wrote: No, it wouldn't be a proper distribution. However in Bayesian analysis it is used as an improper (diffuse) prior Ah, right - I wonder how this is handled rigorously, though. I know some basics of Bayesian statistics, but I don't much about Bayesian statistics from a

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-01 Thread David Cournapeau
Sturla Molden wrote: Sturla Molden skrev: Robert Kern skrev: Then let me clarify: it was written to support integer ranges up to sys.maxint. Absolutely, it would be desirable to extend it. Actually it only supports integers up to sys.maxint-1, as