From dae516a000ad8ea90ba55c871207a7820ce882f1 Mon Sep 17 00:00:00 2001
From: Klaus Rabbertz <klaus.rabbertz@cern.ch>
Date: Fri, 28 Jun 2024 10:08:05 +0200
Subject: [PATCH] Work on py2/py3 script issues

---
 tools/plotting/fastnnlo_scaleunc.py   |   7 +-
 tools/plotting/sp_contrib_flexible.py | 240 +++++++++++++-------------
 2 files changed, 121 insertions(+), 126 deletions(-)

diff --git a/tools/plotting/fastnnlo_scaleunc.py b/tools/plotting/fastnnlo_scaleunc.py
index 3f43ab3d..693158e4 100755
--- a/tools/plotting/fastnnlo_scaleunc.py
+++ b/tools/plotting/fastnnlo_scaleunc.py
@@ -11,10 +11,6 @@
 #
 ########################################################################
 #
-# python2 compatibility
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
 import argparse
 import glob
 import os
@@ -268,8 +264,7 @@ def main():
     # just for measuring wall clock time - not necessary
     start_time = timeit.default_timer()
     # Define arguments & options
-    parser = argparse.ArgumentParser(
-        epilog='', formatter_class=argparse.ArgumentDefaultsHelpFormatter)
+    parser = argparse.ArgumentParser(epilog='', formatter_class=argparse.ArgumentDefaultsHelpFormatter)
     # Positional arguments
     parser.add_argument('table', type=str, nargs='+',
                         help='Filename glob of fastNLO tables to be evaluated. This must be specified!')
diff --git a/tools/plotting/sp_contrib_flexible.py b/tools/plotting/sp_contrib_flexible.py
index 71343be2..f126d255 100755
--- a/tools/plotting/sp_contrib_flexible.py
+++ b/tools/plotting/sp_contrib_flexible.py
@@ -94,24 +94,24 @@ def main():
         table_ = os.path.basename(args['table'])
         tablename = os.path.splitext(table_)[0]
         tablename = os.path.splitext(tablename)[0] #because yb tables have .tab.gz ending (getting rid of both here)
-        print '\n'
-        print 'Table: ', tablename, '\n'
+        print('\n')
+        print('Table: ', tablename, '\n')
 
         #pdfset name
         pdfset_ = os.path.basename(args['pdfset'])
         pdfname = os.path.splitext(pdfset_)[0]
-        print 'PDF Set: ', pdfname, '\n'
+        print('PDF Set: ', pdfname, '\n')
 
         #Which subprocesses are evaluated?
-        print 'Subprocesses that are investigated: '
-        print args['subproc']
+        print('Subprocesses that are investigated: ')
+        print(args['subproc'])
 
 
         #handling of subprocess order and normalisation order:
 
         #for labeling purposes
-        print 'subprocess order: ', args['order']
-        print 'normalisation order: ', args['normorder']
+        print('subprocess order: ', args['order'])
+        print('normalisation order: ', args['normorder'])
 
         #subprocess order (either chosen or per default all combinations)
         sp_order_all = ['LO', 'NLO', 'NNLO']
@@ -119,9 +119,9 @@ def main():
                 sp_order = sp_order_all[args['order']]
         elif (args['order'] is None) and (args['normorder'] is not None):
                 sp_order = sp_order_all[args['normorder']]
-                print "Set subprocess order to chosen normalisation order."
+                print("Set subprocess order to chosen normalisation order.")
         else:
-                print "No certain (or valid) subprocess order given."
+                print("No certain (or valid) subprocess order given.")
                 sp_order = sp_order_all #in case of no specification --> sp_order is array, will produce all 5 plots
 
         #normalisation order (as above)
@@ -130,9 +130,9 @@ def main():
                 norm_order = norm_order_all[args['normorder']]
         elif (args['normorder'] is None) and (args['order'] is not None):
                 norm_order = norm_order_all[args['order']]
-                print "Set normalisation order to chosen subprocess order."
+                print("Set normalisation order to chosen subprocess order.")
         else:
-                print "No certain (or valid) normalisation order given."
+                print("No certain (or valid) normalisation order given.")
                 norm_order = norm_order_all #watch out! here norm_order becomes an array
 
 
