Skip to content
Snippets Groups Projects
Commit 977a5f99 authored by Klaus Rabbertz's avatar Klaus Rabbertz
Browse files

Drop python2 stuff in plotting script

parent 97675a29
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3 #!/usr/bin/env python3
#-*- coding:utf-8 -*- # -*- coding:utf-8 -*-
# #
######################################################################## ########################################################################
# #
...@@ -9,10 +9,13 @@ ...@@ -9,10 +9,13 @@
# #
######################################################################## ########################################################################
# #
# python2 compatibility # fastNLO for direct evaluation of interpolation grids
from __future__ import absolute_import # ATTENTION: fastNLO python extension is required for Python 3!
from __future__ import division from fastnlo import SetGlobalVerbosity
from __future__ import print_function from fastnlo import fastNLOLHAPDF
import fastnlo
import numpy as np
import matplotlib.pyplot as plt
import argparse import argparse
import glob import glob
import os import os
...@@ -22,7 +25,8 @@ import sys ...@@ -22,7 +25,8 @@ import sys
import timeit import timeit
import matplotlib as mpl import matplotlib as mpl
import matplotlib.gridspec as gridspec 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 from matplotlib import cm
# We do not want any interactive plotting! Figures are saved to files instead. # 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! # This also avoids the ANNOYANCE of frequently missing Tkinter/tkinter (python2/3) GUI backends!
...@@ -56,20 +60,17 @@ else: ...@@ -56,20 +60,17 @@ else:
useagg = True useagg = True
try: try:
mpl.use(backend, force=True) 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: except:
useagg = False useagg = False
print('[fastnnlo_statunc]: Can not use agg backend :-(') 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') mpl.use('agg')
import matplotlib.pyplot as plt
# numpy # numpy
import numpy as np
# fastNLO for direct evaluation of interpolation grids # fastNLO for direct evaluation of interpolation grids
# ATTENTION: fastNLO python extension is required for Python 3! # ATTENTION: fastNLO python extension is required for Python 3!
import fastnlo
from fastnlo import fastNLOLHAPDF
from fastnlo import SetGlobalVerbosity
#import warnings #import warnings
#warnings.filterwarnings("error") #warnings.filterwarnings("error")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment