summaryrefslogtreecommitdiff
path: root/sim/src/parameters/esee
blob: ce8559aa252334187151525fecb4ad9aa318d390 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#! /usr/bin/python

import re
import os
import sys
engpat = re.compile(" *[\d\.-]+ +([\d\.-]+)")

def findnext(f,pat):
    while 1:
        card = f.readline()
        if not card: return None
        m = pat.match(card)
        if m: return m        

def ending(nam,suf):
    if suf==nam[-len(suf):]: return nam
    else: return nam+suf

if len(sys.argv)>1:
    files = map(lambda nm: ending(nm,'.log'),sys.argv[1:])
else:
    files = os.listdir('.')
    
    
for fn in files:
    if '.log'==fn[-4:]:
        fn = fn[:-4]
        os.system("xe "+fn+" > "+fn+'.data')
        f=open(fn+'.data','r')
        hi=-1000000.0
        lo=0.0
        while 1:
            m=findnext(f, engpat)
            if not m: break
            n=float(m.group(1))
            if n==0.0: continue
            if n<lo: lo=n
            if n>hi: hi=n
        f.close()
        dy = (hi - lo)/20.
        yval = str(lo-dy)+':'+str(hi+dy)
        f=open(fn+'.gnp','w')
        print >>f, 'set title "',fn,'"'
        print >>f, "plot []["+yval+"] '"+fn+".data' using 1:2 with lines"
        print >>f, 'pause mouse'
        f.close()
        os.system('gnuplot '+fn+'.gnp')