""" pass1.py """ import matplotlib, sys, os.path, numpy matplotlib.use('PDF') import pylab pass1A, pass1B, pass1C, pass1X, plot_file = sys.argv[1:6] def read_data(data_file): # Read in "data_file" as a 2-d array get_fields = lambda x:[float(x[7]), float(x[9])] f = open(data_file, 'r') data = [get_fields(x.split()) for x in f.xreadlines()] return numpy.array(data).T params = {'axes.labelsize': 12, 'text.fontsize': 10, 'legend.fontsize': 10, 'text.usetex': True, 'xtick.labelsize': 11, 'ytick.labelsize': 11} pylab.rcParams.update(params) for key,sym,file in [['A','rs',pass1A], ['B','go',pass1B], ['C','bD',pass1C], ['X','mx',pass1X]]: data = read_data(file) pylab.plot(data[0],data[1],sym) x = numpy.array([-1.9,7.8]) y = 2.39-.5*x pylab.plot(x,y,'m-') y = 2.55-.5*x pylab.plot(x,y,'k-') pylab.axis([-2,8,1.4,3.2]) pylab.xlabel(r'$llr$') pylab.ylabel(r'$R$') pylab.savefig(plot_file)