Re: [Numpy-discussion] Type Inference

2009-11-25 Thread Charles R Harris
On Wed, Nov 25, 2009 at 12:34 PM, Dan Yamins wrote: > Sometimes I need to convert object-type arrays to their "natural, real" > type, without a priori knowing what that type is, e.g. the equivalent of: > > >>> Y = np.array(X.tolist()) > > where X is the object array. If X is naturally an array

[Numpy-discussion] The trunk has been branched for 1.4.0

2009-11-25 Thread David Cournapeau
Hi, I have finally branched the trunk into the 1.4.x branch. I have disabled the C API for datetime, and fixed the C API/ABI numbers. At this point, you should avoid committing anything which is not a high priority bug in the branch. I will prepare a first rc1 based on the branch, cheers, D

Re: [Numpy-discussion] Correlation function about a factor of 100 slower than matlab/mathcad ... but with fft even worse ?

2009-11-25 Thread qubax
My own solution (i just heard that a very similar fix is (about to be) included in the new svn version) - for those who need a quickfix: *) This quick and dirty solution is about a factor of 300 faster for an input of 10^5 random numbers. Probably alot more for larger vectors. *) The deviation fr

Re: [Numpy-discussion] Help making better use of numpy array functions

2009-11-25 Thread Pierre GM
On Nov 25, 2009, at 4:13 PM, mdekauwe wrote: > I tried redoing the internal logic for example by using the where function > but I can't seem to work out how to match up the logic. For example (note > slightly different from above). If I change the main loop to > > lst = np.where((data > -900.0) &

Re: [Numpy-discussion] Help making better use of numpy array functions

2009-11-25 Thread josef . pktd
On Wed, Nov 25, 2009 at 4:13 PM, mdekauwe wrote: > > I tried redoing the internal logic for example by using the where function > but I can't seem to work out how to match up the logic. For example (note > slightly different from above). If I change the main loop to > > lst = np.where((data > -900

Re: [Numpy-discussion] Help making better use of numpy array functions

2009-11-25 Thread mdekauwe
I tried redoing the internal logic for example by using the where function but I can't seem to work out how to match up the logic. For example (note slightly different from above). If I change the main loop to lst = np.where((data > -900.0) & (lst < -900.0), data, lst) lst = np.where((data > -900

Re: [Numpy-discussion] f2py callback bug?

2009-11-25 Thread Pearu Peterson
Hi James, To answer the second question, use: j = 1+numpy.array([2], numpy.int32) The answer to the first question is that the type of 1+numpy.array([2]) is numpy.int64 but Fortran function expects an array of type numpy.int32 and hence the wrapper makes a copy of the input array (which is a

[Numpy-discussion] Type Inference

2009-11-25 Thread Dan Yamins
Sometimes I need to convert object-type arrays to their "natural, real" type, without a priori knowing what that type is, e.g. the equivalent of: >>> Y = np.array(X.tolist()) where X is the object array. If X is naturally an array of ints, Y will be an int array, if X is naturally strings, then

Re: [Numpy-discussion] Correlation function about a factor of 100 slower than matlab/mathcad ... but with fft even worse ?

2009-11-25 Thread Pauli Virtanen
ke, 2009-11-25 kello 19:23 +0100, qu...@gmx.at kirjoitti: [clip] > Could someone please investigate why correlate and especially > fftconvolve are orders of magnitude slower? Read http://projects.scipy.org/numpy/ticket/1260 ___ NumPy-Discussion mailing

Re: [Numpy-discussion] f2py callback bug?

2009-11-25 Thread James McEnerney
Pearu, Thanks. a follow question. Using fortran   subroutine calc(j) Cf2py intent(callback) pycalc   external pycalc Cf2py integer dimension(1), intent(in,out):: j   integer j(1)   print *, 'in fortran before pycalc ', 'j=', j(1)   call pycalc(j)   print *, 'in fortran af

[Numpy-discussion] Correlation function about a factor of 100 slower than matlab/mathcad ... but with fft even worse ?

2009-11-25 Thread qubax
The correlation of a large data (about 250k points) v can be checked via correlate(v,v,mode='full') and ought to give the same result as the matlab function xcorr(v) FFT might speed up the evaluation ... In my specific case: xcorr takes about 0.2 seconds. correlate takes about 70 seco

Re: [Numpy-discussion] Python 2.6, NumPy on CentOS 5.3

2009-11-25 Thread Robert DeLisle
David, It does indeed work now. I also was able to find a repo package with the atlas libraries, so I installed them as well. It appears that everything went well. Thank you again for your assistance. -Kirk On Tue, Nov 24, 2009 at 8:02 PM, David Cournapeau wrote: > On Wed, Nov 25, 2009 at

Re: [Numpy-discussion] Bug in rec.fromarrays ; plus one other possible bug

2009-11-25 Thread Dan Yamins
>('\x00est', ''), ('\x00est', ''), ('\x00est', ''), ('\x00est', > > ''), > >('\x00est', ''), ('\x00est', '')], > > dtype=[('A', '|S4'), ('B', '|S0')]) > > That certainly looks like a bug -- where does the \0 appear in front of > all but the first string? > Sorry, I'm not sure

