From 977a5f995d9583f6b6b34b0f3a4565ca7e4be17b Mon Sep 17 00:00:00 2001 From: Klaus Rabbertz <klaus.rabbertz@cern.ch> Date: Wed, 25 Sep 2024 11:26:53 +0200 Subject: [PATCH] Drop python2 stuff in plotting script --- tools/plotting/fastnnlo_statunc.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/tools/plotting/fastnnlo_statunc.py b/tools/plotting/fastnnlo_statunc.py index 4b4bf3fa..11709f7f 100755 --- a/tools/plotting/fastnnlo_statunc.py +++ b/tools/plotting/fastnnlo_statunc.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -#-*- coding:utf-8 -*- +# -*- coding:utf-8 -*- # ######################################################################## # @@ -9,10 +9,13 @@ # ######################################################################## # -# python2 compatibility -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function +# fastNLO for direct evaluation of interpolation grids +# ATTENTION: fastNLO python extension is required for Python 3! +from fastnlo import SetGlobalVerbosity +from fastnlo import fastNLOLHAPDF +import fastnlo +import numpy as np +import matplotlib.pyplot as plt import argparse import glob import os @@ -22,7 +25,8 @@ import sys import timeit import matplotlib as mpl import matplotlib.gridspec as gridspec -from matplotlib.ticker import (FormatStrFormatter, LogFormatter, NullFormatter, ScalarFormatter, AutoMinorLocator, MultipleLocator) +from matplotlib.ticker import (FormatStrFormatter, LogFormatter, + NullFormatter, ScalarFormatter, AutoMinorLocator, MultipleLocator) from matplotlib import cm # We do not want any interactive plotting! Figures are saved to files instead. # This also avoids the ANNOYANCE of frequently missing Tkinter/tkinter (python2/3) GUI backends! @@ -56,20 +60,17 @@ else: useagg = True try: mpl.use(backend, force=True) - print('[fastnnlo_statunc]: Warning! Could not import cairo backend :-( Using agg instead for raster plots only!') + print( + '[fastnnlo_statunc]: Warning! Could not import cairo backend :-( Using agg instead for raster plots only!') except: useagg = False print('[fastnnlo_statunc]: Can not use agg backend :-(') - raise ImportError('[fastnnlo_statunc]: Neither cairo nor agg backend found :-( Cannot produce any plots. Good bye!') + raise ImportError( + '[fastnnlo_statunc]: Neither cairo nor agg backend found :-( Cannot produce any plots. Good bye!') mpl.use('agg') -import matplotlib.pyplot as plt # numpy -import numpy as np # fastNLO for direct evaluation of interpolation grids # ATTENTION: fastNLO python extension is required for Python 3! -import fastnlo -from fastnlo import fastNLOLHAPDF -from fastnlo import SetGlobalVerbosity #import warnings #warnings.filterwarnings("error") -- GitLab