Re: [Numpy-discussion] datetime uses API deprecated in python3.1

2010-02-22 Thread Charles R Harris
On Mon, Feb 22, 2010 at 2:06 PM, Pauli Virtanen wrote: > ma, 2010-02-22 kello 14:01 -0700, Charles R Harris kirjoitti: > > On Mon, Feb 22, 2010 at 1:58 PM, Robert Kern > > wrote: > [clip] > > > Why? PyCObjects don't serialize at all. They would never show up in > > > a pickle to begin with. > >

Re: [Numpy-discussion] int-ifying a float array

2010-02-22 Thread David Goldsmith
Thanks, both, I knew there had to be a better way. :-) DG On Mon, Feb 22, 2010 at 7:58 PM, Warren Weckesser < warren.weckes...@enthought.com> wrote: > Here's another way, using 'astype': > > In [1]: import numpy as np > > In [2]: x = np.array([1.0, 2.0, 3.0]) > > In [3]: y = x.astype(int) > > In

Re: [Numpy-discussion] int-ifying a float array

2010-02-22 Thread Warren Weckesser
Here's another way, using 'astype': In [1]: import numpy as np In [2]: x = np.array([1.0, 2.0, 3.0]) In [3]: y = x.astype(int) In [4]: y Out[4]: array([1, 2, 3]) Warren David Goldsmith wrote: > Hi! Is there a less cumbersome way (e.g., one that has a "cast-like" > syntax and/or leverages

Re: [Numpy-discussion] int-ifying a float array

2010-02-22 Thread Robert Kern
On Mon, Feb 22, 2010 at 21:56, David Goldsmith wrote: > Hi!  Is there a less cumbersome way (e.g., one that has a "cast-like" syntax > and/or leverages broadcasting) than what follows to convert an array of > floats to an array of ints?  Here's what works: > import numpy as N t = N.array

[Numpy-discussion] int-ifying a float array

2010-02-22 Thread David Goldsmith
Hi! Is there a less cumbersome way (e.g., one that has a "cast-like" syntax and/or leverages broadcasting) than what follows to convert an array of floats to an array of ints? Here's what works: >>> import numpy as N >>> t = N.array([0.0, 1.0]); t.dtype dtype('float64') >>> t = N.array(t, dtype=

Re: [Numpy-discussion] datetime uses API deprecated in python3.1

2010-02-22 Thread Pauli Virtanen
ma, 2010-02-22 kello 14:01 -0700, Charles R Harris kirjoitti: > On Mon, Feb 22, 2010 at 1:58 PM, Robert Kern > wrote: [clip] > > Why? PyCObjects don't serialize at all. They would never show up in > > a pickle to begin with. > > So what happens to them? I'm not that familiar with pickles arrayde

Re: [Numpy-discussion] datetime uses API deprecated in python3.1

2010-02-22 Thread Charles R Harris
On Mon, Feb 22, 2010 at 1:57 PM, Pauli Virtanen wrote: > ma, 2010-02-22 kello 13:53 -0700, Charles R Harris kirjoitti: > [clip] > > I'm actually using #ifdefs for the whole change, no macros in the > > include files. It hasn't been a lot of work so far. The c_api is > > currently exported as a Py

Re: [Numpy-discussion] datetime uses API deprecated in python3.1

2010-02-22 Thread Charles R Harris
On Mon, Feb 22, 2010 at 1:58 PM, Robert Kern wrote: > On Mon, Feb 22, 2010 at 14:53, Charles R Harris > wrote: > > > > > > On Mon, Feb 22, 2010 at 1:45 PM, Pauli Virtanen wrote: > >> > >> ma, 2010-02-22 kello 13:25 -0700, Charles R Harris kirjoitti: > > >> > I'm not sure if using PyCapsule obje

Re: [Numpy-discussion] datetime uses API deprecated in python3.1

2010-02-22 Thread Robert Kern
On Mon, Feb 22, 2010 at 14:53, Charles R Harris wrote: > > > On Mon, Feb 22, 2010 at 1:45 PM, Pauli Virtanen wrote: >> >> ma, 2010-02-22 kello 13:25 -0700, Charles R Harris kirjoitti: >> > I'm not sure if using PyCapsule objects will make pickled arrays >> > incompatible between py2k and py3k, b

Re: [Numpy-discussion] datetime uses API deprecated in python3.1

2010-02-22 Thread Pauli Virtanen
ma, 2010-02-22 kello 13:53 -0700, Charles R Harris kirjoitti: [clip] > I'm actually using #ifdefs for the whole change, no macros in the > include files. It hasn't been a lot of work so far. The c_api is > currently exported as a PyCObject, we might want to give it a name > when it is a PyCapsule.

Re: [Numpy-discussion] datetime uses API deprecated in python3.1

2010-02-22 Thread Charles R Harris
On Mon, Feb 22, 2010 at 1:45 PM, Pauli Virtanen wrote: > ma, 2010-02-22 kello 13:25 -0700, Charles R Harris kirjoitti: > [clip] > > It looks like context is the new name for desc, so > > that PyCObject_FromVoidPtrAndDesc can be implemented > > as tw

Re: [Numpy-discussion] datetime uses API deprecated in python3.1

2010-02-22 Thread Pauli Virtanen
ma, 2010-02-22 kello 13:25 -0700, Charles R Harris kirjoitti: [clip] > It looks like context is the new name for desc, so > that PyCObject_FromVoidPtrAndDesc can be implemented > as two calls. > > I think it is a bit tricky to implemen

Re: [Numpy-discussion] Request for testing

2010-02-22 Thread Friedrich Romstedt
I have several Pythons with several numpys on it: (Ordered by version:) 1. > python-2.4 isinf.py True Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import numpy >>> numpy.__version__ '1.1.

