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 -*-
#
# Make comparison plots between two predictions
......@@ -15,7 +15,7 @@ import glob
import os
import re
import sys
from StringIO import StringIO
from io import StringIO
import matplotlib.lines as mpllines
import matplotlib.gridspec as gridspec
import matplotlib.patches as mplpatches
......@@ -30,9 +30,9 @@ import numpy as np
#from fnlo_parsers import FNLOCppReadOutputParser
#from fnlo_parsers import FNLOYodaOutputParser
# fastNLO
#import fastnlo
#from fastnlo import fastNLOLHAPDF
#from fastnlo import SetGlobalVerbosity
import fastnlo
from fastnlo import fastNLOLHAPDF
from fastnlo import SetGlobalVerbosity
# Redefine ScalarFormatter
......@@ -105,16 +105,16 @@ def main():
exit(0)
# 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'])
nacol = cols.shape[1]
print 'Found ', nacol, ' columns'
print 'Reading no. of columns from 2nd file ', bfile
print ('Found ', nacol, ' columns')
print ('Reading no. of columns from 2nd file ', bfile)
cols = np.loadtxt(bfile, comments=['#', ' #', 'C', 'L'])
nbcol = cols.shape[1]
print 'Found ', nbcol, ' columns'
print ('Found ', nbcol, ' columns')
if nacol != nbcol:
print 'Different no. of columns found, aborted!'
print ('Different no. of columns found, aborted!')
exit(1)
ncol = nacol
......@@ -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=[(
'f0', int), ('f1', float), ('f2', int), ('f3', float), ('f4', float), ('f5', float), ('f6', float), ('f7', float), ('f8', float)], unpack=True)
else:
print 'ncol different from 9 not yet implemented. Aborted!'
print ('ncol different from 9 not yet implemented. Aborted!')
exit(2)
exit(0)
......@@ -136,10 +136,10 @@ nvala = iobsa.size
nvalb = iobsb.size
nobsa = max(iobsa)
nobsb = max(iobsb)
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 ', nvala, ' result lines for ', nobsa, ' observable bins in file ', afile)
print ('Found ', nvalb, ' result lines for ', nobsb, ' observable bins in file ', bfile)
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)
nobs = nobsa
nval = nvala
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment