Re: [Numpy-discussion] fromfile() -- aarrgg!

2010-01-12 Thread Pauli Virtanen
ma, 2010-01-11 kello 16:11 -0800, Christopher Barker kirjoitti: [clip] If no conversion is performed, zero is returned and the value of nptr is stored in the location referenced by endptr. off do do some more testing, but I guess that means that those pointers need to be checked after the

[Numpy-discussion] Getting Callbacks with arrays to work

2010-01-12 Thread Jon Moore
Hi, I'm trying to build a differential equation integrator and later a stochastic differential equation integrator. I'm having trouble getting f2py to work where the callback itself receives an array from the Fortran routine does some work on it and then passes an array back.   For the

Re: [Numpy-discussion] Getting Callbacks with arrays to work

2010-01-12 Thread Pearu Peterson
Hi, The problem is that f2py does not support callbacks that return arrays. There is easy workaround to that: provide returnable arrays as arguments to callback functions. Using your example: SUBROUTINE CallbackTest(dv,v0,Vout,N) IMPLICIT NONE !F2PY intent( hide ):: N INTEGER:: N, ic

Re: [Numpy-discussion] TypeError: 'module' object is not callable

2010-01-12 Thread Alan G Isaac
filter(lambda x: x.startswith('eig'),dir(np.linalg)) ['eig', 'eigh', 'eigvals', 'eigvalsh'] import scipy.linalg as spla filter(lambda x: x.startswith('eig'),dir(spla)) ['eig', 'eig_banded', 'eigh', 'eigvals', 'eigvals_banded', 'eigvalsh'] hth, Alan Isaac

Re: [Numpy-discussion] TypeError: 'module' object is not callable

2010-01-12 Thread Alan G Isaac
On 1/12/2010 1:35 AM, Jankins wrote: from scipy.sparse.linalg.eigen import eigen Traceback (most recent call last): File stdin, line 1, inmodule ImportError: cannot import name eigen Look at David's example: from scipy.sparse.linalg import eigen hth, Alan Isaac

Re: [Numpy-discussion] TypeError: 'module' object is not callable

2010-01-12 Thread Jankins
import scipy.sparse.linalg as linalg dir(linalg) ['LinearOperator', 'Tester', '__all__', '__builtins__', '__doc__', '__file__', ' __name__', '__package__', '__path__', 'aslinearoperator', 'bench', 'bicg', 'bicg stab', 'cg', 'cgs', 'dsolve', 'eigen', 'factorized', 'gmres', 'interface', 'isol

Re: [Numpy-discussion] TypeError: 'module' object is not callable

2010-01-12 Thread Arnar Flatberg
On Tue, Jan 12, 2010 at 4:11 PM, Jankins andyjian430...@gmail.com wrote: Hi On my Ubuntu, I would reach the arpack wrapper as follows: from scipy.sparse.linalg.eigen.arpack import eigen However, I'd guess that you deal with a symmetric matrix (Laplacian or adjacency matrix), so the symmetric

[Numpy-discussion] Numpy 1.4 MaskedArray bug?

2010-01-12 Thread stephen.pascoe
We have noticed the MaskedArray implementation in numpy-1.4.0 breaks some of our code. For instance we see the following: in 1.3.0: a = numpy.ma.MaskedArray([[1,2,3],[4,5,6]]) numpy.ma.sum(a, 1) masked_array(data = [ 6 15], mask = False, fill_value = 99) in 1.4.0 a =

Re: [Numpy-discussion] TypeError: 'module' object is not callable

2010-01-12 Thread Jankins
Thanks so so much. Finally, it works. import scipy.sparse.linalg.eigen.arpack as arpack dir(arpack) ['__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', ' _arpack', 'arpack', 'aslinearoperator', 'eigen', 'eigen_symmetric', 'np', 'speig s', 'warnings'] But I

Re: [Numpy-discussion] numpy1.4 dtype issues: scipy.stats pytables

2010-01-12 Thread denis
On 11/01/2010 18:10, josef.p...@gmail.com wrote: For this problem, it's supposed to be only those packages that have or import cython generated code. Right; is this a known bug, is there a known fix for mac dmgs ? (Whisper, how'd it get past testing ?) scipy/stats/__init__.py has an apparent