@@ -145,7 +145,7 @@ def main():
 
         '''
         if (norm_order < sp_order):
-                print "Choice of orders not reasonable." #depends on purpose of the plot. (maybe useful for kfactors if args['subproc']='all')
+                print("Choice of orders not reasonable.") #depends on purpose of the plot. (maybe useful for kfactors if args['subproc']='all')
         else:
                 #usual plotting
         '''
@@ -153,30 +153,30 @@ def main():
         #labeling of the x-axis
         #get dimensionality of table:
         ndim = fnlo.GetNumDiffBin()
-        print "\n", "Dimensions: ", ndim
+        print("\n", "Dimensions: ", ndim)
         #if (ndim > 1):
 
         #get labels of all the dimensions:
         labels = fnlo.GetDimLabels()
-        print "Labels: ", labels
+        print("Labels: ", labels)
 
         #get label of first dimension:
         xlabel = fnlo.GetDimLabel(0)
-        print "x-label: ", xlabel
+        print("x-label: ", xlabel)
 
 
 
 
-        print "\n"
+        print("\n")
         #check whether all 5 plots are needed or just one certain --> evaluate accordingly
         if isinstance(norm_order, list) and isinstance(sp_order, list): #actually one condition to check should be enough in both cases
                 #produce all 5 plots (this also happens if both input orders were invalid...)
-                print 'Start table evaluation for creating 5 plots. \n'
+                print('Start table evaluation for creating 5 plots. \n')
 
                 #cross section with every process included
                 xs_all_list = []
                 for n in norm_order:
-                        print "\n", "n: ", n
+                        print("\n", "n: ", n)
                         for j in range(0,3):
                                 fnlo.SetContributionON(fastnlo.kFixedOrder, j, b_order[n][j]);
                 #for order, setting in sorted(b_order.iteritems()):
@@ -188,33 +188,33 @@ def main():
                         fnlo.CalcCrossSection()
                         xs_all_list.append(fnlo.GetCrossSection())
                 xs_all = np.array(xs_all_list)
-                print '\n'
-                print 'Cross section with all subprocesses xs_all: \n'
-                print xs_all, '\n \n'
+                print('\n')
+                print('Cross section with all subprocesses xs_all: \n')
+                print(xs_all, '\n \n')
 
                 #cross section of single processes
                 xs_sub_list = []
                 for s in sp_order:                      #go through lo, nlo, nnlo
-                        print "\n", "Subprocess order s: ", s
+                        print("\n", "Subprocess order s: ", s)
                         xs_subproc_list = [] #will be emptied after each iteration
                         for l in range(0,3):    #go through the settings for this order s
                                 fnlo.SetContributionON(fastnlo.kFixedOrder, l, b_order[s][l])
 
                         for i in range(0, len(args['subproc'])):
                                 subproc_name = args['subproc'][i]
-                                print 'Selected subprocess: %s' %subproc_name
+                                print('Selected subprocess: %s' %subproc_name)
                                 fnlo.SelectProcesses(subproc_name, True) #optional second argument: symmetric==True per default
                                 fnlo.CalcCrossSection()
                                 xs_subproc = np.array(fnlo.GetCrossSection())
                                 xs_subproc_list.append(xs_subproc) #append xs of chosen subprocess in that certain order
-                                print 'XS for subprocess %s: \n' %args['subproc'][i]
-                                print xs_subproc, '\n \n' #should be one line in xs_sub[k,i,:]
+                                print('XS for subprocess %s: \n' %args['subproc'][i])
+                                print(xs_subproc, '\n \n') #should be one line in xs_sub[k,i,:]
                         #all selected processes in lo or nlo or nnlo
                         xs_sub_list.append(np.array(xs_subproc_list))
                 xs_sub = np.array(xs_sub_list)
-                print "XS of the selected processes in different pTZ-regions, in LO, NLO and NNLO: "
-                print "From outmost level to innermost: order, subprocess, pTZ-bin. \n"
-                print xs_sub, '\n \n'
+                print("XS of the selected processes in different pTZ-regions, in LO, NLO and NNLO: ")
+                print("From outmost level to innermost: order, subprocess, pTZ-bin. \n")
+                print(xs_sub, '\n \n')
 
 
                 #### Investigating the fractions ####
