Skip to content

Commit

Permalink
gp_panel: add --skip energy option
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaume committed Apr 3, 2014
1 parent 649b77b commit 64de788
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions pyana/examples/gp_panel.py
Expand Up @@ -10,7 +10,7 @@
cocktail_opts = 'with lines lc 0 lw 5 lt 1'
data_opts = 'lt 1 lw 4 ps 1.5 lc %s pt 18' % default_colors[0]

def gp_panel(version):
def gp_panel(version, skip):
"""example for a panel plot using QM12 data (see gp_xfac)
.. image:: pics/panelQM12.png
Expand All @@ -24,6 +24,7 @@ def gp_panel(version):
data = {}
for file in os.listdir(inDir):
energy = re.compile('\d+').search(file).group()
if skip is not None and energy == skip: continue
data_type = re.sub('%s\.dat' % energy, '', file)
file_url = os.path.join(inDir, file)
data_import = np.loadtxt(open(file_url, 'rb'))
Expand All @@ -43,14 +44,18 @@ def gp_panel(version):
else [ 'cocktail', 'data' ]
]) for k in sorted(data, key=float)
), # 'lc 0' works here because no error plotting necessary
name = os.path.join(outDir, 'panel%s' % version),
name = os.path.join(
outDir, 'panel%s%s' % (version, 'No'+skip if skip is not None else '')
),
ylabel = '1/N@_{mb}^{evt} dN@_{ee}^{acc.}/dM_{ee} [ (GeV/c^2)^{-1} ]',
xlabel = 'invariant dielectron mass, M_{ee} (GeV/c^{2})',
ylog = True, xr = [0, 1.1], yr = [1e-4, 20],
lmargin = 0.1, bmargin = 0.15,
arrow_length = 0.4, arrow_bar = 0.002,
gpcalls = [
'mxtics 2', 'label 8 "" at graph 0.4,0.7' if version == 'QM12Latest200' else ''
'mxtics 2', 'label %d "" at graph 0.4,0.7' % (
8 if skip is None else 6
) if version == 'QM12Latest200' else ''
],
labels = {'STAR Preliminary': [0.4,0.7,False]}
)
Expand All @@ -60,10 +65,11 @@ def gp_panel(version):
checkSymLink()
parser = argparse.ArgumentParser()
parser.add_argument("version", help="version = subdir name of input dir")
parser.add_argument("--skip", help="skip an energy", metavar="energy")
parser.add_argument("--log", help="show log output", action="store_true")
args = parser.parse_args()
loglevel = 'DEBUG' if args.log else 'WARNING'
logging.basicConfig(
format='%(message)s', level=getattr(logging, loglevel)
)
print gp_panel(args.version)
print gp_panel(args.version, args.skip)

0 comments on commit 64de788

Please sign in to comment.