|
Last change
on this file since 9 was
9,
checked in by htune, 8 years ago
|
|
|
-
Property svn:executable set to
*
|
|
File size:
1.1 KB
|
| Line | |
|---|
| 1 | import numpy |
|---|
| 2 | import os |
|---|
| 3 | |
|---|
| 4 | debug=False |
|---|
| 5 | # rajouter pour enlever les " par le script de Fred |
|---|
| 6 | os.system("sed 's/\"//g' param.asc > tmp") |
|---|
| 7 | |
|---|
| 8 | f = open('tmp') |
|---|
| 9 | lines = f.readlines() |
|---|
| 10 | f.close() |
|---|
| 11 | |
|---|
| 12 | os.system('rm -f tmp') |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | nsimus = len(lines)-1 |
|---|
| 16 | |
|---|
| 17 | tmp = lines[0].split() |
|---|
| 18 | np = len(tmp)-1 |
|---|
| 19 | |
|---|
| 20 | parameters = [] |
|---|
| 21 | for ip in range(0,np): |
|---|
| 22 | toto = tmp[ip+1] |
|---|
| 23 | parameters.append(toto) |
|---|
| 24 | |
|---|
| 25 | values = numpy.zeros((nsimus,np),dtype=numpy.float) |
|---|
| 26 | names = [] |
|---|
| 27 | for il,line in enumerate(lines[1:]): |
|---|
| 28 | tmp = line.split() |
|---|
| 29 | names.append(tmp[0]) |
|---|
| 30 | if debug: print 'simu=',tmp[0] |
|---|
| 31 | for ip in range(0,np): |
|---|
| 32 | toto = tmp[ip+1] |
|---|
| 33 | values[il,ip] = float(toto) |
|---|
| 34 | if debug: print 'val ',parameters[ip],values[il,ip] |
|---|
| 35 | |
|---|
| 36 | |
|---|
| 37 | |
|---|
| 38 | for isim in range(0,nsimus): |
|---|
| 39 | ext = names[isim] |
|---|
| 40 | cmd = 'cp {0:s} {0:s}.{1:s}'.format('namref',ext) |
|---|
| 41 | if debug: print cmd |
|---|
| 42 | os.system(cmd) |
|---|
| 43 | for ip in range(0,np): |
|---|
| 44 | pp = parameters[ip] |
|---|
| 45 | cmd = "sed -e 's/{0:s}=.*/{0:s}={1:e},/' {2:s}.{3:s} > tmp".format(pp,values[isim,ip],'namref',ext) |
|---|
| 46 | if debug: print cmd |
|---|
| 47 | os.system(cmd) |
|---|
| 48 | cmd = 'cp tmp {0:s}.{1:s}'.format('namref',ext) |
|---|
| 49 | if debug: print cmd |
|---|
| 50 | os.system(cmd) |
|---|
| 51 | |
|---|
| 52 | os.system('rm -f tmp') |
|---|
Note: See
TracBrowser
for help on using the repository browser.