Re: [Numpy-discussion] numpy1.4 dtype issues: scipy.stats pytables

2010-01-12 Thread Robert Kern
On Tue, Jan 12, 2010 at 10:33, denis denis-bz...@t-online.de wrote: On 11/01/2010 18:10, josef.p...@gmail.com wrote: For this problem, it's supposed to be only those packages that have or import cython generated code. Right; is this a known bug, is there a known fix  for mac dmgs ?

Re: [Numpy-discussion] numpy1.4 dtype issues: scipy.stats pytables

2010-01-12 Thread josef . pktd
On Tue, Jan 12, 2010 at 11:33 AM, denis denis-bz...@t-online.de wrote: On 11/01/2010 18:10, josef.p...@gmail.com wrote: For this problem, it's supposed to be only those packages that have or import cython generated code. Right; is this a known bug, is there a known fix  for mac dmgs ?

Re: [Numpy-discussion] Numpy 1.4 MaskedArray bug?

2010-01-12 Thread Pierre GM
On Jan 12, 2010, at 10:52 AM, stephen.pas...@stfc.ac.uk stephen.pas...@stfc.ac.uk wrote: We have noticed the MaskedArray implementation in numpy-1.4.0 breaks some of our code. For instance we see the following: My, that's embarrassing. Sorry for the inconvenience. in 1.3.0: a =

[Numpy-discussion] wrong casting of augmented assignment statements