@@ -226,14 +226,14 @@ def main():
                 for i in range(0,3):
                         fractions_eq_order.append(np.divide(xs_sub[i,:],xs_all[i]))
                 fractions_eq = np.array(fractions_eq_order)
-                print 'fractions, equal order of subprocess and normalisation: \n', fractions_eq, '\n'
+                print('fractions, equal order of subprocess and normalisation: \n', fractions_eq, '\n')
 
                 '''
                 #output for checking what has been calculated
                 for n in range(0, 3):
                         for i in range(0, len(fractions_eq[0,:])):
-                                print 'fraction of %s on total XS, both in %s: ' %(args['subproc'][i], sp_order_all[n])
-                                print fractions_eq[n,i,:], '\n \n'
+                                print('fraction of %s on total XS, both in %s: ' %(args['subproc'][i], sp_order_all[n]))
+                                print(fractions_eq[n,i,:], '\n \n')
                 '''
 
                 #make the two additional plots for (LO to NNLO) and (NLO to NNLO)
@@ -241,16 +241,16 @@ def main():
                 for s in range(0,2):                    #s is current subprocess order (LO, NLO)
                         fractions_diff_order.append(np.divide(xs_sub[s,:,:], xs_all[2,:]))
                 fractions_diff = np.array(fractions_diff_order)
-                print 'fractions, different order for subprocess/normalisation: LO/NNLO, NLO/NNLO: '
-                print fractions_diff, '\n'
+                print('fractions, different order for subprocess/normalisation: LO/NNLO, NLO/NNLO: ')
+                print(fractions_diff, '\n')
 
                 #combine these arrays to 'fractions'-array (5 outmost indices, one for each plot)
                 fractions = np.append(fractions_eq, fractions_diff, axis=0)
-                print "------------------------------------------------------------------"
-                print 'Fractions for all the plots to be produced, first index indicates:'
-                print 'LO/LO, NLO/NLO, NNLO/NNLO, LO/NNLO, NLO/NNLO'
-                print fractions, '\n'
-                print "------------------------------------------------------------------ \n"
+                print("------------------------------------------------------------------")
+                print('Fractions for all the plots to be produced, first index indicates:')
+                print('LO/LO, NLO/NLO, NNLO/NNLO, LO/NNLO, NLO/NNLO')
+                print(fractions, '\n')
+                print("------------------------------------------------------------------ \n")
 
 
                 #checking whether contribution is positive or negative
@@ -266,28 +266,28 @@ def main():
                                                 pos_contr[p,i,j] = 0.0
                                         else:
                                                 neg_contr[p,i,j] = 0.0
-                                #print 'Positive contributions of %s on total XS in plot %s: \n' %(args['subproc'][i], p)
-                                #print pos_contr[p,i,:], '\n'
-                                #print 'Negative contributions of %s on total XS in plot %s: \n' %(args['subproc'][i], p)
-                                #print neg_contr[p,i,:], '\n \n'
+                                #print('Positive contributions of %s on total XS in plot %s: \n' %(args['subproc'][i], p))
+                                #print(pos_contr[p,i,:], '\n')
+                                #print('Negative contributions of %s on total XS in plot %s: \n' %(args['subproc'][i], p))
+                                #print(neg_contr[p,i,:], '\n \n')
 
-                print 'Summary of positive and negative contributions of the subprocesses for the 5 plots: \n'
-                print 'pos_contr: \n', pos_contr, '\n'
-                print 'neg_contr: \n', neg_contr, '\n'
+                print('Summary of positive and negative contributions of the subprocesses for the 5 plots: \n')
+                print('pos_contr: \n', pos_contr, '\n')
+                print('neg_contr: \n', neg_contr, '\n')
 
         ############################ Five-Plots-PLOTTING ############################################
                 #Bins for x-axis (according to first pdf (0))
                 bin_bounds = np.array(fnlo.GetObsBinsBounds(0))
