2011-05-26 15:47:32 -07:00
|
|
|
import sys
|
|
|
|
import numpy as np
|
|
|
|
|
|
|
|
indexes = {
|
|
|
|
2: {
|
|
|
|
'order' : 0,
|
|
|
|
'ep' : 1,
|
2011-05-27 16:18:44 -07:00
|
|
|
'qlin' : 4,
|
|
|
|
'err' : 5,
|
2011-05-26 15:47:32 -07:00
|
|
|
'final' : 6,
|
|
|
|
'exact' : 7,
|
|
|
|
'time' : 8,
|
|
|
|
},
|
|
|
|
3: {
|
|
|
|
'order' : 0,
|
|
|
|
'ep' : 1,
|
2011-05-27 16:18:44 -07:00
|
|
|
'qlin' : 5,
|
|
|
|
'err' : 6,
|
2011-05-26 15:47:32 -07:00
|
|
|
'final' : 7,
|
|
|
|
'exact' : 8,
|
|
|
|
'time' : 9,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
files = sys.argv[1:]
|
|
|
|
|
|
|
|
prefixes = set((i[0] for i in files))
|
|
|
|
if len(prefixes) != 1:
|
|
|
|
print "must only feed either 3- or 2-D files, not mixed"
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
dim = int(prefixes.pop())
|
|
|
|
|
|
|
|
for cur_filename in files:
|
|
|
|
resolution = int(cur_filename.split('.')[1])
|
|
|
|
lines = np.loadtxt(cur_filename)
|
|
|
|
for line in lines:
|
2011-05-27 16:18:44 -07:00
|
|
|
print "%d %d %d %e %e %e %e %e" % (
|
2011-05-26 15:47:32 -07:00
|
|
|
resolution,
|
|
|
|
line[indexes[dim]['order']],
|
|
|
|
line[indexes[dim]['ep' ]],
|
2011-05-27 16:18:44 -07:00
|
|
|
line[indexes[dim]['qlin' ]],
|
|
|
|
line[indexes[dim]['err' ]],
|
2011-05-26 15:47:32 -07:00
|
|
|
line[indexes[dim]['final']],
|
|
|
|
line[indexes[dim]['exact']],
|
|
|
|
line[indexes[dim]['time' ]],
|
|
|
|
)
|