Re: [Numpy-discussion] intersect1d and setmember1d

2009-03-02 Thread Robert Cimrman
Neil wrote: mudit sharma mudit_19a at yahoo.com writes: intersect1d and setmember1d doesn't give expected results in case there are duplicate values in either array becuase it works by sorting data and substracting previous value. Is there an alternative in numpy to get indices of

Re: [Numpy-discussion] intersect1d and setmember1d

2009-03-02 Thread Neil Crighton
Robert Cimrman cimrman3 at ntc.zcu.cz writes: Hi Neil! I would like to add your function to arraysetops.py - is it ok? Just the name would be changed to setmember1d_nu, to follow the naming in the module (like intersect1d_nu). Thank you, r. That's fine! There's no licence

Re: [Numpy-discussion] Slicing/selection in multiple dimensions simultaneously

2009-03-02 Thread David Warde-Farley
On 28-Feb-09, at 12:27 PM, Jonathan Taylor wrote: This does seem like the only way to write this nicely. Unfortunately, I think this may be wasteful memory wise (in contrast to what the obvious matlab code would do) as it constructs an array with the whole first index intact at first. True

[Numpy-discussion] saving an array of strings

2009-03-02 Thread Timmie
Hello, can numpy.savetxt save an array of strings? I got the following arror when saving an array containing strings formatted from datetime objects: File C:\Programme\pythonxy\python\lib\site-packages\numpy\lib\io.py, line 542, in savetxt fh.write(format % tuple(row) + '\n') TypeError:

[Numpy-discussion] populating an array

2009-03-02 Thread Brennan Williams
Ok... I'm using Traits and numpy. I have a 3D grid with directions I,J and K. I have NI,NJ,NK cells in the I,J,K directions so I have NI*NJ*NK cells overall. I have data arrays with a value for each cell in the grid. I'm going to store this as a 1D array, i.e. 1ncells where ncells=NI*NJ*NK

[Numpy-discussion] AttributeError: 'str' object has no attribute 'seek'

2009-03-02 Thread Nils Wagner
Hi all, I encountered a problem wrt loadtxt. Traceback (most recent call last): File mac.py, line 9, in module mac = loadtxt('mac_diff.pmat.gz',skiprows=27,comments='!',usecols=(0,2,4),dtype='|S40') File /data/home/nwagner/local/lib/python2.5/site-packages/numpy/lib/io.py, line

Re: [Numpy-discussion] Call for testing: full blas/lapack builds of numpy on windows 64 bits

2009-03-02 Thread Gael Varoquaux
On Sun, Mar 01, 2009 at 03:51:31AM +0900, David Cournapeau wrote: Great, thank you very much for those informations. It looks like we will be able to provide a 64 bits numpy binary for 1.3.0. Kudos David. Your efforts are invaluable. Gaël ___

Re: [Numpy-discussion] porting NumPy to Python 3

2009-03-02 Thread James Watson
The following are very simple changes that allow the 2to3 program to run on numpy without warnings. Can someone check / commit? numpy/linalg/lapack_lite/make_lite.py: 144c144 if 'BLAS' in filename --- if 'BLAS' in filename: numpy/distutils/misc_util.py: 957c957,958

Re: [Numpy-discussion] Easy way to vectorize a loop?

2009-03-02 Thread Ravi
On Monday 02 March 2009 01:58:27 Robert Kern wrote: for i in range(len(vals)):    flattened[idx[i]]+=vals[i] flattened[idx] = vals Assuming 'idx' and 'vals' are one-dimensional arrays, that should be flattened[ idx[:numpy.size(vals)] ] += vals or flattened[ idx ] += vals if 'vals' and

Re: [Numpy-discussion] Easy way to vectorize a loop?