-                #print bin_bounds.T             #bin_bounds.T[0] = lower bounds, bin_bounds.T[1] upper bounds
-                print 'bin bounds:', bin_bounds.flatten()
+                #print(bin_bounds.T)             #bin_bounds.T[0] = lower bounds, bin_bounds.T[1] upper bounds
+                print('bin bounds:', bin_bounds.flatten())
 
                 #for naming the plots afterwards and give correct label to y-axis:
                 plots_order = np.array([["LO", "LO"], ["NLO", "NLO"], ["NNLO", "NNLO"], ["LO", "NNLO"], ["NLO", "NNLO"]], dtype=str)
-                print 'The five plots will contain: '
-                print plots_order, '\n'
+                print('The five plots will contain: ')
+                print(plots_order, '\n')
 
                 #Check whether comparison-plot or single-plot is required:
-                print 'Single plots for each process?: ', args['extraplot']
+                print('Single plots for each process?: ', args['extraplot'])
                 if (args['extraplot']==False):          #stackplot that compares the contribution of the subprocesses to the total XS
                         plt.close()
 
@@ -298,8 +298,8 @@ def main():
                                 #number of bins via bin_bounds variable
                                 y0_pos = np.zeros([len(bin_bounds)]) #for tracking the current 'height' of stackplot, in order to staple and not overlap the values for each subprocess
                                 y0_neg = np.zeros([len(bin_bounds)]) #same as above for the negative contributions, plotted below x-axis
-                                print '-        -       -       -'
-                                print 'Start plotting of plot %s \n' %p
+                                print('-        -       -       -')
+                                print('Start plotting of plot %s \n' %p)
                                 color = iter(cm.rainbow(np.linspace(0,1,len(args['subproc']))))
                                 patches = []  #later needed for legend
 
@@ -324,8 +324,8 @@ def main():
                                 xlim = ax0.get_xlim()
                                 ylim = ax0.get_ylim()
 
-                                print 'xlim:', xlim
-                                print 'ylim:', ylim, '\n'
+                                print('xlim:', xlim)
+                                print('ylim:', ylim, '\n')
 
                                 xmin_ = xlim[0]
                                 xmax_ = xlim[1]
