legacy.py 6.99 KB
Newer Older
ulrich_y's avatar
ulrich_y committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
# vim: foldmethod=marker
from pymule import *
import pymule.mpl_axes_aligner
from tabulate import tabulate

setup(folder='em2em_muone_paper/out.tar.bz2')

## Load w/o bandcut{{{
setup(obs='0')
lo = scaleset(mergefks(sigma('em2em0')), alpha**2*conv)


nloNoVP = scaleset(mergefks(
    sigma('em2emFEE'), sigma('em2emFEM'), sigma('em2emFMM'),
ulrich_y's avatar
ulrich_y committed
15 16
    sigma('em2emREE15'), sigma('em2emREE35'),
    sigma('em2emREM'), sigma('em2emRMM')
ulrich_y's avatar
ulrich_y committed
17 18 19
), alpha**3*conv)
nlo = scaleset(mergefks(
    sigma('em2emFEE'), sigma('em2emFEM'), sigma('em2emFMM'),
ulrich_y's avatar
ulrich_y committed
20 21
    sigma('em2emREE15'), sigma('em2emREE35'),
    sigma('em2emREM'), sigma('em2emRMM'),
ulrich_y's avatar
ulrich_y committed
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
    anyxi=sigma('em2emA', obs='2')
), alpha**3*conv)


nnloNoVP = scaleset(mergefks(
    sigma('em2emFFEEEE'),
    sigma('em2emRFEEEE15'), sigma('em2emRFEEEE35'),
    sigma('em2emRREEEE1516'), sigma('em2emRREEEE3536')
), alpha**4*conv)
nnlo = scaleset(mergefks(
    sigma('em2emFFEEEE'),
    sigma('em2emRFEEEE15'), sigma('em2emRFEEEE35'),
    sigma('em2emRREEEE1516'), sigma('em2emRREEEE3536'),
    sigma('em2emAFEE', obs='0'),
    sigma('em2emAREE15', obs='0'),
    sigma('em2emAREE35', obs='0'),
    anyxi1=sigma('em2emNFEE', obs='0'),
    anyxi2=sigma('em2emAA', obs='0')
), alpha**4*conv)
#####################################################################}}}
## Load w/ bandcut{{{
setup(obs='1')

nlocutNoVP = scaleset(mergefks(
ulrich_y's avatar
ulrich_y committed
46 47 48 49
    sigma('em2emFEE', obs='0'),
    sigma('em2emFEM', obs='0'), sigma('em2emFMM', obs='0'),
    sigma('em2emREE15'), sigma('em2emREE35'),
    sigma('em2emREM'), sigma('em2emRMM')
ulrich_y's avatar
ulrich_y committed
50 51
), alpha**3*conv)
nlocut = scaleset(mergefks(
ulrich_y's avatar
ulrich_y committed
52 53 54 55
    sigma('em2emFEE', obs='0'),
    sigma('em2emFEM', obs='0'), sigma('em2emFMM', obs='0'),
    sigma('em2emREE15'), sigma('em2emREE35'),
    sigma('em2emREM'), sigma('em2emRMM'),
ulrich_y's avatar
ulrich_y committed
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
    anyxi=sigma('em2emA', obs='2')
), alpha**3*conv)


nnlocutNoVP = scaleset(mergefks(
    sigma('em2emFFEEEE', obs='0'),
    sigma('em2emRFEEEE15'), sigma('em2emRFEEEE35'),
    sigma('em2emRREEEE1516'), sigma('em2emRREEEE3536')
), alpha**4*conv)
nnlocut = scaleset(mergefks(
    sigma('em2emFFEEEE', obs='0'),
    sigma('em2emRFEEEE15'), sigma('em2emRFEEEE35'),
    sigma('em2emRREEEE1516'), sigma('em2emRREEEE3536'),
    sigma('em2emAFEE', obs='0'), sigma('em2emAREE15'), sigma('em2emAREE35'),
    anyxi1=sigma('em2emAA', obs='0'), anyxi2=sigma('em2emNFEE', obs='0')
), alpha**4*conv)
#####################################################################}}}
## Print numbers{{{
ulrich_y's avatar
ulrich_y committed
74 75 76 77 78 79 80
print(
    "run time %f days" % (
        (
            lo['time'] + nlo['time'] + nnlo['time']
            + nlocut['time'] + nnlocut['time']
        ) / 3600. / 24.)
    )
