Revisão | a9047d613054dcc50dc8f5fe228dfcefd4922d77 (tree) |
---|---|
Hora | 2008-11-12 23:11:03 |
Autor | iselllo |
Commiter | iselllo |
I generalized the code in order to be able to take copies of 1D arrays
as well.
@@ -8,20 +8,35 @@ | ||
8 | 8 | #temp=pos_arr |
9 | 9 | dim=s.shape(pos_arr) |
10 | 10 | n_row=dim[0] |
11 | - n_col=dim[1] | |
12 | - print "n_row and n_col are, ", n_row, n_col | |
13 | - | |
14 | - copy=s.zeros(((n_row*N_rep),n_col)) | |
11 | + if (len(dim)>1): | |
12 | + n_col=dim[1] | |
13 | + print "n_row and n_col are, ", n_row, n_col | |
14 | + else: | |
15 | + print "n_row is, ", n_row | |
16 | + | |
17 | + | |
18 | + if (len(dim)>1): | |
19 | + copy=s.zeros(((n_row*N_rep),n_col)) | |
20 | + else: | |
21 | + copy=s.zeros((n_row*N_rep)) | |
22 | + | |
23 | + | |
24 | + | |
25 | + | |
15 | 26 | for i in xrange(N_rep): |
16 | - copy[(i*n_row):((i+1)*n_row),:]=pos_arr | |
27 | + if (len(dim)>1): | |
28 | + copy[(i*n_row):((i+1)*n_row),:]=pos_arr | |
29 | + else: | |
30 | + copy[(i*n_row):((i+1)*n_row)]=pos_arr | |
31 | + | |
17 | 32 | |
18 | 33 | return copy |
19 | 34 | |
20 | -cluster=p.load("initial_folded_larger_box") | |
35 | +cluster=p.load("eta_0") | |
21 | 36 | |
22 | -my_copy=replica(cluster,1000) | |
37 | +my_copy=replica(cluster,200) | |
23 | 38 | |
24 | -p.save("copy_of_cluster50_1000", my_copy) | |
39 | +p.save("eta_0_200", my_copy) | |
25 | 40 | |
26 | 41 | print "So far so good" |
27 | 42 |