""" plot_osoto_sipm_pde python script to access the halld_sipm data base (created by Yi) and plot SiPM properties The values are then histogramed. """ import os import subprocess import numpy from matplotlib import pyplot as plt from datetime import datetime, date, time, timedelta from matplotlib.backends.backend_pdf import PdfPages Vover = 1.2 variation ="scaled" # create list of file names filenames = [] runs = [0] figs = [] # create text file with data from osoto_sipm_dpe table. nfiles = 0 filenames.append("sipmfiles/osoto_sipm_V"+str(int(10*Vover))+".dat") command =["mysql","-hhallddb.jlab.org","-uhalld","-pGlueX_00","halld_sipm","-e","select * from osoto_sipm_pde where voltage_over="+str(Vover)+";"] # command =["mysql","-hhallddb.jlab.org","-uhalld","-pGlueX_00","halld_sipm","-e","select * from osoto_sipm_pde where voltage_over="+str(Vover)+" and remark like 'UTFSM' limit 10;"] print "command=",command fout = open(filenames[nfiles],"w") subprocess.call(command,stdout=fout) fout.close() # create text file with data from sipm_spec nfiles = 1 filenames.append("sipmfiles/sipm_spec.dat") command =["mysql","-hhallddb.jlab.org","-uhalld","-pGlueX_00","halld_sipm","-e","select * from sipm_spec;"] print "command=",command fout = open(filenames[nfiles],"w") subprocess.call(command,stdout=fout) fout.close() # extract information from Hamamatsu specifications fin = open(filenames[1],"r") snH_in = [] DRhamamatsu_in = [] Vdict = {} entries = 0 for line in fin: entries += 1 linew = line.split() if entries == 1: for token in linew: print "First line dump, num tokens=",len(linew)," token=",token continue # discard firt entry snH_in.append(float(linew[0])) DRhamamatsu_in.append(float(linew[4])/16) # conver from array rate to ave cell rate Vdict[float(linew[0])] = float(linew[1]) entries -= 1 print "\nNumber of entries=",entries," for ",fin print "Number of entries for spec file",len(DRhamamatsu_in) fin.close() # convert to numpy arrays for plotting snH = numpy.array(snH_in) DR25 = numpy.array(DRhamamatsu_in) # now read file and plot fin = open(filenames[0],"r") sn_in = [] temp_in = [] voltage_over_in = [] voltage_in = [] voltage_Ham_br_in = [] pde_in5 = [] pde_in7 = [] pde_in15 = [] pde_in20 = [] DR_in5 = [] DR_in7 = [] DR_in15 = [] DR_in20 = [] gain_in5 = [] gain_in7 = [] gain_in15 = [] gain_in20 = [] xtalk_in5 = [] xtalk_in7 = [] xtalk_in15 = [] xtalk_in20 = [] entries = 0 nplots = 0 for line in fin: entries += 1 linew = line.split() if entries == 1: for token in linew: print "First line dump, num tokens=",len(linew)," token=",token continue # discard firt entry sn_in.append(float(linew[0])) if linew[1] == 'NULL': temp_in.apped(0.) voltage_over_in.append(0.) voltage_in.append(0.) voltage_Ham_br.append(0.) else: temp_in.append(float(linew[1])) voltage_over_in.append(float(linew[4])) voltage_in.append(float(linew[9])) if linew[10] == 'NULL': voltage_Ham_br_in.append(0.) else: voltage_Ham_br_in.append(float(linew[10])) # slice data on temperature # pdefactor12 = 1 pdefactor12 = 0.294/0.231 # scale factor for UTFSM from paper Eq 1.2/0.9 if linew[13] == 'NULL': if float(linew[1]) == 5: pde_in5.append(0.) elif float(linew[1]) == 7: pde_in7.append(0.) elif float(linew[1]) == 15: pde_in15.append(0.) elif float(linew[1]) == 20: pde_in20.append(0.) else: if float(linew[1]) == 5: pde_in5.append(float(linew[13])*pdefactor12) elif float(linew[1]) == 7: pde_in7.append(float(linew[13])*pdefactor12) elif float(linew[1]) == 15: pde_in15.append(float(linew[13])) elif float(linew[1]) == 20: pde_in20.append(float(linew[13])*pdefactor12) # DRfactor12 = 1 # DRfactor12 = 0.049/0.036 # scale factor to UTFSM eq soto 2013 DRfactor12 = 2.3 # scale factor to UTFSM eq soto 2014 if linew[11] == 'NULL': if float(linew[1]) == 5: DR_in5.append(0.) elif float(linew[1]) == 7: DR_in7.append(0.) elif float(linew[1]) == 15: DR_in15.append(0.) elif float(linew[1]) == 20: DR_in20.append(0.) else: if float(linew[1]) == 5: DR_in5.append(float(linew[11])*DRfactor12) elif float(linew[1]) == 7: DR_in7.append(float(linew[11])*DRfactor12) elif float(linew[1]) == 15: DR_in15.append(float(linew[11])) elif float(linew[1]) == 20: DR_in20.append(float(linew[11])*DRfactor12) # gainfactor12 = 1 gainfactor12 = 6.12/4.59 # scale factor for UTFSM Eq if linew[15] == 'NULL': if float(linew[1]) == 5: gain_in5.append(0.) elif float(linew[1]) == 7: gain_in7.append(0.) elif float(linew[1]) == 15: gain_in15.append(0.) elif float(linew[1]) == 20: gain_in20.append(0.) else: if float(linew[1]) == 5: gain_in5.append(float(linew[15])*gainfactor12) elif float(linew[1]) == 7: gain_in7.append(float(linew[15])*gainfactor12) elif float(linew[1]) == 15: gain_in15.append(float(linew[15])) elif float(linew[1]) == 20: gain_in20.append(float(linew[15])*gainfactor12) # xtalkfactor12 = 1 xtalkfactor12 = 0.237/0.130 # scale factor for UTFSM paper Eq if linew[17] == 'NULL': if float(linew[1]) == 5: xtalk_in5.append(0.) elif float(linew[1]) == 7: xtalk_in7.append(0.) elif float(linew[1]) == 15: xtalk_in15.append(0.) elif float(linew[1]) == 20: xtalk_in20.append(0.) else: if float(linew[1]) == 5: xtalk_in5.append(float(linew[17])*xtalkfactor12) elif float(linew[1]) == 7: xtalk_in7.append(float(linew[17])*xtalkfactor12) elif float(linew[1]) == 15: xtalk_in15.append(float(linew[17])) elif float(linew[1]) == 20: xtalk_in20.append(float(linew[17])*xtalkfactor12) entries -= 1 print "\nNumber of entries=",entries," for ",fin print "Number of entries at 5 deg=",len(pde_in5) print "Number of entries at 7 deg=",len(pde_in7) print "Number of entries at 15 deg=",len(pde_in15) print "Number of entries at 20 deg=",len(pde_in20) print "Total 5 deg + 15 deg=",len(pde_in5)+len(pde_in15),"\n" # print "pde=",pde_in fin.close() Vbr_diff_in = [] # check consistency between spec and orlando data bases for (ndx,serial) in enumerate(sn_in): Vbr_calc = voltage_in[ndx] - voltage_over_in[ndx] + 0.0565*(25-temp_in[ndx]) if temp_in[ndx]==5 or temp_in[ndx]==7 or temp_in[ndx]==15 or temp_in[ndx]==20: Vbr_diff_in.append(Vbr_calc - (Vdict[serial]-0.9)) else: Vbr_diff_in.append(-1.5) # print "serial number=",serial," Temp=",temp_in[ndx]," Vover=",voltage_over_in[ndx]," Vbr_dict=",Vdict[serial]-0.9," Vbr_calc=",Vbr_calc," voltage=",voltage_in[ndx]," Vbr Hamamatsu=",voltage_Ham_br_in[ndx] # convert to numpy arrays for plotting sn = numpy.array(sn_in) temp = numpy.array(temp_in) pde5 = numpy.array(pde_in5) pde7 = numpy.array(pde_in7) pde15 = numpy.array(pde_in15) pde20 = numpy.array(pde_in20) DR5 = numpy.array(DR_in5) DR7 = numpy.array(DR_in7) DR15 = numpy.array(DR_in15) DR20 = numpy.array(DR_in20) gain5 = numpy.array(gain_in5) gain7 = numpy.array(gain_in7) gain15 = numpy.array(gain_in15) gain20 = numpy.array(gain_in20) xtalk5 = numpy.array(xtalk_in5) xtalk7 = numpy.array(xtalk_in7) xtalk15 = numpy.array(xtalk_in15) xtalk20 = numpy.array(xtalk_in20) Vbr_diff = numpy.array(Vbr_diff_in) numpy.set_printoptions(threshold='nan') # print "Length 5=",len(DR5),"DR5=", DR5,"\n\n" # print "Length 15=",len(DR15),"DR15=", DR15,"\n\n" fig = plt.figure(1) figs.append(fig) nbins = 100 nsub = 1 xmin = 0 xmax = 5000 plt.subplot(2,2,nsub) binwidth = (xmax-xmin)/float(nbins) n, bins, patches = plt.hist(sn,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='black',log=False) plt.ylabel("Entries") plt.xlabel("Serial Number") plt.title("Vover="+str(Vover)+" V, "+variation) plt.axis([xmin,xmax,0,10000]) plt.autoscale(enable=True,axis='y') nbins = 30 nsub = 2 plt.subplot(2,2,nsub) xmin = 0 xmax = 30 binwidth = (xmax-xmin)/float(nbins) n, bins, patches = plt.hist(temp,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='red',log=False) plt.ylabel("Entries") plt.xlabel("Temperature (degC)") ymin, ymax = plt.ylim() print "ymin, ymax=",ymin,ymax plt.axis([xmin,xmax,0,1.1*ymax]) # plt.autoscale(enable=True,axis='y') nbins = 100 nsub = 3 plt.subplot(2,2,nsub) xmin = 0.1 xmax = 0.4 binwidth = (xmax-xmin)/float(nbins) # compute averages aveUTFSM = numpy.average(pde5) aveJLab = numpy.average(pde15) print "PDE aveUTFSM=", aveUTFSM, "aveJLab=",aveJLab n, bins, patches = plt.hist(pde5,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='blue',label='='+'{:.3f}'.format(aveUTFSM),log=False) # n, bins, patches = plt.hist(pde7,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='black',log=False) n, bins, patches = plt.hist(pde15,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='red',label=' ='+'{:.3f}'.format(aveJLab),log=False) # n, bins, patches = plt.hist(pde20,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='green',log=False) plt.ylabel("Entries") plt.xlabel("PDE") plt.axis([xmin,xmax,0,500]) # plt.title("Vover="+str(Vover)+" V, "+variation) plt.legend() # plt.autoscale(enable=True,axis='y') nbins = 100 nsub = 4 plt.subplot(2,2,nsub) xmin = 0. xmax = 5 binwidth = (xmax-xmin)/float(nbins) # compute averages DRave5 = numpy.average(DR5) DRave7 = numpy.average(DR7) DRave15 = numpy.average(DR15) DRave20 = numpy.average(DR20) DRave25 = numpy.average(DR25) print "DR ave5=", DRave5, "ave7=",DRave7, "ave15=",DRave15, "ave20=",DRave20," ave25=",DRave25 print "DR JLab max=",numpy.amax(DR15)," minimum=",numpy.amin(DR15) n, bins, patches = plt.hist(DR5,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='blue',label='='+'{:.3f}'.format(DRave5),log=True) n, bins, patches = plt.hist(DR7,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='black',label='='+'{:.3f}'.format(DRave7),log=False) n, bins, patches = plt.hist(DR15,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='red',label='='+'{:.3f}'.format(DRave15),log=True) n, bins, patches = plt.hist(DR20,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='green',label='='+'{:.3f}'.format(DRave20),log=False) n, bins, patches = plt.hist(DR25,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='orange',label='='+'{:.3f}'.format(DRave25),log=False) plt.ylabel("Entries") plt.xlabel("Dark Rate (MHz)") plt.axis([xmin,xmax,1,10000]) # plt.title("Vover="+str(Vover)+" V, "+variation) plt.legend() # plt.autoscale(enable=True,axis='y') plt.tight_layout() fig = plt.figure(2) figs.append(fig) nbins = 100 nsub = 1 plt.subplot(2,2,nsub) xmin = -1.5 xmax = 1.5 binwidth = (xmax-xmin)/float(nbins) n, bins, patches = plt.hist(Vbr_diff,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='blue',log=False) plt.ylabel("Entries") plt.xlabel("Vbr Calc - Hamamatsu") plt.title("Vover="+str(Vover)+" V, "+variation) ymin, ymax = plt.ylim() print "ymin, ymax=",ymin,ymax plt.axis([xmin,xmax,0,1.1*ymax]) # plt.autoscale(enable=True,axis='y') plt.tight_layout() fig = plt.figure(3) figs.append(fig) nbins = 100 nsub = 1 plt.subplot(2,2,nsub) xmin = 0. xmax = 10 binwidth = (xmax-xmin)/float(nbins) # compute averages gainave5 = numpy.average(gain5) gainave7 = numpy.average(gain7) gainave15 = numpy.average(gain15) gainave20 = numpy.average(gain20) # gainave25 = numpy.average(gain25) print "gain ave5=", gainave5, "ave7=",gainave7, "ave15=",gainave15, "ave20=",gainave20 # print "gain ave25=",gainave25 print "gain JLab max=",numpy.amax(gain15)," minimum=",numpy.amin(gain15) n, bins, patches = plt.hist(gain5,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='blue',label='='+'{:.2f}'.format(gainave5),log=False) plt.ylabel("Entries") plt.xlabel("Gain (x10^5)") # plt.title("Vover="+str(Vover)+" V, "+variation) plt.legend() ymin, ymax = plt.ylim() print "ymin, ymax=",ymin,ymax plt.axis([xmin,xmax,0,1.5*ymax]) # plt.autoscale(enable=True,axis='y') nbins = 100 nsub = 2 plt.subplot(2,2,nsub) xmin = 0. xmax = 10 binwidth = (xmax-xmin)/float(nbins) n, bins, patches = plt.hist(gain7,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='blue',label='='+'{:.2f}'.format(gainave7),log=False) plt.ylabel("Entries") plt.xlabel("Gain (x10^5)") # plt.title("Vover="+str(Vover)+" V, "+variation) plt.legend() ymin, ymax = plt.ylim() print "ymin, ymax=",ymin,ymax plt.axis([xmin,xmax,0,1.5*ymax]) # plt.autoscale(enable=True,axis='y') nbins = 100 nsub = 3 plt.subplot(2,2,nsub) xmin = 0. xmax = 10 binwidth = (xmax-xmin)/float(nbins) n, bins, patches = plt.hist(gain15,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='red',label='='+'{:.2f}'.format(gainave15),log=False) plt.ylabel("Entries") plt.xlabel("Gain (x10^5)") # plt.title("Vover="+str(Vover)+" V, "+variation) plt.legend() ymin, ymax = plt.ylim() print "ymin, ymax=",ymin,ymax plt.axis([xmin,xmax,0,1.5*ymax]) # plt.autoscale(enable=True,axis='y') nbins = 100 nsub = 4 plt.subplot(2,2,nsub) xmin = 0. xmax = 10 binwidth = (xmax-xmin)/float(nbins) n, bins, patches = plt.hist(gain20,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='blue',label='='+'{:.2f}'.format(gainave20),log=False) plt.ylabel("Entries") plt.xlabel("Gain (x10^5)") # plt.title("Vover="+str(Vover)+" V, "+variation) plt.legend() ymin, ymax = plt.ylim() print "ymin, ymax=",ymin,ymax plt.axis([xmin,xmax,0,1.5*ymax]) # plt.autoscale(enable=True,axis='y') plt.tight_layout() fig = plt.figure(4) figs.append(fig) nbins = 50 nsub = 1 # plt.subplot(2,2,nsub) xmin = 0. xmax = 3 binwidth = (xmax-xmin)/float(nbins) print "DR JLab max=",numpy.amax(DR15)," minimum=",numpy.amin(DR15) n, bins, patches = plt.hist(DR5,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='blue',label='='+'{:.3f}'.format(DRave5),log=True) n, bins, patches = plt.hist(DR7,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='black',label='='+'{:.3f}'.format(DRave7),log=False) n, bins, patches = plt.hist(DR15,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='red',label='='+'{:.3f}'.format(DRave15),log=True) n, bins, patches = plt.hist(DR20,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='green',label='='+'{:.3f}'.format(DRave20),log=False) n, bins, patches = plt.hist(DR25,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='orange',label='='+'{:.3f}'.format(DRave25),log=False) plt.ylabel("Entries") plt.xlabel("Dark Rate (MHz)") plt.axis([xmin,xmax,1,10000]) plt.title("Vover="+str(Vover)+" V, "+variation) plt.legend() # plt.autoscale(enable=True,axis='y') plt.tight_layout() fig = plt.figure(5) figs.append(fig) nbins = 100 nsub = 1 # plt.subplot(2,2,nsub) xmin = 0. xmax = 10 binwidth = (xmax-xmin)/float(nbins) n, bins, patches = plt.hist(gain15,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='red',label='='+'{:.2f}'.format(gainave15),log=False) n, bins, patches = plt.hist(gain20,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='blue',label='='+'{:.2f}'.format(gainave20),log=False) plt.ylabel("Entries") plt.xlabel("Gain (x10^5)") plt.axis([xmin,xmax,1,600]) plt.title("Vover="+str(Vover)+" V, "+variation) plt.legend() ymin, ymax = plt.ylim() # plt.axis([xmin,xmax,0,1.5*ymax]) # plt.autoscale(enable=True,axis='y') plt.tight_layout() fig = plt.figure(6) figs.append(fig) nbins = 100 nsub = 1 plt.subplot(2,2,nsub) xmin = 0. xmax = 0.5 binwidth = (xmax-xmin)/float(nbins) # compute averages xtalkave5 = numpy.average(xtalk5) xtalkave7 = numpy.average(xtalk7) xtalkave15 = numpy.average(xtalk15) xtalkave20 = numpy.average(xtalk20) # xtalkave25 = numpy.average(xtalk25) print "xtalk ave5=", xtalkave5, "ave7=",xtalkave7, "ave15=",xtalkave15, "ave20=",xtalkave20 # print "xtalk ave25=",xtalkave25 print "xtalk JLab max=",numpy.amax(xtalk15)," minimum=",numpy.amin(xtalk15) n, bins, patches = plt.hist(xtalk5,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='blue',label='='+'{:.3f}'.format(xtalkave5),log=False) plt.ylabel("Entries") plt.xlabel("Cross Talk") # plt.title("Vover="+str(Vover)+" V, "+variation) plt.legend() ymin, ymax = plt.ylim() print "ymin, ymax=",ymin,ymax plt.axis([xmin,xmax,0,1.5*ymax]) # plt.autoscale(enable=True,axis='y') nbins = 100 nsub = 2 plt.subplot(2,2,nsub) xmin = 0. xmax = 0.5 binwidth = (xmax-xmin)/float(nbins) n, bins, patches = plt.hist(xtalk7,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='blue',label='='+'{:.3f}'.format(xtalkave7),log=False) plt.ylabel("Entries") plt.xlabel("Cross Talk") # plt.title("Vover="+str(Vover)+" V, "+variation) plt.legend() ymin, ymax = plt.ylim() print "ymin, ymax=",ymin,ymax plt.axis([xmin,xmax,0,1.5*ymax]) # plt.autoscale(enable=True,axis='y') nbins = 100 nsub = 3 plt.subplot(2,2,nsub) xmin = 0. xmax = 0.5 binwidth = (xmax-xmin)/float(nbins) n, bins, patches = plt.hist(xtalk15,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='red',label='='+'{:.3f}'.format(xtalkave15),log=False) plt.ylabel("Entries") plt.xlabel("Cross Talk") # plt.title("Vover="+str(Vover)+" V, "+variation) plt.legend() ymin, ymax = plt.ylim() print "ymin, ymax=",ymin,ymax plt.axis([xmin,xmax,0,1.5*ymax]) # plt.autoscale(enable=True,axis='y') nbins = 100 nsub = 4 plt.subplot(2,2,nsub) xmin = 0. xmax = 0.5 binwidth = (xmax-xmin)/float(nbins) n, bins, patches = plt.hist(xtalk20,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='blue',label='='+'{:.3f}'.format(xtalkave20),log=False) plt.ylabel("Entries") plt.xlabel("Cross Talk") # plt.title("Vover="+str(Vover)+" V, "+variation) plt.legend() ymin, ymax = plt.ylim() print "ymin, ymax=",ymin,ymax plt.axis([xmin,xmax,0,1.5*ymax]) # plt.autoscale(enable=True,axis='y') plt.tight_layout() fig = plt.figure(7) figs.append(fig) nbins = 100 nsub = 1 # plt.subplot(2,2,nsub) xmin = 0. xmax = 0.5 binwidth = (xmax-xmin)/float(nbins) n, bins, patches = plt.hist(xtalk15,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='red',label='='+'{:.2f}'.format(xtalkave15),log=False) n, bins, patches = plt.hist(xtalk20,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='blue',label='='+'{:.2f}'.format(xtalkave20),log=False) plt.ylabel("Entries") plt.xlabel("Cross Talk") plt.axis([xmin,xmax,1,600]) plt.title("Vover="+str(Vover)+" V, "+variation) plt.legend() ymin, ymax = plt.ylim() # plt.axis([xmin,xmax,0,1.5*ymax]) # plt.autoscale(enable=True,axis='y') plt.tight_layout() fig = plt.figure(8) figs.append(fig) params = {'legend.fontsize': 8, 'legend.linewidth': 2} plt.rcParams.update(params) nbins = 100 nsub = 1 plt.subplot(2,2,nsub) xmin = 0. xmax = 10 binwidth = (xmax-xmin)/float(nbins) n, bins, patches = plt.hist(gain15,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='red',label='='+'{:.2f}'.format(gainave15),log=False) n, bins, patches = plt.hist(gain20,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='blue',label='='+'{:.2f}'.format(gainave20),log=False) plt.ylabel("Entries") plt.xlabel("Gain (x10^5)") plt.axis([xmin,xmax,1,600]) plt.title("Vover="+str(Vover)+" V, "+variation) plt.legend() ymin, ymax = plt.ylim() # plt.axis([xmin,xmax,0,1.5*ymax]) # plt.autoscale(enable=True,axis='y') nbins = 100 nsub = 2 plt.subplot(2,2,nsub) xmin = 0.1 xmax = 0.4 binwidth = (xmax-xmin)/float(nbins) # compute averages pdeave20= numpy.average(pde20) pdeave15 = numpy.average(pde15) print "PDE aveUTFSM=", aveUTFSM, "aveJLab=",aveJLab # n, bins, patches = plt.hist(pde5,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='blue',label='='+'{:.3f}'.format(pdeave5),log=False) # n, bins, patches = plt.hist(pde7,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='black',log=False) n, bins, patches = plt.hist(pde15,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='red',label=' ='+'{:.3f}'.format(pdeave15),log=False) n, bins, patches = plt.hist(pde20,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='blue',label='='+'{:.3f}'.format(pdeave20),log=False) plt.ylabel("Entries") plt.xlabel("PDE") plt.axis([xmin,xmax,0,500]) # plt.title("Vover="+str(Vover)+" V, "+variation) plt.legend() # plt.autoscale(enable=True,axis='y') nbins = 50 nsub = 3 plt.subplot(2,2,nsub) xmin = 0. xmax = 3 binwidth = (xmax-xmin)/float(nbins) print "DR JLab max=",numpy.amax(DR15)," minimum=",numpy.amin(DR15) n, bins, patches = plt.hist(DR5,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='green',label=' (T=5)='+'{:.3f}'.format(DRave5),log=True) n, bins, patches = plt.hist(DR7,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='black',label='(T=7)='+'{:.3f}'.format(DRave7),log=False) n, bins, patches = plt.hist(DR15,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='red',label=' (T=15)='+'{:.3f}'.format(DRave15),log=True) n, bins, patches = plt.hist(DR20,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='blue',label=' (T=20)='+'{:.3f}'.format(DRave20),log=False) n, bins, patches = plt.hist(DR25,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='orange',label=' (T=25)='+'{:.3f}'.format(DRave25),log=False) plt.ylabel("Entries") plt.xlabel("Dark Rate (MHz)") plt.axis([xmin,xmax,1,100000]) # plt.title("Vover="+str(Vover)+" V, "+variation) plt.legend() # plt.autoscale(enable=True,axis='y') nbins = 100 nsub = 4 plt.subplot(2,2,nsub) xmin = 0. xmax = 0.5 binwidth = (xmax-xmin)/float(nbins) n, bins, patches = plt.hist(xtalk15,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='red',label='='+'{:.2f}'.format(xtalkave15),log=False) n, bins, patches = plt.hist(xtalk20,bins=numpy.arange(xmin,xmax,binwidth),histtype='step',color='blue',label='='+'{:.2f}'.format(xtalkave20),log=False) plt.ylabel("Entries") plt.xlabel("Cross Talk") plt.axis([xmin,xmax,1,600]) # plt.title("Vover="+str(Vover)+" V, "+variation) plt.legend() ymin, ymax = plt.ylim() # plt.axis([xmin,xmax,0,1.5*ymax]) # plt.autoscale(enable=True,axis='y') plt.tight_layout() # plt.show() pdfname = "plot_osoto_sipm_pde_V"+str(int(10*Vover))+".pdf" print "PDF filename=",pdfname with PdfPages(pdfname) as pdf: for fig in figs: pdf.savefig(fig)