ulrich_y's avatar
ulrich_y committed
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96

print(tabulate([
    ['\\sigma^(0)', printnumber(lo['value']), "", "", ""],
    [
        '\\sigma^(1)',
        printnumber(nlo['value']),
        printnumber(nlocut['value']),

        printnumber(dividenumbers(nlo['value'], lo['value'])),
        printnumber(dividenumbers(nlocut['value'], lo['value']))
    ],
    [
        '\\sigma^(2)',
        "+"+printnumber(nnlo['value']),
        "+"+printnumber(nnlocut['value']),

ulrich_y's avatar
ulrich_y committed
97 98 99 100 101 102
        printnumber(dividenumbers(
            nnlo['value'], plusnumbers(lo['value'], nlo['value'])
        )),
        printnumber(dividenumbers(
            nnlocut['value'], plusnumbers(lo['value'], nlocut['value'])
        ))
ulrich_y's avatar
ulrich_y committed
103 104 105 106
    ],
    [
        '\\sigma_2',
        printnumber(plusnumbers(lo['value'], nlo['value'], nnlo['value'])),
ulrich_y's avatar
ulrich_y committed
107 108 109
        printnumber(plusnumbers(
            lo['value'], nlocut['value'], nnlocut['value']
        ))
ulrich_y's avatar
ulrich_y committed
110
    ]
ulrich_y's avatar
ulrich_y committed
111
], headers=['', 'S1', 'S2', 'S1k', 'S2k']))
ulrich_y's avatar
ulrich_y committed
112 113 114 115 116 117
#####################################################################}}}
## Make pictures{{{
### $\theta_e${{{
#### w/o cut{{{
fig, (ax1, ax2, ax3) = kplot(
    {
ulrich_y's avatar
ulrich_y committed
118 119 120 121 122
        'lo':    mergebins(scaleplot(lo['thetae'],   1e-3)[:221], 4),
        'nlo':   mergebins(scaleplot(nlo['thetae'],  1e-3)[:221], 4),
        'nnlo':  mergebins(scaleplot(nnlo['thetae'], 1e-3)[:221], 4),
        'nlo2':  mergebins(scaleplot(nloNoVP['thetae'],  1e-3)[:221], 4),
        'nnlo2': mergebins(scaleplot(nnloNoVP['thetae'], 1e-3)[:221], 4)
ulrich_y's avatar
ulrich_y committed
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
    },
    labelx="$\\theta_e\,/\,{\\rm mrad}$",
    labelsigma="$\\D\\sigma/\\D\\theta_e\ /\ {\\rm\\upmu b}$",
    legend={
        'lo': '$\\sigma^{(0)}$',
        'nlo': '$\\sigma^{(1)}$',
        'nnlo': '$\\sigma^{(2)}$',
        'nlo2': '$\\sigma^{(1)}_\\text{no VP}$',
        'nnlo2': '$\\sigma^{(2)}_{\\text{no VP}}$'
    },
    legendopts={'what': 'u', 'loc': 'lower right'}
)


fig.savefig('plots/theta-e-no-cut.pdf')
#################################################}}}
#### w/ cut{{{
fig, (ax1, ax2, ax3) = kplot(
    {
ulrich_y's avatar
ulrich_y committed
142 143 144 145 146
        'lo':    mergebins(scaleplot(lo['thetae'],      1e-3)[:221], 4),
        'nlo':   mergebins(scaleplot(nlocut['thetae'],  1e-3)[:221], 4),
        'nnlo':  mergebins(scaleplot(nnlocut['thetae'], 1e-3)[:221], 4),
        'nlo2':  mergebins(scaleplot(nlocutNoVP['thetae'],  1e-3)[:221], 4),
        'nnlo2': mergebins(scaleplot(nnlocutNoVP['thetae'], 1e-3)[:221], 4)
ulrich_y's avatar
ulrich_y committed
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
    },
    labelx="$\\theta_e\,/\,{\\rm mrad}$",
    labelsigma="$\\D\\sigma/\\D\\theta_e\ /\ {\\rm\\upmu b}$",
    legend={
        'lo': '$\\sigma^{(0)}$',
        'nlo': '$\\sigma^{(1)}$',
        'nnlo': '$\\sigma^{(2)}$',
        'nlo2': '$\\sigma^{(1)}_\\text{no VP}$',
        'nnlo2': '$\\sigma^{(2)}_{\\text{no VP}}$'
    },
    legendopts={'what': 'u', 'loc': 'lower right'}
)

fig.savefig('plots/theta-e-yes-cut.pdf')
#################################################}}}
###########################################################}}}
### $t_{\mu\mu}${{{
#### w/o cut{{{
fig, (ax1, ax2, ax3) = kplot(
    {
ulrich_y's avatar
ulrich_y committed
167 168 169
        'lo':   mergebins(scaleplot(lo['tmm'][15:296],   1e+6), 8),
        'nlo':  mergebins(scaleplot(nlo['tmm'][15:296],  1e+6), 8),
        'nnlo': mergebins(scaleplot(nnlo['tmm'][15:296], 1e+6), 8)
ulrich_y's avatar
ulrich_y committed
170 171 172 173 174 175 176 177 178 179 180
    },
    labelx="$t_{\\mu}\,/\,{\\rm GeV}^2$",
    labelsigma="$\\D\\sigma/\\D t_{\\mu}\ /\ {\\rm\\upmu b}$",
    legend={
        'lo': '$\\sigma^{(0)}$',
        'nlo': '$\\sigma^{(1)}$',
        'nnlo': '$\\sigma^{(2)}$'
    },
    legendopts={'what': 'u', 'loc': 'lower right'}
)
ax1.set_yscale('log')
ulrich_y's avatar
ulrich_y committed
181 182
ax2.set_ylim(0.95-1, 1.02-1)
ax3.set_ylim(0.999-1, 1.0005-1)
ulrich_y's avatar
ulrich_y committed
183 184 185 186 187 188
pymule.mpl_axes_aligner.yaxes(ax2, ax3, 0)
fig.savefig('plots/tmm-no-cut.pdf')
#################################################}}}
#### w/ cut{{{
fig, (ax1, ax2, ax3) = kplot(
    {
ulrich_y's avatar
ulrich_y committed
189 190 191
        'lo':   mergebins(scaleplot(lo['tmm'][16:242],      1e-3), 8),
        'nlo':  mergebins(scaleplot(nlocut['tmm'][16:242],  1e-3), 8),
        'nnlo': mergebins(scaleplot(nnlocut['tmm'][16:242], 1e-3), 8)
ulrich_y's avatar
ulrich_y committed
192 193 194 195 196 197 198 199 200 201 202
    },
    labelx="$t_{\\mu}\,/\,{\\rm GeV}^2$",
    labelsigma="$\\D\\sigma/\\D t_{\\mu}\ /\ {\\rm\\upmu b}$",
    legend={
        'lo': '$\\sigma^{(0)}$',
        'nlo': '$\\sigma^{(1)}$',
        'nnlo': '$\\sigma^{(2)}$'
    },
    legendopts={'what': 'u', 'loc': 'lower right'}
)
ax1.set_yscale('log')
ulrich_y's avatar
ulrich_y committed
203 204
ax3.set_ylim(0.9994-1, 1.0005-1)
pymule.mpl_axes_aligner.yaxes(ax2, ax3, 0)
ulrich_y's avatar
ulrich_y committed
205 206 207 208
fig.savefig('plots/tmm-yes-cut.pdf')
#################################################}}}
###########################################################}}}
#####################################################################}}}