From 8ffe0bdc4aef0f4e897e6692faa7e369e618ce0c Mon Sep 17 00:00:00 2001 From: Klaus Rabbertz <klaus.rabbertz@cern.ch> Date: Tue, 12 Jan 2021 16:34:32 +0100 Subject: [PATCH] Add scalenames with translation for filenames --- tools/plotting/fastnnlo_pdfunc.py | 7 ++++--- tools/plotting/fastnnlo_scaleunc.py | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/plotting/fastnnlo_pdfunc.py b/tools/plotting/fastnnlo_pdfunc.py index 39f2a910..ddac4f97 100755 --- a/tools/plotting/fastnnlo_pdfunc.py +++ b/tools/plotting/fastnnlo_pdfunc.py @@ -93,6 +93,7 @@ class SplitArgs(argparse.Action): # Some global definitions _fntrans = str.maketrans({'[': '', ']': '', '(': '', ')': '', ',': ''}) # Filename translation table +_sntrans = str.maketrans({'[': '', ']': '', '(': '', ')': '', ',': '', '/': '÷'}) # Scalename translation table _formats = {'eps': 0, 'pdf': 1, 'png': 2, 'svg': 3} _text_to_order = {'LO': 0, 'NLO': 1, 'NNLO': 2} _order_to_text = {0: 'LO', 1: 'NLO', 2: 'NNLO'} @@ -269,11 +270,11 @@ def plotting(x_axis, xmin, xmax, xs_all, rel_pdf_unc, abs_pdf_unc, dxsr_cn, nost ordernames += '_%s' % order_item if given_filename is not None: - filename = '%s.pdfunc-%s.%s' % (given_filename, - order_item, pdffilenames[1:]) + filename = '%s.pdfunc-%s.%s.%s' % (given_filename, + order_item, pdffilenames[1:], scale_name.translate(_sntrans)) else: filename = '%s.pdfunc-%s.%s.%s' % (tablename, - order_item, pdffilenames[1:], scale_name) + order_item, pdffilenames[1:], scale_name.translate(_sntrans)) if not nostat: filename = filename+'.stat' diff --git a/tools/plotting/fastnnlo_scaleunc.py b/tools/plotting/fastnnlo_scaleunc.py index 731b7725..fd66d5f6 100755 --- a/tools/plotting/fastnnlo_scaleunc.py +++ b/tools/plotting/fastnnlo_scaleunc.py @@ -94,6 +94,7 @@ class SplitArgs(argparse.Action): # Some global definitions _fntrans = str.maketrans({'[': '', ']': '', '(': '', ')': '', ',': ''}) # Filename translation table +_sntrans = str.maketrans({'[': '', ']': '', '(': '', ')': '', ',': '', '/': '÷'}) # Scalename translation table _formats = {'eps': 0, 'pdf': 1, 'png': 2, 'svg': 3} _text_to_order = {'LO': 0, 'NLO': 1, 'NNLO': 2} _order_to_text = {0: 'LO', 1: 'NLO', 2: 'NNLO'} @@ -239,10 +240,10 @@ def plotting(x_axis, xmin, xmax, xs_all, rel_scale_unc, abs_scale_unc, dxsr_cn, if given_filename is not None: filename = '%s.scaleunc-%s.%s.%s' % (given_filename, - vartype, ordernames[1:], scale_name) + vartype, ordernames[1:], scale_name.translate(_sntrans)) else: filename = '%s.scaleunc-%s.%s.%s.%s' % ( - tablename, vartype, ordernames[1:], pdfset, scale_name) + tablename, vartype, ordernames[1:], pdfset, scale_name.translate(_sntrans)) if not nostat: filename = filename+'.stat' -- GitLab