• R/O
  • SSH

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

File Info

Rev. a9047d613054dcc50dc8f5fe228dfcefd4922d77
Tamaño 753 octetos
Tiempo 2008-11-12 23:11:03
Autor iselllo
Log Message

I generalized the code in order to be able to take copies of 1D arrays
as well.

Content

#! /usr/bin/env python
import scipy as s
import numpy as n
import pylab as p


def replica(pos_arr, N_rep):
    #temp=pos_arr
    dim=s.shape(pos_arr)
    n_row=dim[0]
    if (len(dim)>1):
        n_col=dim[1]
        print "n_row and n_col are, ", n_row, n_col
    else:
        print "n_row is, ", n_row


    if (len(dim)>1):
        copy=s.zeros(((n_row*N_rep),n_col))
    else:
        copy=s.zeros((n_row*N_rep))
        


        
    for i in xrange(N_rep):
        if (len(dim)>1):
            copy[(i*n_row):((i+1)*n_row),:]=pos_arr
        else:
            copy[(i*n_row):((i+1)*n_row)]=pos_arr
            

    return copy

cluster=p.load("eta_0")

my_copy=replica(cluster,200)

p.save("eta_0_200", my_copy)
    
print "So far so good"