Skip to content

Commit

Permalink
gp_rapp: make plot, first draft
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaume committed Mar 10, 2014
1 parent db9264b commit 79d1eb7
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion pyana/examples/gp_rapp.py
@@ -1,14 +1,19 @@
import logging, argparse, os, re
import numpy as np
from ..ccsgp.config import default_colors
from ..ccsgp.ccsgp import make_plot
from .utils import getWorkDirs, checkSymLink
from .gp_rdiff import getUArray, getEdges, getCocktailSum, enumzipEdges
from decimal import Decimal

ranges = [0.3, 0.7]
ranges = [0.3, 0.7] # TODO: same for IMR

def gp_rapp():
"""rho in-medium ratios by Rapp (based on protected data)"""
inDir, outDir = getWorkDirs()
eRanges = np.array([Decimal(str(e)) for e in ranges])
# prepare data
yields = []
for infile in os.listdir(inDir):
energy = re.compile('\d+').search(infile).group()
medium = np.loadtxt(open(os.path.join(inDir, infile), 'rb'))
Expand All @@ -17,6 +22,18 @@ def gp_rapp():
for i, (e0, e1) in enumzipEdges(eRanges):
uSum = getCocktailSum(e0, e1, eMedium, uMedium)
logging.debug('%s> %g - %g: %r' % (energy, e0, e1, uSum))
yields.append([float(energy), uSum.nominal_value, 0, 0, 0])
data = np.array(sorted(yields))
data[:,1] /= data[-1,1] # divide by 200
# make plot
make_plot(
data = [ data[:-1] ],
properties = [ 'lt 1 lw 4 ps 1.5 lc %s pt 18' % default_colors[0] ],
titles = [ 'LMR (0.3 - 0.7 GeV/c^{2})' ],
name = os.path.join(outDir, 'rapp'),
xlabel = '{/Symbol \326}s_{NN} (GeV)', ylabel = 'Rapp Ratio to 200 GeV',
lmargin = 0.1, key = ['width -3', 'left']
)
return 'done'

if __name__ == '__main__':
Expand Down

0 comments on commit 79d1eb7

Please sign in to comment.