Re: [Numpy-discussion] Bug in rec.fromarrays ; plus one other possible bug

2009-11-25 Thread Pauli Virtanen
ke, 2009-11-25 kello 09:48 -0500, Dan Yamins kirjoitti: > Hi, I'm writing to report what looks like a two bugs in the handling > of strings of length 0. (I'm using 1.4.0.dev7746, on Mac OSX 10.5.8. > The problems below occur both for python 2.5 compiled 32-bit as well > as python2.6 compiled 64-bi

Re: [Numpy-discussion] Bug in rec.fromarrays ; plus one other possible bug

2009-11-25 Thread John Hunter
On Wed, Nov 25, 2009 at 8:48 AM, Dan Yamins wrote: > Am I just not supposed to be working with length-0 string columns, period? But why would you want to? array dtypes are immutable, so you are saying: I want this field to be only empty strings now and forever. So you can't initialize them to b

[Numpy-discussion] Bug in rec.fromarrays ; plus one other possible bug

2009-11-25 Thread Dan Yamins
Hi, I'm writing to report what looks like a two bugs in the handling of strings of length 0. (I'm using 1.4.0.dev7746, on Mac OSX 10.5.8. The problems below occur both for python 2.5 compiled 32-bit as well as python2.6 compiled 64-bit). Bug #1: A problem arises when you try to create a record

Re: [Numpy-discussion] Installing numpy under cygwin

2009-11-25 Thread David Cournapeau
On Wed, Nov 25, 2009 at 7:07 PM, Olivia Cheronet wrote: > The npy_math.c is attached here. > I have just tested a fresh svn checkout, and could built numpy correctly on cygwin. I would suggest you update your sources, and build from scratch (i.e. remove the entire build directory and start from s

Re: [Numpy-discussion] Installing numpy under cygwin

2009-11-25 Thread Olivia Cheronet
The npy_math.c is attached here. Cheers, Olivia - Original Message > On Wed, Nov 25, 2009 at 6:42 PM, Olivia Cheronet > wrote: > > The crt0.o file was indeed missing. I have reinstalled cygwin from the > > cygwin > setup.exe (as it seemed to be included therein), and it seems to have

Re: [Numpy-discussion] Installing numpy under cygwin

2009-11-25 Thread David Cournapeau
On Wed, Nov 25, 2009 at 6:42 PM, Olivia Cheronet wrote: > The crt0.o file was indeed missing. I have reinstalled cygwin from the cygwin > setup.exe (as it seemed to be included therein), and it seems to have solved > that. > > compile options: '-Inumpy/core/include > -Ibuild/src.cygwin-1.5.25-i

Re: [Numpy-discussion] Installing numpy under cygwin

2009-11-25 Thread Olivia Cheronet
The crt0.o file was indeed missing. I have reinstalled cygwin from the cygwin setup.exe (as it seemed to be included therein), and it seems to have solved that. However, I now get the error below. Thanks, Olivia _ Running fr

Re: [Numpy-discussion] Installing numpy under cygwin

2009-11-25 Thread David Cournapeau
Olivia Cheronet wrote: > compile options: '-Inumpy/core/src -Inumpy/core/include > -I/usr/include/python2.5 -c' > gcc: _configtest.c > gcc _configtest.o -llibm.a -o _configtest.exe > /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: crt0.o: > No such file: No such file or direc

Re: [Numpy-discussion] f2py callback bug?

2009-11-25 Thread Pearu Peterson
Pearu Peterson wrote: > Hmm, regarding `intent(in, out) j`, this should work. I'll check what > is going on.. The `intent(in, out) j` works when pycalc is defined as subroutine: call pycalc(i, j) instead of pyreturn = pycalc(i, j) Pearu ___