Beispiel #1
0
def main():

    T = 10
    Q2 = 100
    X = np.linspace(1e-3, 0.4)

    CJ = COMPOSER(name="CJ15_NLO_KP_AV18")
    d = CJ.get_xpdf("db-ub", X=X, Q2=Q2)

    ax = py.subplot(111)
    p1, = ax.plot(X, d["xf0"] / X, color="r", ls="-")
    p2 = fill_between(
        X,
        (d["xf0"] - d["dxf-"] * T) / X,
        (d["xf0"] + d["dxf+"] * T) / X,
        ax=ax,
        facecolor="r",
        edgecolor="none",
        alpha=0.5,
    )

    H = [(p2, p1)]
    L = [tex("CJ15") + "\ $(T=%d)$" % T]
    ax.legend(H, L, loc=1, frameon=0, fontsize=20)
    ax.set_ylim(-0.2, 1.2)
    ax.axhline(0, ls="--", color="k", alpha=0.5)

    py.savefig("gallery/db_ub.pdf")
Beispiel #2
0
import numpy as np
import pylab as py
import tools
from tools import tex,plot_band,fill_between
import lhapdf
import matplotlib.gridspec as gridspec
from  matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
rc('text',usetex=True)
from master import COMPOSER,FITPACK,COMPOSER4NNPDF
##################################################

#NNPDF=COMPOSER4NNPDF('NNPDF30_nlo_as_0118')
NNPDF=COMPOSER4NNPDF('NNPDF30_nlo_as_0118_nolhc_1000')

MMHT14=COMPOSER('MMHT2014nlo68cl')

ax=py.subplot(111)
Q2=1
#X=np.linspace(1e-3,1,100)
X=10**np.linspace(-3,0,100)
D=NNPDF.get_xpdf('s',X=X,Q2=Q2)
ax.plot(X,D['xf0'],'r-',label='NNPDF')
ax.plot(X,D['xf0']-D['dxf-'],'r:')
ax.plot(X,D['xf0']+D['dxf+'],'r:')

D=MMHT14.get_xpdf('s',X=X,Q2=Q2)
ax.plot(X,D['xf0'],'b-',label='MMHT')
ax.plot(X,D['xf0']-D['dxf-'],'b:')
ax.plot(X,D['xf0']+D['dxf+'],'b:')
Beispiel #3
0
sys.path.insert(1,'../../')
import numpy as np
import pylab as py
import lhapdf
from tools import tex, fill_between
import matplotlib.gridspec as gridspec
from  matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
rc('text',usetex=True)
from master import FITPACK, COMPOSER
  
# define x values
X=np.linspace(1e-3,0.9,1000)

# initialize composer
CJ=COMPOSER(name='CJ12min',X=X)
#CJ.map_X() # optional

# get glue 
# note: the output is a dictionary where
# key='f0' -> central PDF
# key='df' -> symmetric error
# key='df+' -> asymmetric error (+)
# key='df0' -> asymmetric error (-)
u=CJ.get_xpdf(flav='u',Q2=10.0)
print u.keys()


# these lines add latex typefont.
# is kind of slow, so uncomment while a plot is been coded
#from matplotlib import rc
Beispiel #4
0
def ratio():

  ###############################
  # plot geometry
  ###############################
  # set gloabl figure dimensions
  nrows=3
  ncols=2
  py.figure(figsize=(ncols*4,nrows*3))

  # construct LR AXs for each flav 
  AX={}

  # left side LR panels
  gs = gridspec.GridSpec(nrows,ncols)
  gs.update(left=0.1,right=0.48,wspace=0,hspace=0.3,\
    top=0.98,bottom=0.05)
  AX['u'] =get_LR(gs[0,0],gs[0,1])
  AX['ub']=get_LR(gs[1,0],gs[1,1])
  AX['s'] =get_LR(gs[2,0],gs[2,1])

  # right side LR panels
  gs = gridspec.GridSpec(nrows,ncols)
  gs.update(left=0.58,right=0.98,wspace=0,hspace=0.3,\
    top=0.98,bottom=0.05)
  AX['d'] =get_LR(gs[0,0],gs[0,1])
  AX['db']=get_LR(gs[1,0],gs[1,1])
  AX['g'] =get_LR(gs[2,0],gs[2,1])

  
  ###############################
  # plot content 
  ###############################
  # initialize composer for each pdf set
  CJ=COMPOSER('CJ15_NLO_KP_AV18')
  HERA15=COMPOSER('HERAPDF15NLO_EIG')
  MMHT14=COMPOSER('MMHT2014nlo68cl')
  NNPDF=COMPOSER4NNPDF('NNPDF30_nlo_as_0118')
  #CT10=COMPOSER('CT10nlo')
  
  Q2=10
  for flav in ['u','d','ub','db','s','g']:
    print 'plotting '+flav

    # the output of plot used to construct specialized 
    # legend marker
    p1=plotI(AX,Q2,CJ,CJ,flav,'yellow','-',T=10,\
      hatch=None,alpha=0.4,facecolor='yellow',edgecolor='yellow')
    p2=plotI(AX,Q2,CJ,CJ,flav,'r','-',T=1,\
      hatch=None,alpha=1.0,facecolor='r',edgecolor='none')
    p3=plotI(AX,Q2,CJ,MMHT14,flav,'b','-',T=1,\
      hatch='...',alpha=0.4,facecolor='none',edgecolor='b')
    p4=plotI(AX,Q2,CJ,HERA15,flav,'g','-',T=1,\
      hatch='...',alpha=0.4,facecolor='none',edgecolor='g')
    p5=plotI(AX,Q2,CJ,NNPDF,flav,'m','-',T=1,\
      hatch='...',alpha=0.4,facecolor='none',edgecolor='m')
    #p5=plotI(AX,Q2,CJ,CT10,flav,'k','-',T=1,\
    #  hatch='\\',alpha=0.4,facecolor='none',edgecolor='k')
  

