-
Notifications
You must be signed in to change notification settings - Fork 2
/
make_tables.py
71 lines (66 loc) · 2.33 KB
/
make_tables.py
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
################################################################################
# Source file: ./make_table.py
#
# Copyright (C) 2020
#
# Author: Andreas Juettner juettner@soton.ac.uk
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# See the full license in the file "LICENSE" in the top level distribution
# directory
################################################################################
import numpy as np
import h5py
from MISC import disperr3
# This script reads in the results generated by do_Binderanlysis.sh and creates a Latex table
# define constants
Bbars = {'2':[0.51,0.52,0.53,0.54,0.55,0.56,0.57,0.58,0.59],'4':[0.42,0.43,0.44,0.45,0.46,0.47]}
Nlist = [2,4]
glist = [.1,.2,.3,.5,.6]
Llist = [8,16,32,48,64,96,128]
# open data file
filename = 'h5data/Bindercrossings.h5'
f = h5py.File(filename,'r')
# open file for storing the latex table
tab = open('tables/crossings.tex','w')
#
# set up header for latex table
#
tab.write('\\begin{tabular}{llllllllllllllllllllllllllllll}')
tab.write('\\hline\\hline')
#
# start looping over N, ag, L/a and write lines of table
#
for N in Nlist:
tab.write('$L/a$&'+'&'.join([str(B) for B in Bbars[str(N)]])+'\\\\\n')
tab.write('\\hline')
for g in glist:
for L in [8,16,32,48,64,96,128]:
print("Loading data for N=%d, ag=%.2f, L/a=%d"%(N,g,L))
s = []
for Bbar in Bbars[str(N)]:
key = 'N=%d/g=%.2f/L=%d/Bbar=%.3f'%(N,g,L,Bbar)
try:
f[key+'/central']
except:
continue
s.append(disperr3([f[key+'/central'].value],[f[key+'/std'].value])[0])
tab.write(str(L)+'&'+'&'.join(s)+'\\\\\n')
tab.write('\\hline')
tab.write('\\hline')
tab.write('\\end{tabular}')
tab.close()
f.close()