Re: [Numpy-discussion] not expected output of fill_diagonal

2012-06-09 Thread Warren Weckesser
On Fri, Jun 8, 2012 at 7:45 PM, Frédéric Bastien wrote: > Hi, > > While reviewing the Theano op that wrap numpy.fill_diagonal, we found > an unexpected behavior of it: > > # as expected for square matrix > >>> a=numpy.zeros((5,5)) > >>> numpy.fill_diagonal(a, 10) > >>> print a > > # as expected l

Re: [Numpy-discussion] numpy arrays

2012-06-09 Thread Patrick Redmond
How do you want the output files to be formatted? Binary data? Textual representation? This function can do both: http://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.tofile.html And numpy supports a variety of methods for outputting to files (and reading data back in): http://docs.s

Re: [Numpy-discussion] numpy arrays

2012-06-09 Thread bob tnur
> > Hi every body! > I have a &b numpy arrays > a=np.loadtxt('çm1.txt', dtype=np.float, skiprows=2,usecols=[1]) > b=np.loadtxt('çm1.txt', dtype=('x', np.float64), skiprows=2,usecols=[2]) > > how to save multiple files like cm1.txt,cm2.txt,cm3.txt etc and to > produce their corresponding outputs

Re: [Numpy-discussion] numpy arrays

2012-06-09 Thread Patrick Redmond
On Sat, Jun 9, 2012 at 2:12 PM, bob tnur wrote: >> >> how to save  multiple files like cm1.txt,cm2.txt,cm3.txt etc and to >> produce their corresponding outputs cm1.out,cm2.out,cm3.out etc. > >    or how to modify this: >    np.savetxt(fname, (a,b), fmt='%4.8f') > You can save them to separate fi

[Numpy-discussion] convert to string - astype(str)

2012-06-09 Thread josef . pktd
Is there a way to convert an array to string elements in numpy, without knowing the string length? >>> arr2 = np.arange(8, 13) >>> arr2.astype(str) # bad array(['8', '9', '1', '1', '1'], dtype='|S1') >>> arr2.astype('S2') array(['8', '9', '10', '11', '12'], dtype='|S2') >>> map(s

[Numpy-discussion] Fwd: [numpy] ENH: Initial implementation of a 'neighbor' calculation (#303)

2012-06-09 Thread Nathaniel Smith
[Manual PR notification] -- Forwarded message -- From: timcera Date: Sat, Jun 9, 2012 at 10:13 PM Subject: [numpy] ENH: Initial implementation of a 'neighbor' calculation (#303) To: njsmith Each element is assigned the result of a function based on it's neighbors. Neighbors are

[Numpy-discussion] Incorrect overflow warning message for float128

2012-06-09 Thread Edward C. Jones
I use up-to-date Debian testing (wheezy), amd64 architecture. From the docs for numpy.MachAr: maxexp int Smallest (positive) power of ibeta that causes overflow. On my machine, ibeta = 2 and maxexp = 16384. For float64, float32, and float16 things behave as expected. For float128, I get the m

Re: [Numpy-discussion] convert to string - astype(str)

2012-06-09 Thread Travis Oliphant
On Jun 9, 2012, at 4:45 PM, josef.p...@gmail.com wrote: > Is there a way to convert an array to string elements in numpy, > without knowing the string length? Not really. In the next release of NumPy you should be able to do. result = array(arr2, str) and it will determine the length of the