@@ -346,7 +346,7 @@ def main():
                                         ax0.set_ylim(ymin_, ymax_) ##set axis limit according to data
                                 '''
 
-                                #print "namesp", namesp, "\n"
+                                #print("namesp", namesp, "\n")
 
                                 if (args['constyaxis'] is not None):    #take limits that user has chosen
                                         if (len(args['constyaxis'])==2):
@@ -355,16 +355,16 @@ def main():
                                                 if ylow < yhigh:
                                                         ax0.axis([0, xmax_, ylow, yhigh])
                                                 else:
-                                                        print " # ERROR! when trying to set y-limits."
-                                                        print "Check choice of y-limits. First value should be lower than second."
-                                                        print "Syntax: -c <lower ylimit> <higher ylimit>."
+                                                        print(" # ERROR! when trying to set y-limits.")
+                                                        print("Check choice of y-limits. First value should be lower than second.")
+                                                        print("Syntax: -c <lower ylimit> <higher ylimit>.")
                                                         break
                                         elif (len(args['constyaxis'])==0):      #set constant y-axis
                                                 ax0.axis([0, xmax_, -0.20, 1.20])
                                         else:
-                                                print " # ERROR! when trying to set y-limits."
-                                                print "Something went wrong. Check input after -c."
-                                                print "Possible: no value, two values or don't use -c at all for flexible axis. \n"
+                                                print(" # ERROR! when trying to set y-limits.")
+                                                print("Something went wrong. Check input after -c.")
+                                                print("Possible: no value, two values or don't use -c at all for flexible axis. \n"
                                                 break
                                 elif (args['constyaxis'] is None):      #use flexible y-axis
                                         ax0.set_xlim(xmin_, xmax_) ##
@@ -395,12 +395,12 @@ def main():
                                         stackplotname = '%s.stackplot_%s.png' %(tablename, plots_order[p,0]+'_'+plots_order[p,1])
                                 fig0.savefig(stackplotname, bbox_inches='tight')
 
-                                print 'Stackplot for subprocess comparison saved as: %s' %(stackplotname), '\n \n'
+                                print('Stackplot for subprocess comparison saved as: %s' %(stackplotname), '\n \n')
 
 
                 else:
-                        print "----------------------------------------------------------"
-                        print "Create individual plot for each single subprocess \n"
+                        print("----------------------------------------------------------")
+                        print("Create individual plot for each single subprocess \n")
 
                         #individual plot for each subproc (NumberOfPlots = 5*NumberOfSubprocesses)
                         #create folder for saving the plots, will be overwritten in case it already exists (avoid countless folders while testing)
@@ -459,16 +459,16 @@ def main():
                                                         if ylow < yhigh:
                                                                 ax0.axis([0, xmax_, ylow, yhigh])
                                                         else:
-                                                                print " # ERROR! when trying to set y-limits."
-                                                                print "Check choice of y-limits. First value should be lower than second."
-                                                                print "Syntax: -c <lower ylimit> <higher ylimit>."
+                                                                print(" # ERROR! when trying to set y-limits.")
+                                                                print("Check choice of y-limits. First value should be lower than second.")
+                                                                print("Syntax: -c <lower ylimit> <higher ylimit>.")
                                                                 break
                                                 elif (len(args['constyaxis'])==0):      #set constant y-axis
                                                         ax0.axis([0, xmax_, -0.20, 1.20])
                                                 else:
-                                                        print " # ERROR! when trying to set y-limits."
-                                                        print "Something went wrong. Check input after -c."
-                                                        print "Possible: no value, two values or don't use -c at all for flexible axis. \n"
+                                                        print(" # ERROR! when trying to set y-limits.")
+                                                        print("Something went wrong. Check input after -c.")
+                                                        print("Possible: no value, two values or don't use -c at all for flexible axis. \n")
                                                         break
                                         elif (args['constyaxis'] is None):      #use flexible y-axis
                                                 ax0.set_xlim(xmin_, xmax_) ##
@@ -499,49 +499,49 @@ def main():
 
                                         #save the plots
                                         fig0.savefig(os.path.join(final_dir,plotname))
-                                        print 'Plot saved in %s' %(final_dir)
-                                        print 'fraction plot saved as: %s' %(plotname), "\n \n"
+                                        print('Plot saved in %s' %(final_dir))
+                                        print('fraction plot saved as: %s' %(plotname), "\n \n")
 
 
 
         elif isinstance(norm_order, str) and isinstance(sp_order, str):
                 #produce only demanded plot for chosen orders
-                print 'Start table evaluation for creating 1 plot. \n'
+                print('Start table evaluation for creating 1 plot. \n')
 
-                print "Normalisation Order: ", norm_order
+                print("Normalisation Order: ", norm_order)
                 for j in range(0,3):
                         fnlo.SetContributionON(fastnlo.kFixedOrder, j, b_order[norm_order][j])
                 fnlo.CalcCrossSection()
                 xs_all_oneplot = np.array(fnlo.GetCrossSection())
-                print "\n","Cross Section with all subprocesses included in %s: \n" %norm_order
-                print xs_all_oneplot, "\n \n"
+                print("\n","Cross Section with all subprocesses included in %s: \n" %norm_order)
+                print(xs_all_oneplot, "\n \n")
 
-                print "Subprocess Order: ", sp_order
+                print("Subprocess Order: ", sp_order)
                 for l in range(0,3):
                         fnlo.SetContributionON(fastnlo.kFixedOrder, l, b_order[sp_order][l])
                 xs_subproc_list = []
                 for i in range(0, len(args['subproc'])):        #go through subprocesses
                         subproc_name = args['subproc'][i]
-                        print 'Selected subprocess: %s' %subproc_name
+                        print('Selected subprocess: %s' %subproc_name)
                         fnlo.SelectProcesses(subproc_name, True) #optional second argument: symmetric==True per default
                         fnlo.CalcCrossSection()
                         xs_subproc = np.array(fnlo.GetCrossSection())
                         xs_subproc_list.append(xs_subproc)
-                        print "XS for subprocess %s in %s: \n" %(subproc_name, sp_order)
-                        print xs_subproc, '\n \n'
+                        print("XS for subprocess %s in %s: \n" %(subproc_name, sp_order)
+                        print(xs_subproc, '\n \n')
                 xs_sub_oneplot = np.array(xs_subproc_list)
-                print "XS of the selected processes in different pTZ-regions in %s: " %sp_order
-                print xs_sub_oneplot, "\n \n"
+                print("XS of the selected processes in different pTZ-regions in %s: " %sp_order)
+                print(xs_sub_oneplot, "\n \n")
 
                 #calculate fraction of subprocess in sp_order on total XS in norm_order
                 fractions_sub_oneplot = []
                 for k in range(0, len(args['subproc'])):
                         fractions_sub_oneplot.append(np.divide(xs_sub_oneplot[k,:], xs_all_oneplot[:]))
                 fractions_oneplot = np.array(fractions_sub_oneplot)
-                print "--------------------------------------------------------------"
-                print "Fractions for subprocesses in %s to total XS in %s" %(sp_order, norm_order)
-                print fractions_oneplot, "\n"
-                print "--------------------------------------------------------------"
+                print("--------------------------------------------------------------")
+                print("Fractions for subprocesses in %s to total XS in %s" %(sp_order, norm_order))
+                print(fractions_oneplot, "\n")
+                print("--------------------------------------------------------------")
 
                 #checking whether contribution is positive or negative
                 pos_contr = np.array(fractions_oneplot)
@@ -554,23 +554,23 @@ def main():
                                         pos_contr[i,j] = 0.0
                                 else:
                                         neg_contr[i,j] = 0.0
-                        print 'Positive contributions of %s in %s on total XS in %s: \n' %(args['subproc'][i], sp_order, norm_order)
-                        print pos_contr[i,:], '\n'
-                        print 'Negative contributions of %s in %s on total XS in %s: \n' %(args['subproc'][i], sp_order, norm_order)
-                        print neg_contr[i,:], '\n \n'
+                        print('Positive contributions of %s in %s on total XS in %s: \n' %(args['subproc'][i], sp_order, norm_order))
+                        print(pos_contr[i,:], '\n')
+                        print('Negative contributions of %s in %s on total XS in %s: \n' %(args['subproc'][i], sp_order, norm_order))
+                        print(neg_contr[i,:], '\n \n')
 
-                print 'Summary of positive and negative contributions of the subprocesses: \n'
-                print "positive: \n", pos_contr, '\n'
-                print "negative: \n", neg_contr, '\n'
+                print('Summary of positive and negative contributions of the subprocesses: \n')
+                print("positive: \n", pos_contr, '\n')
+                print("negative: \n", neg_contr, '\n')
 
 
                 ######################## One-Plot-PLOTTING #########################################
                 #Bins for x-axis (according to first pdf (0))
                 bin_bounds = np.array(fnlo.GetObsBinsBounds(0))
-                print 'bin bounds:', bin_bounds.flatten()
+                print('bin bounds:', bin_bounds.flatten())
 
                 #Check whether comparison-plot or single-plot is required:
-                print 'Single plots for each process?: ', args['extraplot']
+                print('Single plots for each process?: ', args['extraplot'])
                 if (args['extraplot']==False):          #stackplot that compares the contribution of the subprocesses to the total XS
                         plt.close()
 
@@ -604,8 +604,8 @@ def main():
                                 xlim = ax0.get_xlim()
                                 ylim = ax0.get_ylim()
 
-                                print 'xlim:', xlim
-                                print 'ylim:', ylim, '\n'
+                                print('xlim:', xlim)
+                                print('ylim:', ylim, '\n')
 
                                 xmin_ = xlim[0]
                                 xmax_ = xlim[1]
@@ -620,16 +620,16 @@ def main():
                                                 if ylow < yhigh:
                                                         ax0.axis([0, xmax_, ylow, yhigh])
                                                 else:
-                                                        print " # ERROR! when trying to set y-limits."
-                                                        print "Check choice of y-limits. First value should be lower than second."
-                                                        print "Syntax: -c <lower ylimit> <higher ylimit>."
+                                                        print(" # ERROR! when trying to set y-limits.")
+                                                        print("Check choice of y-limits. First value should be lower than second.")
+                                                        print("Syntax: -c <lower ylimit> <higher ylimit>.")
                                                         break
                                         elif (len(args['constyaxis'])==0):      #set constant y-axis
                                                 ax0.axis([0, xmax_, -0.20, 1.20])
                                         else:
-                                                print " # ERROR! when trying to set y-limits."
-                                                print "Something went wrong. Check input after -c."
-                                                print "Possible: no value, two values or don't use -c at all for flexible axis. \n"
+                                                print(" # ERROR! when trying to set y-limits.")
+                                                print("Something went wrong. Check input after -c.")
+                                                print("Possible: no value, two values or don't use -c at all for flexible axis. \n")
                                                 break
                                 elif (args['constyaxis'] is None):      #use flexible y-axis
                                         ax0.set_xlim(xmin_, xmax_) ##
@@ -662,14 +662,14 @@ def main():
                                 stackplotname = '%s.stackplot_%s.png' %(tablename, sp_order+'_'+norm_order)
                         fig0.savefig(stackplotname, bbox_inches='tight')
 
-                        print 'Stackplot for subprocess comparison saved as: %s' %(stackplotname)
+                        print('Stackplot for subprocess comparison saved as: %s' %(stackplotname))
 
 
 
                 else:
-                        print "\n"
-                        print "----------------------------------------------------------"
-                        print "Create individual plot for each single subprocess \n"
+                        print("\n")
+                        print("----------------------------------------------------------")
+                        print("Create individual plot for each single subprocess \n")
 
                         #individual plot for each subproc
                         #create folder for saving the plots, will be overwritten in case it already exists (avoid countless folders while testing)
@@ -721,16 +721,16 @@ def main():
                                                 if ylow < yhigh:
                                                         ax0.axis([0, xmax_, ylow, yhigh])
                                                 else:
-                                                        print " # ERROR! when trying to set y-limits."
-                                                        print "Check choice of y-limits. First value should be lower than second."
-                                                        print "Syntax: -c <lower ylimit> <higher ylimit>."
+                                                        print(" # ERROR! when trying to set y-limits.")
+                                                        print("Check choice of y-limits. First value should be lower than second.")
+                                                        print("Syntax: -c <lower ylimit> <higher ylimit>.")
                                                         break
                                         elif (len(args['constyaxis'])==0):      #set constant y-axis
                                                 ax0.axis([0, xmax_, -0.20, 1.20])
                                         else:
-                                                print " # ERROR! when trying to set y-limits."
-                                                print "Something went wrong. Check input after -c."
-                                                print "Possible: no value, two values or don't use -c at all for flexible axis. \n"
+                                                print(" # ERROR! when trying to set y-limits.")
+                                                print("Something went wrong. Check input after -c.")
+                                                print("Possible: no value, two values or don't use -c at all for flexible axis. \n")
                                                 break
                                 elif (args['constyaxis'] is None):      #use flexible y-axis
                                         ax0.set_xlim(xmin_, xmax_) ##
@@ -759,13 +759,13 @@ def main():
 
                                 #save the plots
                                 fig0.savefig(os.path.join(final_dir,plotname))
-                                print 'Plot saved in %s' %(final_dir)
-                                print 'fraction plot saved as: %s' %(plotname), "\n \n"
+                                print('Plot saved in %s' %(final_dir))
+                                print('fraction plot saved as: %s' %(plotname), "\n \n")
 
 
 
         else:
-                print "Something went wrong. Check choice of order(s). \n"
+                print("Something went wrong. Check choice of order(s). \n")
 
 
 
@@ -775,12 +775,12 @@ def main():
 
 """ #other alternative possibility to switch orders on/off
                 for order, setting in sorted(b_order.iteritems()): #go through tuples in b_order, evaluate
-                        print "\n", "order: ", order
-                        print "setting: ", setting
+                        print("\n", "order: ", order)
+                        print("setting: ", setting)
                         index=0
                         for j in setting:
-                                print "index", index
-                                print "j", j
+                                print("index", index)
+                                print("j", j)
                                 fnlo.SetContributionON(fastnlo.kFixedOrder,index,j);
                                 index+=1
 """
-- 
GitLab