-
Notifications
You must be signed in to change notification settings - Fork 1
/
c51_gA_analysis.py
145 lines (136 loc) · 6.23 KB
/
c51_gA_analysis.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
"""
This file performs the extrapolation analysis for the gA results using MDWF on HISQ ensembles
Required Python libraries/software
numpy
scipy
matplotlib (assume latex is used to render fonts)
pytables (tables)
iminuit
"""
import os, sys
import argparse, traceback
try:
import numpy as np
np.set_printoptions(linewidth=180)
import scipy as sp
import scipy.linalg as spla
import scipy.special as spsp
import matplotlib.pyplot as plt
import tables as h5
import iminuit as mn
import sqlite_store as sql
import tqdm
# modules created for this work
import ga_fit_funcs as gafit
import utils
import data_params as dp
except ImportError as e:
print type(e)
print e
exit()
def parse_input():
parser = argparse.ArgumentParser(description='''
perform extrapolation analysis of c51 gA results
Required Python Libraries/Software
numpy v1.10.2+
scipy
matplotlib [uselatex: True in matplotrc file]
tables (hdf5)
iminuit
sqlite3''',formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument('-p','--plot',default=True,action='store_false',\
help='plot extrapolations? [%(default)s]')
parser.add_argument('-f','--fits',default='all',action='store',\
help='''what type of extrapolation to perform? [%(default)s]
all [ c0_nofv, t_esq0_a0, t_esq0_a2, t_esq1_a0, t_esq1_a2, x_nlo_a2 ]
other [ x_nlo_a2_ea2, xma_nlo_a2, t_esq1_aSa2, x_nlo_aSa2 ]
future [ t_e1_a2, t_e2_a2, t_esq2_a2, x_nnlo_a2 ]
''')
parser.add_argument('--file',type=str,default='c51_gA_mdwf.h5',action='store',
help='hdf5 input file name [%(default)s]')
parser.add_argument('--e0',type=float,default=0.,action='store',\
help='add e_pi offset (e0) for Taylor expansion fits [%(default)s]')
parser.add_argument('--bs',default=False,action='store_true',\
help='loop over bootstraps? [%(default)s]')
parser.add_argument('--error_x',default=False,action='store_true',\
help='include error in all "x" parameters in analysis? [%(default)s]')
parser.add_argument('--error_epi',default=True,action='store_false',\
help='include error in "epi" parameters in analysis? [%(default)s]')
parser.add_argument('--error_a',default=True,action='store_false',\
help='include error in "a" parameters in analysis? [%(default)s]')
parser.add_argument('--error_mL',default=True,action='store_false',\
help='include error in "mL" parameters in analysis? [%(default)s]')
parser.add_argument('--error_pq',default=True,action='store_false',\
help='include error in "PQ" parameters in analysis? [%(default)s]')
parser.add_argument('--error_mju',default=True,action='store_false',\
help='include error in "mju" parameters in analysis? [%(default)s]')
parser.add_argument('--Nbs',type=int,action='store',\
help='How many bootstrap samples? [default=All]')
parser.add_argument('--g0fv',nargs=2,type=float,action='store',\
help='add prior and width to NLO FV coefficient')
parser.add_argument('--g0b',nargs=2,type=float,action='store',\
help='add prior and width to MA axial coupling, \bar{g}_0')
parser.add_argument('--show_fv',default=False,action='store_true',\
help='show raw results? [%(default)s]')
parser.add_argument('--epi_x',nargs=2,type=float,action='store',default=[0.,0.27],\
help='chose x-range for gA vs e_pi plot [%(default)s]')
parser.add_argument('--epi_y',nargs=2,type=float,action='store',default=[1.0,1.44],\
help='chose y-range for gA vs e_pi plot [%(default)s]')
parser.add_argument('--asq_x',nargs=2,type=float,action='store',default=[-0.01,0.81],\
help='chose x-range for gA vs e_pi plot [%(default)s]')
parser.add_argument('--asq_y',nargs=2,type=float,action='store',default=[1.0,1.44],\
help='chose y-range for gA vs e_pi plot [%(default)s]')
args = parser.parse_args()
print('Arguments passed')
print args
print('')
return args
def ini_vals(select):
# initial values for minimizer
# TAYLOR FITS
if select in ['t_esq1_a2','t_esq1_aSa2','t_esq1_aSa2p']:
return {'c0':1.25,'error_c0':0.05,'cm1':-1,'error_cm1':0.05,\
'ca2':-0.1,'error_ca2':0.02,'g0fv':1.5,'error_g0fv':0.01}
elif select in ['c0_nofv']:
return {'c0':1.25,'error_c0':0.05}
elif select in ['t_esq0_a0']:
return {'c0':1.25,'error_c0':0.05,'g0fv':1.5,'error_g0fv':0.1}
elif select in ['t_esq0_a2','t_esq0_aSa2']:
return {'c0':1.25,'error_c0':0.05,\
'ca2':-0.1,'error_ca2':0.02,'g0fv':1.5,'error_g0fv':0.1}
elif select in ['t_esq1_a0']:
return {'c0':1.25,'error_c0':0.05,'cm1':-1,'error_cm1':0.05,\
'g0fv':1.5,'error_g0fv':0.1}
elif select in ['t_esq1_a2_ea2']:
return {'c0':1.25,'error_c0':0.05,'cm1':-1,'error_cm1':0.05,\
'ca2':-0.1,'error_ca2':0.02,'cam2':1,'error_cam2':0.1,'g0fv':1.5,'error_g0fv':0.1}
# Chiral PT FITS
elif select in ['x_lo_a2','x_lo_aSa2']:
return {'g0':1.25,'error_g0':0.05,'ca2':-0.1,'error_ca2':0.02}
elif select in ['x_nlo_a2','x_nlo_aSa2']:
return {'g0':1.25,'error_g0':0.05,'c2':-1,'error_c2':0.05,\
'ca2':-0.1,'error_ca2':0.02}
elif select in ['x_nlo_a0']:
return {'g0':1.25,'error_g0':0.05,'c2':-1,'error_c2':0.05}
elif select in ['x_nlo_a2_ea2']:
return {'g0':1.25,'error_g0':0.05,'c2':-1,'error_c2':0.05,\
'ca2':-0.1,'error_ca2':0.02,'cam2':.1,'error_cam2':.01}
elif select in ['xma_nlo_a2','xma_nlo_aSa2']:
return {'g0':1.25,'error_g0':0.05,'c2':-5,'error_c2':0.05,\
'g0b':0.5,'error_g0b':0.05,'ca2':-0.1,'error_ca2':0.02}
else:
print('initial value is undefined')
raise SystemExit
if __name__=='__main__':
# parse keyboard inputs
args = parse_input()
# set chipt parameters
params_gA = dp.gA_parameters()
# set plotting parameters
params_plot = dp.plotting_parameters()
# read data
data = utils.read_data(args.file,args,params_gA)
# fit data
rdict = gafit.fit_gA(args,params_gA,data,ini_vals)
# plot result
plot = utils.plot_fit(args,params_gA,params_plot,data,rdict)