Re: [Numpy-discussion] datetime uses API deprecated in python3.1

2010-02-22 Thread Charles R Harris
On Mon, Feb 22, 2010 at 1:03 PM, Charles R Harris wrote: > > > On Mon, Feb 22, 2010 at 12:26 PM, Charles R Harris < > charlesr.har...@gmail.com> wrote: > >> >> >> On Sun, Feb 21, 2010 at 6:48 PM, Charles R Harris < >> charlesr.har...@gmail.com> wrote: >> >>> >>> >>> On Sun, Feb 21, 2010 at 11:34

Re: [Numpy-discussion] datetime uses API deprecated in python3.1

2010-02-22 Thread Charles R Harris
On Mon, Feb 22, 2010 at 12:26 PM, Charles R Harris < charlesr.har...@gmail.com> wrote: > > > On Sun, Feb 21, 2010 at 6:48 PM, Charles R Harris < > charlesr.har...@gmail.com> wrote: > >> >> >> On Sun, Feb 21, 2010 at 11:34 AM, Pauli Virtanen wrote: >> >>> su, 2010-02-21 kello 20:17 +0200, Pauli Vi

Re: [Numpy-discussion] datetime uses API deprecated in python3.1

2010-02-22 Thread Charles R Harris
On Sun, Feb 21, 2010 at 6:48 PM, Charles R Harris wrote: > > > On Sun, Feb 21, 2010 at 11:34 AM, Pauli Virtanen wrote: > >> su, 2010-02-21 kello 20:17 +0200, Pauli Virtanen kirjoitti: >> [clip] >> > The Capsule API seems pretty much the same as the CObject API. (Why the >> > name change?) We can

Re: [Numpy-discussion] numpy + ubuntu 9.10 (karmic) + unladen swallow

2010-02-22 Thread Skipper Seabold
On Mon, Feb 22, 2010 at 12:31 PM, Bruce Southey wrote: > On 02/22/2010 08:46 AM, Valery Khamenya wrote: >> Hi all, >> >> I know the formula works, but fail to reproduce it :) >> >> Issue #1. the following entry from numpy installation docs is perhaps >> out-of-date, at least as for ubuntu karmic:

Re: [Numpy-discussion] numpy + ubuntu 9.10 (karmic) + unladen swallow

2010-02-22 Thread Bruce Southey
On 02/22/2010 08:46 AM, Valery Khamenya wrote: > Hi all, > > I know the formula works, but fail to reproduce it :) > > Issue #1. the following entry from numpy installation docs is perhaps > out-of-date, at least as for ubuntu karmic: > >sudo apt-get install gcc g77 python-dev atlas3-base-dev >

Re: [Numpy-discussion] ask.scipy.org

2010-02-22 Thread Robert Kern
On Mon, Feb 22, 2010 at 06:17, David Warde-Farley wrote: > On Sun, Feb 21, 2010 at 04:06:09PM -0600, Robert Kern wrote: >> >> I spent some time on Friday getting Plurk's Solace tweaked for our use >> (for various reasons, it's much better code to deal with than the >> CNPROG software currently run

[Numpy-discussion] numpy + ubuntu 9.10 (karmic) + unladen swallow

2010-02-22 Thread Valery Khamenya
Hi all, I know the formula works, but fail to reproduce it :) Issue #1. the following entry from numpy installation docs is perhaps out-of-date, at least as for ubuntu karmic: sudo apt-get install gcc g77 python-dev atlas3-base-dev Neither g77 nor atlas3-base-dev are available. Perhaps, g77

Re: [Numpy-discussion] Calling routines from a Fortran library using python

2010-02-22 Thread Nils Wagner
On Mon, 22 Feb 2010 22:18:23 +0900 David Cournapeau wrote: > On Mon, Feb 22, 2010 at 10:01 PM, Nils Wagner > wrote: > >> >> ar x test.a >> gfortran -shared *.o -o libtest.so -lg2c >> >> to build a shared library. The additional option -lg2c >>was >> necessary due to an undefined symbol: s_cmp

Re: [Numpy-discussion] Calling routines from a Fortran library using python

2010-02-22 Thread David Cournapeau
On Mon, Feb 22, 2010 at 10:01 PM, Nils Wagner wrote: > > ar x test.a > gfortran -shared *.o -o libtest.so -lg2c > > to build a shared library. The additional option -lg2c was > necessary due to an undefined symbol: s_cmp You should avoid the -lg2c option at any cost if compiling with gfortran. I

Re: [Numpy-discussion] Calling routines from a Fortran library using python

2010-02-22 Thread Nils Wagner
On Thu, 18 Feb 2010 22:29:39 +0900 David Cournapeau wrote: > On Thu, Feb 18, 2010 at 10:22 PM, Nils Wagner > wrote: >> On Thu, 18 Feb 2010 11:55:07 +0100 >>  Matthieu Brucher wrote: Ok I have extracted the *.o files from the static library. Applying the file command to the o

Re: [Numpy-discussion] Request for testing

2010-02-22 Thread Sean Arms
On Sun, Feb 21, 2010 at 4:30 AM, Charles R Harris wrote: > Hi All, > > I would be much obliged if some folks would run the attached script and > report the output, numpy version, and python version. It just runs > np.isinf(np.inf), which raises an "invalid value" warning with current > numpy. As f

Re: [Numpy-discussion] ask.scipy.org

2010-02-22 Thread David Warde-Farley
On Sun, Feb 21, 2010 at 04:06:09PM -0600, Robert Kern wrote: > > I spent some time on Friday getting Plurk's Solace tweaked for our use > (for various reasons, it's much better code to deal with than the > CNPROG software currently running advice.mechanicalkern.com). > > http://opensource.plurk