# print single PDF as a function of x (grafted onto ratio.py code)
    if flav=='db':
      X=np.linspace(0.01,1.0,100)    
      mm=MMHT14.get_xpdf(flav,X=X,Q2=4.0)
      t=1
      for i in range(X.size):
        l='%0.2f %0.2e %0.2e %0.2e'       
        print l%(X[i],X[i]*mm['xf0'][i],X[i]*mm['dxf-'][i]*t,X[i]*mm['dxf+'][i]*t)
        #l='%0.2f %0.2e %0.2e'
        #print l%(X[i],X[i]*mm['xf0'][i],X[i]*mm['dxf'][i]*t)
      ax=py.subplot(111)
      ax.plot(X,X*mm['xf0'],'r-')
      ax.plot(X,X*mm['xf0']-X*mm['dxf-']*t,'r:')
      ax.plot(X,X*mm['xf0']+X*mm['dxf+']*t,'r:')
      #ax.plot(X,X*mm['xf0']-mm['dxf']*t,'r:')
      #ax.plot(X,X*mm['xf0']+mm['dxf']*t,'r:') 
      py.show()
      sys.exit()



    #retrieve LR ax for further proccesing 
    axL,axR=AX[flav]

    # plot specialized legend marker at the specific flav panel
    if flav=='d':
      H=[p1,p2,p3,p4,p5]
      L=[tex('CJ15')+'\ ($T=10$)'\
        ,tex('CJ15')+'\ ($T=1$)'\
        ,tex('MMHT14')\
        ,tex('HERA15')\
        ,tex('NNPDF3.0')]
      #  ,tex('CT10')]
      axR.legend(H,L,frameon=0,fontsize=11,\
        bbox_to_anchor=(0.05, 1.0))
    if flav=='u':
      axR.text(0.1,0.85,'$Q^2=%0.0f$'%(Q2)+tex('~GeV^2'),\
        transform=axL.transAxes,size=15)

    # plot some text at specific flav panel
    #if flav=='d':
    #  axL.text(0.06,0.1,'$T=10$',transform=axL.transAxes,size=20)

    # set ylims
    if flav=='u':
      ymin,ymax=0.795,1.205
    if flav=='d':
      ymin,ymax=0.6,1.7
    if flav=='s':
      ymin,ymax=0.6,1.9
    if flav=='g' or flav=='ub' or flav=='db':
      ymin,ymax=0.7,1.3
    #axL.set_yticks(np.arange(0.2,2.0,0.4))
    axL.set_ylim(ymin,ymax)
    axR.set_ylim(ymin,ymax)

    # set x axis
    axL.semilogx()
    axL.set_xticks(10**np.linspace(-4,-2,3))
    if flav=='u' or flav=='d':
      axR.set_xticks(np.arange(0.1,1.1,0.2))
      axR.set_xlim(0.1,0.95)
    else:
      axR.set_xticks(np.arange(0.1,0.4,0.1))
      axR.set_xlim(0.1,0.4)

    # set labels
    if flav=='db': _flav=r'\bar{d}'
    elif flav=='ub': _flav=r'\bar{u}'
    else: _flav=flav
    axL.set_ylabel(r'$%s/%s$\large$_{\rm CJ15}$'%(_flav,_flav),size=20)
    axL.set_xlabel('$x$',size=20)
    axL.xaxis.set_label_coords(1.0,-0.08,transform=axL.transAxes)

  py.savefig('gallery/ratio.pdf')