Rev. | a9047d613054dcc50dc8f5fe228dfcefd4922d77 |
---|---|
Size | 753 bytes |
Time | 2008-11-12 23:11:03 |
Author | iselllo |
Log Message | I generalized the code in order to be able to take copies of 1D arrays
|
#! /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"