2010-01-12 Thread Sebastian Walter
Hello, I have a question about the augmented assignment statements *=, +=, etc. Apparently, the casting of types is not working correctly. Is this known resp. intended behavior of numpy? (I'm using numpy.__version__ = '1.4.0.dev7039' on this machine but I remember a recent checkout of numpy

Re: [Numpy-discussion] wrong casting of augmented assignment statements

2010-01-12 Thread Robert Kern
On Tue, Jan 12, 2010 at 12:05, Sebastian Walter sebastian.wal...@gmail.com wrote: Hello, I have a question about the augmented assignment statements *=, +=, etc. Apparently, the casting of types is not working correctly. Is this known resp. intended behavior of numpy? Augmented assignment

[Numpy-discussion] sphinx numpydoc fails due to no __init__ for class SignedType

2010-01-12 Thread Peter Caldwell
I'm trying to use sphinx to build documentation for our project (CDAT) that uses numpy. I'm running into an exception due to numpy.numarray.numerictypes.SignedType not having an __init__ attribute, which causes problems with numpydoc. I'm sure there must be a workaround or I'm doing

Re: [Numpy-discussion] wrong casting of augmented assignment statements

2010-01-12 Thread josef . pktd
On Tue, Jan 12, 2010 at 1:05 PM, Sebastian Walter sebastian.wal...@gmail.com wrote: Hello, I have a question about the augmented assignment statements *=, +=, etc. Apparently, the casting of types is not working correctly. Is this known resp. intended behavior of numpy? (I'm using

Re: [Numpy-discussion] fromfile() -- aarrgg!

2010-01-12 Thread Christopher Barker
Pauli Virtanen wrote: ma, 2010-01-11 kello 16:11 -0800, Christopher Barker kirjoitti: [clip] If no conversion is performed, zero is returned and the value of nptr is stored in the location referenced by endptr. off do do some more testing, but I guess that means that those pointers need

Re: [Numpy-discussion] wrong casting of augmented assignment statements

2010-01-12 Thread Sebastian Walter
On Tue, Jan 12, 2010 at 7:09 PM, Robert Kern robert.k...@gmail.com wrote: On Tue, Jan 12, 2010 at 12:05, Sebastian Walter sebastian.wal...@gmail.com wrote: Hello, I have a question about the augmented assignment statements *=, +=, etc. Apparently, the casting of types is not working

Re: [Numpy-discussion] Numpy 1.4 MaskedArray bug?

2010-01-12 Thread Pauli Virtanen
ti, 2010-01-12 kello 12:51 -0500, Pierre GM kirjoitti: [clip] a = numpy.ma.MaskedArray([[1,2,3],[4,5,6]]) numpy.ma.sum(a, 1) Traceback (most recent call last): File stdin, line 1, in module File /usr/lib64/python2.5/site-packages/numpy-1.4.0-py2.5-linux-x86_64.egg/n

Re: [Numpy-discussion] wrong casting of augmented assignment statements

2010-01-12 Thread Robert Kern
On Tue, Jan 12, 2010 at 12:31, Sebastian Walter sebastian.wal...@gmail.com wrote: On Tue, Jan 12, 2010 at 7:09 PM, Robert Kern robert.k...@gmail.com wrote: On Tue, Jan 12, 2010 at 12:05, Sebastian Walter sebastian.wal...@gmail.com wrote: Hello, I have a question about the augmented assignment

Re: [Numpy-discussion] Numpy 1.4 MaskedArray bug?

2010-01-12 Thread Charles R Harris
On Tue, Jan 12, 2010 at 11:32 AM, Pauli Virtanen p...@iki.fi wrote: ti, 2010-01-12 kello 12:51 -0500, Pierre GM kirjoitti: [clip] a = numpy.ma.MaskedArray([[1,2,3],[4,5,6]]) numpy.ma.sum(a, 1) Traceback (most recent call last): File stdin, line 1, in module File

Re: [Numpy-discussion] wrong casting of augmented assignment statements

2010-01-12 Thread Sebastian Walter
On Tue, Jan 12, 2010 at 7:38 PM, Robert Kern robert.k...@gmail.com wrote: On Tue, Jan 12, 2010 at 12:31, Sebastian Walter sebastian.wal...@gmail.com wrote: On Tue, Jan 12, 2010 at 7:09 PM, Robert Kern robert.k...@gmail.com wrote: On Tue, Jan 12, 2010 at 12:05, Sebastian Walter

Re: [Numpy-discussion] wrong casting of augmented assignment statements

2010-01-12 Thread Christopher Barker
Sebastian Walter wrote: However, this particular problem occurs when you try to automatically differentiate an algorithm by using an Algorithmic Differentiation (AD) tool. E.g. given a function x = numpy.ones(2) def f(x): a = numpy.ones(2) a *= x return numpy.sum(a) I don't know

Re: [Numpy-discussion] Numpy 1.4 MaskedArray bug?

2010-01-12 Thread Pierre GM
On Jan 12, 2010, at 1:52 PM, Charles R Harris wrote: On Tue, Jan 12, 2010 at 11:32 AM, Pauli Virtanen p...@iki.fi wrote: ti, 2010-01-12 kello 12:51 -0500, Pierre GM kirjoitti: [clip] a = numpy.ma.MaskedArray([[1,2,3],[4,5,6]]) numpy.ma.sum(a, 1) Traceback (most recent call last):

[Numpy-discussion] numpy sum table by category

2010-01-12 Thread Marc Schwarzschild
I have a csv file like this: Account, Symbol, Quantity, Price One,SPY,5,119.00 One,SPY,3,120.00 One,SPY,-2,125.00 One,GE,... One,GE,... Two,SPY, ... Three,GE, ... ... The data is much larger, could be 10,000 records. I can load it into a numpy array using

Re: [Numpy-discussion] numpy sum table by category

2010-01-12 Thread josef . pktd
On Tue, Jan 12, 2010 at 3:33 PM, Marc Schwarzschild m...@thebrookhavengroup.com wrote: I have a csv file like this:    Account, Symbol, Quantity, Price    One,SPY,5,119.00    One,SPY,3,120.00    One,SPY,-2,125.00    One,GE,...    One,GE,...    Two,SPY, ...    Three,GE, ...     ...

Re: [Numpy-discussion] fromfile() -- aarrgg!

2010-01-12 Thread Christopher Barker
Christopher Barker wrote: static int @fn...@_fromstr(char *str, @type@ *ip, char **endptr, PyArray_Descr *NPY_UNUSED(ignore)) { double result; result = NumPyOS_ascii_strtod(str, endptr); *ip = (@type@) result; return 0; } OK, I've done the diagnostics, but not all of