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 wrote: > Nils, > > 2009/3/2 Nils Wagner : >> 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

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

2009-03-02 Thread Robert Kern
On Mon, Mar 2, 2009 at 19:20, Brian Gerke 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 = 1 > > I'm guessin

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 scalar

[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] Floating point question

2009-03-02 Thread Anne Archibald
On 02/03/2009, Gideon Simpson 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 similar results. > > I

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 : > 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 Numpy-discussion@scipy.org ht

Re: [Numpy-discussion] Floating point question

2009-03-02 Thread Robert Kern
On Mon, Mar 2, 2009 at 15:00, Michael S. Gilbert 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.  What gives?  

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, >

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 flo

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

2009-03-02 Thread Stéfan van der Walt
2009/2/10 Scott Sinclair : >> 2009/2/10 James Watson : >> 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 by peer (http://scipy.org) > > There

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'

Re: [Numpy-discussion] Floating point question

2009-03-02 Thread Robert Kern
On Mon, Mar 2, 2009 at 14:37, Gideon Simpson 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 similar resu

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 wrote: > On Sat, Feb 28, 2009 at 11:08 PM, Pauli Virtanen wrote: > > > > http://scipy.org/scipy/numpy/ticket/1008 > > > > http://codereview.appspot.com/22054 > > I added a few comments - the only significant one concerns types for > unit tests: I

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

[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 poin

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 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 > initially su

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 : > 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 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 xr

Re: [Numpy-discussion] populating an array

2009-03-02 Thread Robert Kern
On Mon, Mar 2, 2009 at 05:08, Brennan Williams 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 cell in the grid. > I'm going to st

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

2009-03-02 Thread Robert Kern
On Mon, Mar 2, 2009 at 04:26, Timmie 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 world is an enigma, a harm

Re: [Numpy-discussion] intersect1d and setmember1d

2009-03-02 Thread Robert Kern
On Mon, Mar 2, 2009 at 03:39, Neil Crighton wrote: > Robert Cimrman 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

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 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) as it constr

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

2009-03-02 Thread Robert Kern
On Mon, Mar 2, 2009 at 09:34, Ravi 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[ idx[:numpy.size(vals

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' an

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] 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 ___ Numpy-

[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 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 384, i

[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 ra

[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: f

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. Tr

Re: [Numpy-discussion] intersect1d and setmember1d

2009-03-02 Thread Neil Crighton
Robert Cimrman 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 attached,

Re: [Numpy-discussion] intersect1d and setmember1d

2009-03-02 Thread Robert Cimrman
Neil wrote: > mudit sharma 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 intersecte