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

Start updating fnlo-compare-ab.py for py3

parent a94c8df8
Branches
Tags
No related merge requests found
#!/usr/bin/env python2 #!/usr/bin/env python3
#-*- coding:utf-8 -*- #-*- coding:utf-8 -*-
# #
# Make comparison plots between two predictions # Make comparison plots between two predictions
...@@ -15,7 +15,7 @@ import glob ...@@ -15,7 +15,7 @@ import glob
import os import os
import re import re
import sys import sys
from StringIO import StringIO from io import StringIO
import matplotlib.lines as mpllines import matplotlib.lines as mpllines
import matplotlib.gridspec as gridspec import matplotlib.gridspec as gridspec
import matplotlib.patches as mplpatches import matplotlib.patches as mplpatches
...@@ -30,9 +30,9 @@ import numpy as np ...@@ -30,9 +30,9 @@ import numpy as np
#from fnlo_parsers import FNLOCppReadOutputParser #from fnlo_parsers import FNLOCppReadOutputParser
#from fnlo_parsers import FNLOYodaOutputParser #from fnlo_parsers import FNLOYodaOutputParser
# fastNLO # fastNLO
#import fastnlo import fastnlo
#from fastnlo import fastNLOLHAPDF from fastnlo import fastNLOLHAPDF
#from fastnlo import SetGlobalVerbosity from fastnlo import SetGlobalVerbosity
# Redefine ScalarFormatter # Redefine ScalarFormatter
...@@ -105,16 +105,16 @@ def main(): ...@@ -105,16 +105,16 @@ def main():
exit(0) exit(0)
# Extract no. of columns from files # Extract no. of columns from files
print 'Reading no. of columns from 1st file ', afile print ('Reading no. of columns from 1st file ', afile)
cols = np.loadtxt(afile, comments=['#', ' #', 'C', 'L']) cols = np.loadtxt(afile, comments=['#', ' #', 'C', 'L'])
nacol = cols.shape[1] nacol = cols.shape[1]
print 'Found ', nacol, ' columns' print ('Found ', nacol, ' columns')
print 'Reading no. of columns from 2nd file ', bfile print ('Reading no. of columns from 2nd file ', bfile)
cols = np.loadtxt(bfile, comments=['#', ' #', 'C', 'L']) cols = np.loadtxt(bfile, comments=['#', ' #', 'C', 'L'])
nbcol = cols.shape[1] nbcol = cols.shape[1]
print 'Found ', nbcol, ' columns' print ('Found ', nbcol, ' columns')
if nacol != nbcol: if nacol != nbcol:
print 'Different no. of columns found, aborted!' print ('Different no. of columns found, aborted!')
exit(1) exit(1)
ncol = nacol ncol = nacol
...@@ -125,7 +125,7 @@ def main(): ...@@ -125,7 +125,7 @@ def main():
iobsb, bwb, id0b, xlb, xub, xaveb, xsb_lo, xsb_nlo, kb_nlo = np.loadtxt(bfile, comments=['#', ' #', 'C', 'L'], dtype=[( iobsb, bwb, id0b, xlb, xub, xaveb, xsb_lo, xsb_nlo, kb_nlo = np.loadtxt(bfile, comments=['#', ' #', 'C', 'L'], dtype=[(
'f0', int), ('f1', float), ('f2', int), ('f3', float), ('f4', float), ('f5', float), ('f6', float), ('f7', float), ('f8', float)], unpack=True) 'f0', int), ('f1', float), ('f2', int), ('f3', float), ('f4', float), ('f5', float), ('f6', float), ('f7', float), ('f8', float)], unpack=True)
else: else:
print 'ncol different from 9 not yet implemented. Aborted!' print ('ncol different from 9 not yet implemented. Aborted!')
exit(2) exit(2)
exit(0) exit(0)
...@@ -136,10 +136,10 @@ nvala = iobsa.size ...@@ -136,10 +136,10 @@ nvala = iobsa.size
nvalb = iobsb.size nvalb = iobsb.size
nobsa = max(iobsa) nobsa = max(iobsa)
nobsb = max(iobsb) nobsb = max(iobsb)
print 'Found ', nvala, ' result lines for ', nobsa, ' observable bins in file ', afile print ('Found ', nvala, ' result lines for ', nobsa, ' observable bins in file ', afile)
print 'Found ', nvalb, ' result lines for ', nobsb, ' observable bins in file ', bfile print ('Found ', nvalb, ' result lines for ', nobsb, ' observable bins in file ', bfile)
if nvala != nvalb or nobsa != nobsb: if nvala != nvalb or nobsa != nobsb:
print 'nval or nobs different between the two files to compare, aborted!' print ('nval or nobs different between the two files to compare, aborted!')
exit(3) exit(3)
nobs = nobsa nobs = nobsa
nval = nvala nval = nvala
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment