def integral_f(self, k): r""" .. math:: 32\pi\frac{\nu^2\Gamma_{\gamma\gamma} X_0}{\nu_0(\nu_0^2-\nu^2)m^3} \left| \frac{F_{Q_1Q_2}}{F_{00}} \right|^2 Note that the mass is shifted and :math:`\Gamma_{\gamma\gamma}` is assumed to be proportional to :math:`m^3`, while :math:`F_{00}` assumed to remain constant. Parameters ---------- k : float :math:`\sqrt{2 q_1 \cdot q_2}, \; [GeV]` Returns ------- tuple value of Re(f(k)-f(0)), 0. """ m = 0.95766 # physical mass mon_m = 0.859 # monopole mass parameter W_gg = 4.3 * 10**-6 # hardcoded physical value of gg-width nu0 = gg.s2nu(gg.shift_mass(m)**2) # note that there's no mistake in shifting the mass and width here X0 = gg.nu2X(nu0) nu = gg.k2nu(k) FF = 1. / ((1 + gg.Q1 / mon_m**2) * (1 + gg.Q2 / mon_m**2)) return 32 * pi * nu**2 * W_gg * X0 * FF**2 / (m**3 * nu0 * (nu0**2 - nu**2)), 0.
def integral_f(self, k): r""" .. math:: 64\pi\frac{\nu^2\Gamma_{\gamma\gamma} X_0}{\nu_0(\nu_0^2-\nu^2)m^3} \left( <\sigma_0 \; \mathrm{fraction}> \cdot \frac{20X_0}{m^4} + <\sigma_2 \; \mathrm{fraction}> \cdot \frac{5\nu_0^2}{X_0} \right) Parameters ---------- k : float :math:`\sqrt{2 q_1 \cdot q_2}, \; [GeV]` Returns ------- tuple value of Re(f(k)-f(0)), 0. """ m = gg.shift_mass(self.m) W_gg = self.W_gg * m / self.m nu0 = gg.s2nu(m**2) X0 = gg.nu2X(nu0) nu = gg.k2nu(k) FF = 1. / ((1 + gg.Q1 / self.mon_m**2) * (1 + gg.Q2 / self.mon_m**2)) h0 = self.h0_fraction h2 = 1 - h0 return 64 * pi * nu**2 * W_gg * X0 * ( h0 * 20 * X0 / m**4 + h2 * 5 * nu0**2 / X0) / (m**3 * nu0 * (nu0**2 - nu**2)) * FF**2, 0.
def k_factor(self, *p): r""" kinematical factor. .. math:: <\sigma_2 \; \mathrm{fraction}> \cdot \frac{2 \nu_0^2}{m^2 \sqrt{X_0}} \; + \; <\sigma_0 \; \mathrm{fraction}> \cdot \frac{8X_0\sqrt{X_0}}{m^6} Note that 2 factors coming from :math:`\sigma_0` and :math:`\sigma_2` are added here. Parameters ---------- p : args, optional `m` (physical :math:`m`) Returns ------- float kinematical factor """ m = gg.shift_mass(self.full_p(p)[0]) nu0 = gg.s2nu(m**2) X0 = gg.nu2X(nu0) h0 = self.h0_fraction h2 = 1. - h0 return h2 * 2*nu0**2/(m**2*X0**0.5) + h0 * 8*X0**1.5/m**6
def k_factor(self, *p): r""" kinematical factor. .. math:: <\sigma_2 \; \mathrm{fraction}> \cdot \frac{2 \nu_0^2}{m^2 \sqrt{X_0}} \; + \; <\sigma_0 \; \mathrm{fraction}> \cdot \frac{8X_0\sqrt{X_0}}{m^6} Note that 2 factors coming from :math:`\sigma_0` and :math:`\sigma_2` are added here. Parameters ---------- p : args, optional `m` (physical :math:`m`) Returns ------- float kinematical factor """ m = gg.shift_mass(self.full_p(p)[0]) nu0 = gg.s2nu(m**2) X0 = gg.nu2X(nu0) h0 = self.h0_fraction h2 = 1. - h0 return h2 * 2 * nu0**2 / (m**2 * X0**0.5) + h0 * 8 * X0**1.5 / m**6
def k_factor(self, *p): r""" kinematical factor. .. math:: \frac{(Q_1^2 - Q_2^2)^2}{m^4} \; \frac{2 \nu_0^2}{m^2 \sqrt{X_0}} Parameters ---------- p : args, optional `m` (physical :math:`m`) Returns ------- float kinematical factor """ m = gg.shift_mass(self.full_p(p)[0]) nu0 = gg.s2nu(m**2) X0 = gg.nu2X(nu0) return (gg.Q1 - gg.Q2)**2 * 2 * nu0**2 / (m**6 * X0**0.5)
def k_factor(self, *p): r""" default kinematical factor: .. math:: \frac{2 \nu_0^2}{m^2 \sqrt{X_0}} Parameters ---------- p : args, optional `m` (physical :math:`m`) Returns ------- float kinematical factor """ m = gg.shift_mass(self.full_p(p)[0]) nu0 = gg.s2nu(m**2) X0 = gg.nu2X(nu0) return 2 * nu0**2 / (m**2 * X0**0.5)
def integral_f(self, k): r""" .. math:: \frac{\alpha^2}{2\pi^2f_\pi^2}\; \frac{\nu^2 X_0}{\nu_0(\nu_0^2-\nu^2)}\; \left| \frac{F_{Q_1Q_2}}{F_{00}} \right|^2 Parameters ---------- k : float :math:`\sqrt{2 q_1 \cdot q_2}, \; [GeV]` Returns ------- tuple value of Re(f(k)-f(0)), 0. """ mon_m = 0.776 # monopole mass parameter nu = gg.k2nu(k) FF = 1. / ((1 + gg.Q1 / mon_m**2) * (1 + gg.Q2 / mon_m**2)) nu0 = gg.s2nu(gg.M_pi**2) # note that we use same mass for pi+ and pi0 X0 = gg.nu2X(nu0) return 0.5 * (alpha * nu * FF / (pi * gg.f_pi))**2 * X0 / (nu0 * (nu0**2 - nu**2)), 0.
def test1_mpi_q2(M_pi, f_pi, M_rho, Q2, out_dir='out'): r""" for a given :math:`M_\pi`, :math:`f_\pi`, :math:`M_\rho` and :math:`Q_2^2` plot :math:`\nu`-dependence of the amplitude compared to interpolated lattice results. Parameters ---------- M_pi : float pion mass f_pi : float pion decay constant M_rho : float :math:`\rho`-meson mass Q2 : float :math:`Q_2^2` out_dir : str, optional root output directory Examples -------- .. code-block:: python from lat import test1_mpi_q2 test1_mpi_q2(0.451, 0.119, 0.952, 0.094) run and wait for a while; then plot results: >>> python plot.py out/test1/mpi_451_Q2_094/f """ initial_v = gg.M_pi, gg.f_pi, gg.M_rho, gg.Q1, gg.Q2 # save initial values e = EtaPrime() p = Pi0() w = WholeRegion() h = WholeRegion(name='h', add_regge=True) filename = get_lattice_data_filename(M_pi, Q2, s='mpi_%03d_Q2_%03d') with open(os.path.join('lattice', filename + '__int')) as fi: data = [] for l in fi: try: data.append(map(float, l.split())) except ValueError: pass d = dict() for nu, Q1, f, err in data: if Q1 != 0.: try: d[Q1] += [[nu, f, err]] except KeyError: d[Q1] = [[nu, f, err]] out_dir = os.path.join(out_dir, 'test1', filename) make_sure_path_exists(out_dir) h.plot_cs(var='nu', xmax=50., dx=0.01, filename=os.path.join(out_dir, 'cs_0'), raw=True) gg.M_pi, gg.f_pi, gg.M_rho, gg.Q2 = M_pi, f_pi, M_rho, Q2 plots = [] for gg.Q1 in d.keys(): h.plot_cs(var='nu', xmax=50., dx=0.01, filename=os.path.join(out_dir, 'cs_%.3f' % gg.Q1), raw=True) nu_max = gg.s2nu(gg.M_pi**2) - 0.002 for r in [e + p, p, w, h]: r.plot_f(var='nu', xmax=nu_max, dx=0.01 * nu_max, filename=os.path.join(out_dir, 'f%s_%.3f' % (r.name[0], gg.Q1)), raw=True) with open(os.path.join(out_dir, 'f_%.3f' % gg.Q1), 'w') as fo: fo.write('\n'.join([' '.join(map(str, l)) for l in d[gg.Q1]])) colors = [ 'r', 'g', 'b', 'c', 'm', 'y', 'k', 'grey', 'purple', 'orange', 'violet' ] colors = (colors * (1 + len(d.keys()) / len(colors)))[:len(d.keys())] with open(os.path.join(out_dir, 'cs'), 'w') as fo: fo.write(r'xylabel: "$\nu \; [GeV ^2]$" "$\sigma \; [\mu b]$"' + '\n') fo.write('maxx: 3\nmaxy: 0.9\n') fo.write('plot: 1 2 source=cs_0 color=grey label=physical\n') for Q1, color in zip(d.keys(), colors): fo.write('plot: 1 2 source=cs_%.3f color=%s label=' % (Q1, color) + r'"$Q_1^2 : \, ' + '%.3f' % Q1 + r' \, GeV^2$"' + '\n') with open(os.path.join(out_dir, 'f'), 'w') as fo: fo.write( r"xylabel: '$\nu \, [GeV^2]$' '$\frac{1}{2}(M_{++,++} + M_{+-,+-})$'" + '\n') gg.Q1 = max(d.keys()) fo.write('maxx: %f\nmaxy: 0.00012\nlinewidth: 1.5\n' % gg.s2nu(gg.M_pi**2)) for Q1, color in zip(d.keys(), colors): fo.write('plot: 1 2 source=fw_%.3f color=%s ' % (Q1, color) + r'label="$Q_1^2 : \, ' + '%.3f' % Q1 + r' \, GeV^2$"' + '\n') fo.write('plot: 1 2 source=fh_%.3f color=%s linestyle=-.\n' % (Q1, color)) fo.write('plot: 1 2 source=fp_%.3f color=%s linestyle=--\n' % (Q1, color)) fo.write('plot: 1 2 source=fe_%.3f color=%s linestyle=:\n' % (Q1, color)) fo.write( 'plot: 1 2 yerr=3 source=f_%.3f marker=o linestyle=None color=%s\n' % (Q1, color)) gg.M_pi, gg.f_pi, gg.M_rho, gg.Q1, gg.Q2 = initial_v # restore initial values
def test3_q1_q2(Q1, Q2, out_dir='out'): r""" for given :math:`Q_1^2` and :math:`Q_2^2`, for each of 3 pion masses (277, 324, 451 MeV) plot :math:`\nu`-dependence of the amplitude compared to interpolated lattice results. Parameters ---------- Q1 : float :math:`Q_1^2` Q2 : float :math:`Q_2^2` out_dir : str, optional root output directory Examples -------- .. code-block:: python from lat import test3_q1_q2 test3_q1_q2(0.377, 0.377) run and wait for a while; then plot results: >>> python plot.py out/test3/f """ initial_v = gg.M_pi, gg.f_pi, gg.M_rho, gg.Q1, gg.Q2 # save initial values d = dict() for M_pi in [0.277, 0.324, 0.451]: filename = get_lattice_data_filename(M_pi, Q2, s='mpi_%03d_Q2_%03d') with open(os.path.join('lattice', filename + '__int')) as fi: data = [] for l in fi: try: data.append(map(float, l.split())) except ValueError: pass for nu, q1, f, err in data: if q1 == Q1: try: d[M_pi] += [[nu, f, err]] except KeyError: d[M_pi] = [[nu, f, err]] print e = EtaPrime() p = Pi0() w = WholeRegion() h = WholeRegion(name='h', add_regge=True) out_dir = os.path.join(out_dir, 'test3') make_sure_path_exists(out_dir) gg.Q1, gg.Q2 = Q1, Q2 for gg.M_pi, gg.f_pi, gg.M_rho in [(0.277, 0.104, 0.878), (0.324, 0.109, 0.922), (0.451, 0.119, 0.952)]: nu_max = gg.s2nu(gg.M_pi**2) - 0.002 for r in [e + p, p, w, h]: r.plot_f(var='nu', xmax=nu_max, dx=0.01 * nu_max, filename=os.path.join( out_dir, 'f%s_%03d' % (r.name[0], int(1000 * gg.M_pi))), raw=True) with open(os.path.join(out_dir, 'fl_%03d' % int(1000 * gg.M_pi)), 'w') as fo: fo.write('\n'.join([' '.join(map(str, l)) for l in d[gg.M_pi]])) colors = [ 'r', 'g', 'b', 'c', 'm', 'y', 'k', 'grey', 'purple', 'orange', 'violet' ] colors = (colors * (1 + len(d.keys()) / len(colors)))[:len(d.keys())] with open(os.path.join(out_dir, 'f'), 'w') as fo: fo.write( r"xylabel: '$\nu \, [GeV^2]$' '$\frac{1}{2}(M_{++,++} + M_{+-,+-})$'" + '\n') gg.M_pi = max(d.keys()) fo.write('maxx: %f\nmaxy: 0.00012\nlinewidth: 1.5\n' % 0.4) #gg.s2nu(gg.M_pi**2)) for M_pi, color in zip(map(lambda x: int(1000 * x), d.keys()), colors): fo.write('plot: 1 2 source=fw_%03d color=%s ' % (M_pi, color) + r'label="$M_\pi : \, ' + '%03d' % M_pi + r' \, MeV$"' + '\n') fo.write('plot: 1 2 source=fh_%03d color=%s linestyle=-.\n' % (M_pi, color)) fo.write('plot: 1 2 source=fp_%03d color=%s linestyle=--\n' % (M_pi, color)) fo.write('plot: 1 2 source=fe_%03d color=%s linestyle=:\n' % (M_pi, color)) fo.write( 'plot: 1 2 yerr=3 source=fl_%03d marker=o linestyle=None color=%s\n' % (M_pi, color)) gg.M_pi, gg.f_pi, gg.M_rho, gg.Q1, gg.Q2 = initial_v # restore initial values
def test1_mpi_q2(M_pi, f_pi, M_rho, Q2, out_dir='out'): r""" for a given :math:`M_\pi`, :math:`f_\pi`, :math:`M_\rho` and :math:`Q_2^2` plot :math:`\nu`-dependence of the amplitude compared to interpolated lattice results. Parameters ---------- M_pi : float pion mass f_pi : float pion decay constant M_rho : float :math:`\rho`-meson mass Q2 : float :math:`Q_2^2` out_dir : str, optional root output directory Examples -------- .. code-block:: python from lat import test1_mpi_q2 test1_mpi_q2(0.451, 0.119, 0.952, 0.094) run and wait for a while; then plot results: >>> python plot.py out/test1/mpi_451_Q2_094/f """ initial_v = gg.M_pi, gg.f_pi, gg.M_rho, gg.Q1, gg.Q2 # save initial values e = EtaPrime() p = Pi0() w = WholeRegion() h = WholeRegion(name='h', add_regge=True) filename = get_lattice_data_filename(M_pi, Q2, s='mpi_%03d_Q2_%03d') with open(os.path.join('lattice', filename + '__int')) as fi: data = [] for l in fi: try: data .append(map(float, l.split())) except ValueError: pass d = dict() for nu, Q1, f, err in data: if Q1 != 0.: try: d[Q1] += [[nu, f, err]] except KeyError: d[Q1] = [[nu, f, err]] out_dir = os.path.join(out_dir, 'test1', filename) make_sure_path_exists(out_dir) h.plot_cs(var='nu', xmax=50., dx=0.01, filename=os.path.join(out_dir, 'cs_0'), raw=True) gg.M_pi, gg.f_pi, gg.M_rho, gg.Q2 = M_pi, f_pi, M_rho, Q2 plots = [] for gg.Q1 in d.keys(): h.plot_cs(var='nu', xmax=50., dx=0.01, filename=os.path.join(out_dir,'cs_%.3f'%gg.Q1), raw=True) nu_max = gg.s2nu(gg.M_pi**2) - 0.002 for r in [e+p, p, w, h]: r.plot_f(var='nu', xmax=nu_max, dx=0.01*nu_max, filename=os.path.join(out_dir,'f%s_%.3f'%(r.name[0],gg.Q1)), raw=True) with open(os.path.join(out_dir, 'f_%.3f' % gg.Q1), 'w') as fo: fo.write('\n'.join([' '.join(map(str, l)) for l in d[gg.Q1]])) colors = ['r','g','b','c','m','y','k','grey','purple','orange','violet'] colors = (colors * (1 + len(d.keys())/len(colors)))[:len(d.keys())] with open(os.path.join(out_dir, 'cs'), 'w') as fo: fo.write(r'xylabel: "$\nu \; [GeV ^2]$" "$\sigma \; [\mu b]$"' + '\n') fo.write('maxx: 3\nmaxy: 0.9\n') fo.write('plot: 1 2 source=cs_0 color=grey label=physical\n') for Q1, color in zip(d.keys(), colors): fo.write('plot: 1 2 source=cs_%.3f color=%s label=' % (Q1, color) + r'"$Q_1^2 : \, ' + '%.3f'%Q1 + r' \, GeV^2$"' + '\n') with open(os.path.join(out_dir, 'f'), 'w') as fo: fo.write(r"xylabel: '$\nu \, [GeV^2]$' '$\frac{1}{2}(M_{++,++} + M_{+-,+-})$'" + '\n') gg.Q1 = max(d.keys()) fo.write('maxx: %f\nmaxy: 0.00012\nlinewidth: 1.5\n' % gg.s2nu(gg.M_pi**2)) for Q1, color in zip(d.keys(), colors): fo.write('plot: 1 2 source=fw_%.3f color=%s '%(Q1, color) + r'label="$Q_1^2 : \, ' + '%.3f'%Q1 + r' \, GeV^2$"' + '\n') fo.write('plot: 1 2 source=fh_%.3f color=%s linestyle=-.\n' % (Q1, color)) fo.write('plot: 1 2 source=fp_%.3f color=%s linestyle=--\n' % (Q1, color)) fo.write('plot: 1 2 source=fe_%.3f color=%s linestyle=:\n' % (Q1, color)) fo.write('plot: 1 2 yerr=3 source=f_%.3f marker=o linestyle=None color=%s\n' % (Q1, color)) gg.M_pi, gg.f_pi, gg.M_rho, gg.Q1, gg.Q2 = initial_v # restore initial values
def test3_q1_q2(Q1, Q2, out_dir='out'): r""" for given :math:`Q_1^2` and :math:`Q_2^2`, for each of 3 pion masses (277, 324, 451 MeV) plot :math:`\nu`-dependence of the amplitude compared to interpolated lattice results. Parameters ---------- Q1 : float :math:`Q_1^2` Q2 : float :math:`Q_2^2` out_dir : str, optional root output directory Examples -------- .. code-block:: python from lat import test3_q1_q2 test3_q1_q2(0.377, 0.377) run and wait for a while; then plot results: >>> python plot.py out/test3/f """ initial_v = gg.M_pi, gg.f_pi, gg.M_rho, gg.Q1, gg.Q2 # save initial values d = dict() for M_pi in [0.277, 0.324, 0.451]: filename = get_lattice_data_filename(M_pi, Q2, s='mpi_%03d_Q2_%03d') with open(os.path.join('lattice', filename + '__int')) as fi: data = [] for l in fi: try: data .append(map(float, l.split())) except ValueError: pass for nu, q1, f, err in data: if q1 == Q1: try: d[M_pi] += [[nu, f, err]] except KeyError: d[M_pi] = [[nu, f, err]] print e = EtaPrime() p = Pi0() w = WholeRegion() h = WholeRegion(name='h', add_regge=True) out_dir = os.path.join(out_dir, 'test3') make_sure_path_exists(out_dir) gg.Q1, gg.Q2 = Q1, Q2 for gg.M_pi, gg.f_pi, gg.M_rho in [(0.277, 0.104, 0.878), (0.324, 0.109, 0.922), (0.451, 0.119, 0.952)]: nu_max = gg.s2nu(gg.M_pi**2) - 0.002 for r in [e+p, p, w, h]: r.plot_f(var='nu', xmax=nu_max, dx=0.01*nu_max, filename=os.path.join(out_dir,'f%s_%03d'%(r.name[0], int(1000*gg.M_pi))), raw=True) with open(os.path.join(out_dir, 'fl_%03d' % int(1000*gg.M_pi)), 'w') as fo: fo.write('\n'.join([' '.join(map(str, l)) for l in d[gg.M_pi]])) colors = ['r','g','b','c','m','y','k','grey','purple','orange','violet'] colors = (colors * (1 + len(d.keys())/len(colors)))[:len(d.keys())] with open(os.path.join(out_dir, 'f'), 'w') as fo: fo.write(r"xylabel: '$\nu \, [GeV^2]$' '$\frac{1}{2}(M_{++,++} + M_{+-,+-})$'" + '\n') gg.M_pi = max(d.keys()) fo.write('maxx: %f\nmaxy: 0.00012\nlinewidth: 1.5\n' % 0.4)#gg.s2nu(gg.M_pi**2)) for M_pi, color in zip(map(lambda x: int(1000*x), d.keys()), colors): fo.write('plot: 1 2 source=fw_%03d color=%s '%(M_pi, color) + r'label="$M_\pi : \, ' + '%03d'%M_pi + r' \, MeV$"' + '\n') fo.write('plot: 1 2 source=fh_%03d color=%s linestyle=-.\n' % (M_pi, color)) fo.write('plot: 1 2 source=fp_%03d color=%s linestyle=--\n' % (M_pi, color)) fo.write('plot: 1 2 source=fe_%03d color=%s linestyle=:\n' % (M_pi, color)) fo.write('plot: 1 2 yerr=3 source=fl_%03d marker=o linestyle=None color=%s\n' % (M_pi, color)) gg.M_pi, gg.f_pi, gg.M_rho, gg.Q1, gg.Q2 = initial_v # restore initial values