Re: [Numpy-discussion] insert 1D to a 2D array and change it to 3D

2008-04-25 Thread lorenzo bolla
why not using something like numpy.repeat? In [18]: B = numpy.random.rand(4,3) In [19]: A = numpy.repeat(B[:,:,numpy.newaxis],2,axis=2) In [20]: B.shape Out[20]: (4, 3) In [21]: A.shape Out[21]: (4, 3, 2) In [22]: numpy.all(A[:,:,0] == A[:,:,1]) Out[22]: True hth, L. On Fri, Apr 25, 2008 at 12:

Re: [Numpy-discussion] insert 1D to a 2D array and change it to 3D

2008-04-25 Thread Matthieu Brucher
2008/4/25, tournesol <[EMAIL PROTECTED]>: > > Hi All. > > > I just want to conver Fortran 77 source to > Python. > > Here is my F77 source. > > DIMENSION A(25,60,13),B(25,60,13) > > open(15,file='data.dat') > DO 60 K=1,2 > READ(15,1602) ((B(I,J),J=1,60),I=1,25) >

[Numpy-discussion] insert 1D to a 2D array and change it to 3D

2008-04-25 Thread tournesol
Hi All. I just want to conver Fortran 77 source to Python. Here is my F77 source. DIMENSION A(25,60,13),B(25,60,13) open(15,file='data.dat') DO 60 K=1,2 READ(15,1602) ((B(I,J),J=1,60),I=1,25) 60 CONTINUE 1602 FORMAT(15I4) DO 63 K=1,10 DO 6