2009-03-02 Thread Robert Kern
On Mon, Mar 2, 2009 at 09:34, Ravi lists_r...@lavabit.com wrote: On Monday 02 March 2009 01:58:27 Robert Kern wrote: for i in range(len(vals)):    flattened[idx[i]]+=vals[i] flattened[idx] = vals Assuming 'idx' and 'vals' are one-dimensional arrays, that should be  flattened[

Re: [Numpy-discussion] Slicing/selection in multiple dimensions simultaneously

2009-03-02 Thread Robert Kern
On Mon, Mar 2, 2009 at 04:19, David Warde-Farley d...@cs.toronto.edu wrote: On 28-Feb-09, at 12:27 PM, Jonathan Taylor wrote: This does seem like the only way to write this nicely.  Unfortunately, I think this may be wasteful memory wise (in contrast to what the obvious matlab code would do)

Re: [Numpy-discussion] intersect1d and setmember1d

2009-03-02 Thread Robert Kern
On Mon, Mar 2, 2009 at 03:39, Neil Crighton neilcrigh...@gmail.com wrote: Robert Cimrman cimrman3 at ntc.zcu.cz writes: Hi Neil! I would like to add your function to arraysetops.py - is it ok? Just the name would be changed to setmember1d_nu, to follow the naming in the module (like

Re: [Numpy-discussion] saving an array of strings

2009-03-02 Thread Robert Kern
On Mon, Mar 2, 2009 at 04:26, Timmie timmichel...@gmx-topmail.de wrote: Hello, can numpy.savetxt save an array of strings? You need to use fmt= argument to specify the format string(s). The default is %10.5f, so it only works for floats. -- Robert Kern I have come to believe that the whole

Re: [Numpy-discussion] populating an array

2009-03-02 Thread Robert Kern
On Mon, Mar 2, 2009 at 05:08, Brennan Williams brennan.willi...@visualreservoir.com wrote: Ok... I'm using Traits and numpy. I have a 3D grid with directions I,J and K. I have NI,NJ,NK cells in the I,J,K directions so I have NI*NJ*NK cells overall. I have data arrays with a value for each

Re: [Numpy-discussion] Slicing/selection in multiple dimensions simultaneously

2009-03-02 Thread David Warde-Farley
On 2-Mar-09, at 12:25 PM, Robert Kern wrote: a[[2,3,6], ...][..., [3,2]] You're doing fancy indexing, so there are copies both times. D'oh! So I guess the only way to avoid the second copy is to do what Jon initially suggested, i.e. a[ix_([2,3,6],range(a.shape[1]),[3,2])] ? I suppose

Re: [Numpy-discussion] AttributeError: 'str' object has no attribute 'seek'

2009-03-02 Thread Stéfan van der Walt
Nils, 2009/3/2 Nils Wagner nwag...@iam.uni-stuttgart.de: I encountered a problem wrt loadtxt.   File /data/home/nwagner/local/lib/python2.5/site-packages/numpy/lib/io.py, line 384, in loadtxt     fh = seek_gzip_factory(fname) Would you mind trying latest SVN? Thanks Stéfan

Re: [Numpy-discussion] Slicing/selection in multiple dimensions simultaneously

2009-03-02 Thread Robert Kern
On Mon, Mar 2, 2009 at 13:10, David Warde-Farley d...@cs.toronto.edu wrote: On 2-Mar-09, at 12:25 PM, Robert Kern wrote: a[[2,3,6], ...][..., [3,2]] You're doing fancy indexing, so there are copies both times. D'oh! So I guess the only way to avoid the second copy is to do what Jon

[Numpy-discussion] Floating point question

2009-03-02 Thread Gideon Simpson
I recently discovered that for 8 byte floating point numbers, my fortran compilers (gfortran 4.2 and ifort 11.0) on an OS X core 2 duo machine believe the smallest number 2.220507...E-308. I presume that my C compilers have similar results. I then discovered that the smallest floating

Re: [Numpy-discussion] loadtxt slow

2009-03-02 Thread Michael S. Gilbert
On Sun, 1 Mar 2009 14:29:54 -0500, Michael Gilbert wrote: i will send the current version to the list tomorrow when i have access to the system that it is on. attached is my current version of loadtxt. like i said, it's slower for small data sets (because it reads through the whole data file

Re: [Numpy-discussion] RFR: #1008 Loss of precision in (complex) arcsinh arctanh

2009-03-02 Thread Darren Dale
On Sat, Feb 28, 2009 at 10:34 AM, David Cournapeau courn...@gmail.comwrote: On Sat, Feb 28, 2009 at 11:08 PM, Pauli Virtanen p...@iki.fi wrote: http://scipy.org/scipy/numpy/ticket/1008 http://codereview.appspot.com/22054 I added a few comments - the only significant one concerns types

Re: [Numpy-discussion] Floating point question

2009-03-02 Thread Robert Kern
On Mon, Mar 2, 2009 at 14:37, Gideon Simpson simp...@math.toronto.edu wrote: I recently discovered that for 8 byte floating point numbers, my fortran compilers (gfortran 4.2 and ifort 11.0) on an OS X core 2 duo machine believe the  smallest number 2.220507...E-308.  I presume that my C

Re: [Numpy-discussion] RFR: #1008 Loss of precision in (complex) arcsinh arctanh

2009-03-02 Thread Pauli Virtanen
Mon, 02 Mar 2009 15:45:30 -0500, Darren Dale wrote: [clip] I saw some related test failures after updating and reinstalling my checkout. Deleting build and site-packages/numpy, and then reinstalling was all that was required for the tests to pass. The distutils build system apparently doesn't

Re: [Numpy-discussion] porting NumPy to Python 3

2009-03-02 Thread Stéfan van der Walt
2009/2/10 Scott Sinclair scott.sinclair...@gmail.com: 2009/2/10 James Watson watson@gmail.com: I want to make sure diffs are against latest code, but keep getting this svn error: svn update svn: OPTIONS of 'http://scipy.org/svn/numpy/trunk': Could not read status line: Connection reset

Re: [Numpy-discussion] Floating point question

2009-03-02 Thread Michael S. Gilbert
On Mon, 2 Mar 2009 15:37:33 -0500, Gideon Simpson wrote: My two questions are: 1. What is the best way to handle this? Is it just to add a filter of the form u = u * ( np.abs(u) 2.3 e-308) 2. What gives? What's the origin of this (perceived) inconsistency in floating

Re: [Numpy-discussion] Floating point question

2009-03-02 Thread Gideon Simpson
On Mar 2, 2009, at 4:00 PM, Michael S. Gilbert wrote: how are you calculating fmin? numpy has a built-in function that will tell you this information: numpy.finfo( numpy.float ).min -1.7976931348623157e+308 hopefully this helps shed some light on your questions. regards, mike When I

Re: [Numpy-discussion] Floating point question

2009-03-02 Thread Robert Kern
On Mon, Mar 2, 2009 at 15:00, Michael S. Gilbert michael.s.gilb...@gmail.com wrote: On Mon, 2 Mar 2009 15:37:33 -0500, Gideon Simpson wrote: My two questions are: 1.  What is the best way to handle this?  Is it just to add a filter of the form       u = u * ( np.abs(u) 2.3 e-308) 2.  

Re: [Numpy-discussion] porting NumPy to Python 3

2009-03-02 Thread Stéfan van der Walt
Thanks, James. Applied in r6535. 2009/3/2 James Watson watson@gmail.com: The following are very simple changes that allow the 2to3 program to run on numpy without warnings.  Can someone check / commit? ___ Numpy-discussion mailing list

Re: [Numpy-discussion] Floating point question

2009-03-02 Thread Anne Archibald
On 02/03/2009, Gideon Simpson simp...@math.toronto.edu wrote: I recently discovered that for 8 byte floating point numbers, my fortran compilers (gfortran 4.2 and ifort 11.0) on an OS X core 2 duo machine believe the smallest number 2.220507...E-308. I presume that my C compilers have

[Numpy-discussion] Hosting infrastructure upgrade tomorrow

2009-03-02 Thread Stéfan van der Walt
Hi all, Tomorrow afternoon at 14:00 UTC, the SciPy SVN and Trac services will be migrated to a new machine. Please be advised that, for a period of two hours, access to these and other services hosted on scipy.org may be unavailable. Regards Stéfan

Re: [Numpy-discussion] problem with assigning to recarrays

2009-03-02 Thread Brian Gerke
Many thanks for your willingness to help out with this. Not to belabor the point, but I notice that the rules you lay out below don't quite explain why the following syntax works as I originally expected: r[0].field1 = 1 I'm guessing this is because r[0].field1 is already an existing

Re: [Numpy-discussion] problem with assigning to recarrays

2009-03-02 Thread Robert Kern
On Mon, Mar 2, 2009 at 19:20, Brian Gerke bge...@slac.stanford.edu wrote: Many thanks for your willingness to help out with this.  Not to belabor the point, but I notice that the rules you lay out below don't quite explain why the following syntax works as I originally expected: r[0].field1

Re: [Numpy-discussion] AttributeError: 'str' object has no attribute 'seek'

2009-03-02 Thread Nils Wagner
On Mon, 2 Mar 2009 22:08:22 +0200 Stéfan van der Walt ste...@sun.ac.za wrote: Nils, 2009/3/2 Nils Wagner nwag...@iam.uni-stuttgart.de: I encountered a problem wrt loadtxt. File /data/home/nwagner/local/lib/python2.5/site-packages/numpy/lib/io.py, line 384, in loadtxt fh =