Re: [Numpy-discussion] Error in tanh for large complex argument

2011-01-28 Thread Mark Bakker
I'll file a ticket. Incidentally, if tanh(z) is simply programmed as (1.0 - exp(-2.0*z)) / (1.0 + exp(-2.0*z)) the problem is fixed. Thanks, Mark [clip] Not for large complex values: In [85]: tanh(1000+0j) Out[85]: (nan+nan*j) Yep, it's a bug. Care to file a ticket? The

Re: [Numpy-discussion] Should we make the master branch backward compatible.

2011-01-28 Thread Pauli Virtanen
Thu, 27 Jan 2011 20:46:22 -0700, Charles R Harris wrote: Mark Wiebe has proposed making the master branch backward compatible with 1.5. The argument for doing this is that 1) removing the new bits for new releases is a chore as the refactor schedule slips and 2) the new ABI isn't settled and

Re: [Numpy-discussion] Error in tanh for large complex argument

2011-01-28 Thread Pauli Virtanen
Fri, 28 Jan 2011 11:25:19 +0100, Mark Bakker wrote: I'll file a ticket. Incidentally, if tanh(z) is simply programmed as (1.0 - exp(-2.0*z)) / (1.0 + exp(-2.0*z)) This will overflow as z - -\infty. The solution is probably to use a different expression for Re(z) 0, and to check how other

Re: [Numpy-discussion] Error in tanh for large complex argument

2011-01-28 Thread Mark Bakker
Good point, so we need a better solution that fixes all cases I'll file a ticket. Incidentally, if tanh(z) is simply programmed as (1.0 - exp(-2.0*z)) / (1.0 + exp(-2.0*z)) This will overflow as z - -\infty. The solution is probably to use a different expression for Re(z) 0, and to check

[Numpy-discussion] incorrect behavior when complex number with zero imaginary part is multiplied by inf

2011-01-28 Thread Mark Bakker
When I multiply a complex number with inf, I get inf + inf*j: In [17]: inf * (1+1j) Out[17]: (inf+inf*j) Even when the imaginary part is really small: In [18]: inf * (1+1e-100j) Out[18]: (inf+inf*j) Yet when the imaginary part is zero (and it really is a real number), the imaginary part is

Re: [Numpy-discussion] Generator arrays

2011-01-28 Thread Dag Sverre Seljebotn
On 01/28/2011 01:01 AM, Travis Oliphant wrote: Just to start the conversation, and to find out who is interested, I would like to informally propose generator arrays for NumPy 2.0. This concept has as one use-case, the deferred arrays that Mark Wiebe has proposed. But, it also allows

Re: [Numpy-discussion] Generator arrays

2011-01-28 Thread Dag Sverre Seljebotn
On 01/28/2011 12:37 PM, Dag Sverre Seljebotn wrote: On 01/28/2011 01:01 AM, Travis Oliphant wrote: Just to start the conversation, and to find out who is interested, I would like to informally propose generator arrays for NumPy 2.0. This concept has as one use-case, the deferred

Re: [Numpy-discussion] Error in tanh for large complex argument

2011-01-28 Thread Mark Bakker
Follow up: The behavior is correct for real argument: In [20]: sinh(1000) Out[20]: inf In [21]: cosh(1000) Out[21]: inf In [22]: tanh(1000) Out[22]: 1.0 So maybe we should look there for good logic, Mark On Fri, Jan 28, 2011 at 11:45 AM, Mark Bakker mark...@gmail.com wrote: Good point, so

Re: [Numpy-discussion] Error in tanh for large complex argument

2011-01-28 Thread Pauli Virtanen
Fri, 28 Jan 2011 12:57:18 +0100, Mark Bakker wrote: Follow up: The behavior is correct for real argument: [clip] So maybe we should look there for good logic, In the real case you can do if (abs(z) cutoff) return sgn(z), which is not the right thing to do for complex numbers. Anyway,

Re: [Numpy-discussion] Numpy 2.0 schedule

2011-01-28 Thread Ralf Gommers
On Fri, Jan 28, 2011 at 1:36 AM, Charles R Harris charlesr.har...@gmail.com wrote: On Thu, Jan 27, 2011 at 9:17 AM, Mark Wiebe mwwi...@gmail.com wrote: On Thu, Jan 27, 2011 at 7:09 AM, Ralf Gommers ralf.gomm...@googlemail.com wrote: snip The PIL test can still be fixed before the final

Re: [Numpy-discussion] Developer NumPy list versus User NumPy list

2011-01-28 Thread James A. Bednar
| Date: Thu, 27 Jan 2011 16:32:22 -0700 | From: Charles R Harris charlesr.har...@gmail.com | | On Thu, Jan 27, 2011 at 4:23 PM, Robert Kern robert.k...@gmail.com wrote: | | On Thu, Jan 27, 2011 at 17:17, Travis Oliphant teoliph...@gmail.com wrote: | |Hey all, | |What is the

Re: [Numpy-discussion] Developer NumPy list versus User NumPy list

2011-01-28 Thread josef . pktd
On Fri, Jan 28, 2011 at 8:29 AM, James A. Bednar jbed...@inf.ed.ac.uk wrote: |  Date: Thu, 27 Jan 2011 16:32:22 -0700 |  From: Charles R Harris charlesr.har...@gmail.com | |  On Thu, Jan 27, 2011 at 4:23 PM, Robert Kern robert.k...@gmail.com wrote: | |   On Thu, Jan 27, 2011 at 17:17, Travis

[Numpy-discussion] create a numpy array of images

2011-01-28 Thread Asmi Shah
Hi guys, I am using python for a while now and I have a requirement of creating a numpy array of microscopic tiff images ( this data is 3d, meaning there are 100 z slices of 512 X 512 pixels.) How can I create an array of images? i then would like to use visvis for visualizing this in 3D. any

Re: [Numpy-discussion] Should we make the master branch backward compatible.

2011-01-28 Thread Bruce Southey
On 01/27/2011 10:58 PM, David Cournapeau wrote: On Fri, Jan 28, 2011 at 12:46 PM, Charles R Harris charlesr.har...@gmail.com wrote: Hi All, Mark Wiebe has proposed making the master branch backward compatible with 1.5. The argument for doing this is that 1) removing the new bits for new

Re: [Numpy-discussion] incorrect behavior when complex number with zero imaginary part is multiplied by inf

2011-01-28 Thread Pauli Virtanen
Fri, 28 Jan 2011 11:49:34 +0100, Mark Bakker wrote: [clip] Yet when the imaginary part is zero (and it really is a real number), the imaginary part is nan: In [19]: inf * (1+0j) Out[19]: (inf+nan*j) That is not correct. It should really given (inf+0*j). (I know where it comes from, inf*0

Re: [Numpy-discussion] Generator arrays

2011-01-28 Thread Lluís
Travis Oliphant writes: This concept has as one use-case, the deferred arrays that Mark Wiebe has proposed. Interesting, I didn't read about that. In fact, I was playing around with a proxy wrapper for ndarrays not long ago, in order to build a tree of deferred operations that can be later

[Numpy-discussion] Strange behaviour of numpy.asarray() in corner case

2011-01-28 Thread Friedrich Romstedt
Python 2.6.6 (r266:84374, Aug 31 2010, 11:00:51) [GCC 4.0.1 (Apple Inc. build 5493)] on darwin Type help, copyright, credits or license for more information. import numpy numpy.__version__ '1.5.1' class X: ... pass ... numpy.asarray([X(), numpy.asarray([1, 1])]).shape (2,)

Re: [Numpy-discussion] Error in tanh for large complex argument

2011-01-28 Thread Nadav Horesh
A brief history: I wrote the asinh and acosh functions for the math (or was it cmath?) for python 2.0. It fixed some problems of GVR implementation, but still it was far from perfect, and replaced shortly after. My 1/4 cent tip: Do not rush --- find a good code. Nadav

Re: [Numpy-discussion] create a numpy array of images

2011-01-28 Thread Christopher Barker
On 1/28/11 7:01 AM, Asmi Shah wrote: I am using python for a while now and I have a requirement of creating a numpy array of microscopic tiff images ( this data is 3d, meaning there are 100 z slices of 512 X 512 pixels.) How can I create an array of images? It's quite straightforward to create

[Numpy-discussion] SWIG examples from the Cookbook

2011-01-28 Thread kant erburiad
Hi, I'd like to ask for your help regarding the use of SWIG with numpy. ** problem description ** While I can compile successfully the examples provided in ./numpy/doc/swig I can't compile the first example provided in the Cookbook. http://www.scipy.org/Cookbook/SWIG_NumPy_examples A simple

Re: [Numpy-discussion] Generator arrays

2011-01-28 Thread Travis Oliphant
Thanks for the long email. I think there are a lot of thoughts around some of these ideas and it is good to get as many of them articulated as possible. I learn much from these kinds of discussions.I think others value them as well. I like your ideas about what kind of overloading

Re: [Numpy-discussion] Generator arrays

2011-01-28 Thread Mark Wiebe
On Fri, Jan 28, 2011 at 1:18 PM, Travis Oliphant oliph...@enthought.comwrote: Just to start the conversation, and to find out who is interested, I would like to informally propose generator arrays for NumPy 2.0. This concept has as one use-case, the deferred arrays that Mark Wiebe has

Re: [Numpy-discussion] Should we make the master branch backward compatible.

2011-01-28 Thread Mark Wiebe
Does anyone have any objections to me merging the branch into the numpy trunk right now? Chuck suggested I try to split out the ABI changes, but they're kind of tangled with the other changes. In particular, they involve fixing the type promotion code to be enum order-independent, which depended

Re: [Numpy-discussion] Should we make the master branch backward compatible.

2011-01-28 Thread Charles R Harris
On Fri, Jan 28, 2011 at 4:37 PM, Mark Wiebe mwwi...@gmail.com wrote: Does anyone have any objections to me merging the branch into the numpy trunk right now? Chuck suggested I try to split out the ABI changes, but they're kind of tangled with the other changes. In particular, they involve

Re: [Numpy-discussion] Should we make the master branch backward compatible.

2011-01-28 Thread Mark Wiebe
On Fri, Jan 28, 2011 at 4:14 PM, Charles R Harris charlesr.har...@gmail.com wrote: snip Go ahead and merge it in and we'll see how it goes. I did the merge, and tried to trigger the buildbot, but it looks like a github svn issue has reared its head: