def megaplot(ctsets, studyname, emisfops=None, labels=["$10^9$", "$10^8$", "$10^7$", "$10^6$"], axlabel='Primaries [nr]'): if len(ctsets) == 4: f, ((ax1, ax2), (ax3, ax4)) = plot.subplots(nrows=2, ncols=2, sharex=False, sharey=False) auger.plot_all_ranges_CTONLY(ax1, ctsets[0]) auger.plot_all_ranges_CTONLY(ax2, ctsets[1]) auger.plot_all_ranges_CTONLY(ax3, ctsets[2]) #auger.plot_all_ranges_CTONLY(ax4,ctsets[3]) if not 'Primaries' in axlabel: ax1.set_title(labels[0]) ax2.set_title(labels[1]) ax3.set_title(labels[2]) #ax4.set_title(labels[3]) f.subplots_adjust(hspace=.5) ax1.set_xlabel('') ax2.set_xlabel('') ax2.set_ylabel('') #ax4.set_ylabel('') f.savefig(studyname + '-' + typ + '-FOP.pdf', bbox_inches='tight') plot.close('all') ############################################################################################# # print 'FOP shift distributions' # from mpl_toolkits.mplot3d import Axes3D # import matplotlib.pyplot as plt # fig = plt.figure() # ax1 = plt.axes(projection='3d') # ax1.view_init(30, -50) # for i,ctset in enumerate(ctsets): # auger.plotfodiffdist(ax1,ctset,i,emisfops,labels,axlabel) # if not emisfops == None: # fopshifts=[] # for fopset in emisfops: # fopshifts.append( fopset[-1]-fopset[0] ) # ax1.set_xlim3d(np.mean(fopshifts)-20,np.mean(fopshifts)+20) # if emisfops is not None and len(emisfops) == 1: # ax1.set_title(studyname+', $Shift_{em}$ = '+str(emisfops[0][-1]-emisfops[0][0]), y=1.08) # #plt.tight_layout(rect = [-0.1, 0.0, 1.0, 1.1])#L,B,R,T # fig.savefig(studyname+'-'+typ+'-FOP-shift.pdf')#, bbox_inches='tight') # plt.close('all') ############################################################################################# # print 'FOP FOW Contrast DE averages over 10e9 ctset' f, (ax1, ax2, ax3) = plot.subplots(nrows=3, ncols=1, sharex=False, sharey=False) x = ctsets[0]['ct']['x'] y = ctsets[0]['ct']['av'] if 'iba' in ctsets[0]['name']: # ctset['name'] == typ mm = 4 / 0.8 if 'ipnl' in ctsets[0]['name']: mm = 8 falloff_pos, g_fwhm, contrast = auger.get_fop_fow_contrast( x, y, plot='wut', ax=ax1, ax2=ax2, ax3=ax3, smooth=0.2, filename=ctsets[0]['ct']['path'], contrast_divisor=ctsets[0]['nprim'] * len(ctsets[0]['ct']['files']) * mm, fitlines=False) print "NPRIM", ctsets[0]['nprim'], "NJOBS", len( ctsets[0]['ct']['files']), "MM", mm #gebruiken deze falloff_pos niet. we doen contrast en fow over de average van 50 batches wegens smoothe curve. daardoor geen sigma f.savefig(studyname + '-' + typ + '-FOW.pdf', bbox_inches='tight') plot.close('all') ############################################################################################# # results table for ctset in ctsets: res = [ typ, ctset['nprim'], ctset['ct']['fopmu'], ctset['ct']['fopsigma'], g_fwhm, contrast, ctset['detyieldmu'], ctset['detyieldsigma'] ] if precolli: res.extend( [ctset['precollidetyieldmu'], ctset['precollidetyieldsigma']]) resultstable.append(res) if pgexit and '3' in typ: res[-2] = res[-2] * pgprod_ratio_3mev elif pgexit and '1' in typ: res[-2] = res[-2] * pgprod_ratio_1mev ############################################################################################# from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt print 'FOP distributions' fig = plt.figure() ax1 = plt.axes(projection='3d') ax1.view_init(30, -50) for i, ctset in enumerate(ctsets): auger.plotfodist_CTONLY(ax1, ctset, i, emisfops, labels, axlabel) if emisfops is not None and len(emisfops) == 1: ax1.set_title(studyname + ', $CT_{FOP_{em}}$ = ' + str(emisfops[0][0])[:5] + ', $RPCT_{FOP_{em}}$ = ' + str(emisfops[0][1])[:5], y=1.08) #plt.legend()#shadow = True,frameon = True,fancybox = True,ncol = 1,fontsize = 'x-small',loc = 'lower right') #plt.tight_layout(rect = [-0.1, 0.0, 1.0, 1.1])#L,B,R,T plt.savefig(studyname + '-' + typ + '-FOP-dist.pdf') #, bbox_inches='tight') plt.close('all')
def megaplot(ctsets,studyname,emisfops=None,labels=["$10^9$","$10^8$","$10^7$","$10^6$"],axlabel='Primaries [nr]'): if len(ctsets) == 4: f, ((ax1,ax2),(ax3,ax4)) = plot.subplots(nrows=2, ncols=2, sharex=False, sharey=False) auger.plot_all_ranges_CTONLY(ax1,ctsets[0]) auger.plot_all_ranges_CTONLY(ax2,ctsets[1]) auger.plot_all_ranges_CTONLY(ax3,ctsets[2]) auger.plot_all_ranges_CTONLY(ax4,ctsets[3]) if not 'Primaries' in axlabel: ax1.set_title(labels[0]) ax2.set_title(labels[1]) ax3.set_title(labels[2]) ax4.set_title(labels[3]) f.subplots_adjust(hspace=.5) ax1.set_xlabel('') ax2.set_xlabel('') ax2.set_ylabel('') ax4.set_ylabel('') f.savefig(studyname+'-'+typ+'-FOP.pdf', bbox_inches='tight') plot.close('all') ############################################################################################# # print 'FOP shift distributions' # from mpl_toolkits.mplot3d import Axes3D # import matplotlib.pyplot as plt # fig = plt.figure() # ax1 = plt.axes(projection='3d') # ax1.view_init(30, -50) # for i,ctset in enumerate(ctsets): # auger.plotfodiffdist(ax1,ctset,i,emisfops,labels,axlabel) # if not emisfops == None: # fopshifts=[] # for fopset in emisfops: # fopshifts.append( fopset[-1]-fopset[0] ) # ax1.set_xlim3d(np.mean(fopshifts)-20,np.mean(fopshifts)+20) # if emisfops is not None and len(emisfops) == 1: # ax1.set_title(studyname+', $Shift_{em}$ = '+str(emisfops[0][-1]-emisfops[0][0]), y=1.08) # #plt.tight_layout(rect = [-0.1, 0.0, 1.0, 1.1])#L,B,R,T # fig.savefig(studyname+'-'+typ+'-FOP-shift.pdf')#, bbox_inches='tight') # plt.close('all') f, (ax1,ax2,ax3) = plot.subplots(nrows=3, ncols=1, sharex=False, sharey=False) x=ctsets[0]['rpct']['x'] y=ctsets[0]['ct']['av'] auger.get_fow(x,y,plot='wut',ax=ax1,ax2=ax2,ax3=ax3,smooth=0.2,filename=ctsets[0]['ct']['path']) #since high statistics, no smoothing needed # ax1.set_title('FOP = '+str(falloff_pos), fontsize=8) f.savefig(studyname+'-'+typ+'-FOW.pdf', bbox_inches='tight') plot.close('all') ############################################################################################# from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt print 'FOP distributions' fig = plt.figure() ax1 = plt.axes(projection='3d') ax1.view_init(30, -50) for i,ctset in enumerate(ctsets): auger.plotfodist_CTONLY(ax1,ctset,i,emisfops,labels,axlabel) if emisfops is not None and len(emisfops) == 1: ax1.set_title(studyname+', $CT_{FOP_{em}}$ = '+str(emisfops[0][0])[:5]+', $RPCT_{FOP_{em}}$ = '+str(emisfops[0][1])[:5], y=1.08) #plt.legend()#shadow = True,frameon = True,fancybox = True,ncol = 1,fontsize = 'x-small',loc = 'lower right') #plt.tight_layout(rect = [-0.1, 0.0, 1.0, 1.1])#L,B,R,T plt.savefig(studyname+'-'+typ+'-FOP-dist.pdf')#, bbox_inches='tight') plt.close('all')
def megaplot(ctsets, studyname, emisfops=None, labels=["$10^9$", "$10^8$", "$10^7$", "$10^6$"], axlabel='Primaries [nr]'): if len(ctsets) == 4: f, ((ax1, ax2), (ax3, ax4)) = plot.subplots(nrows=2, ncols=2, sharex=False, sharey=False) auger.plot_all_ranges_CTONLY(ax1, ctsets[0]) auger.plot_all_ranges_CTONLY(ax2, ctsets[1]) auger.plot_all_ranges_CTONLY(ax3, ctsets[2]) auger.plot_all_ranges_CTONLY(ax4, ctsets[3]) if not 'Primaries' in axlabel: ax1.set_title(labels[0]) ax2.set_title(labels[1]) ax3.set_title(labels[2]) ax4.set_title(labels[3]) f.subplots_adjust(hspace=.5) ax1.set_xlabel('') ax2.set_xlabel('') ax2.set_ylabel('') ax4.set_ylabel('') f.savefig(studyname + '-' + typ + '-FOP.pdf', bbox_inches='tight') plot.close('all') ############################################################################################# # print 'FOP shift distributions' # from mpl_toolkits.mplot3d import Axes3D # import matplotlib.pyplot as plt # fig = plt.figure() # ax1 = plt.axes(projection='3d') # ax1.view_init(30, -50) # for i,ctset in enumerate(ctsets): # auger.plotfodiffdist(ax1,ctset,i,emisfops,labels,axlabel) # if not emisfops == None: # fopshifts=[] # for fopset in emisfops: # fopshifts.append( fopset[-1]-fopset[0] ) # ax1.set_xlim3d(np.mean(fopshifts)-20,np.mean(fopshifts)+20) # if emisfops is not None and len(emisfops) == 1: # ax1.set_title(studyname+', $Shift_{em}$ = '+str(emisfops[0][-1]-emisfops[0][0]), y=1.08) # #plt.tight_layout(rect = [-0.1, 0.0, 1.0, 1.1])#L,B,R,T # fig.savefig(studyname+'-'+typ+'-FOP-shift.pdf')#, bbox_inches='tight') # plt.close('all') f, (ax1, ax2, ax3) = plot.subplots(nrows=3, ncols=1, sharex=False, sharey=False) x = ctsets[0]['rpct']['x'] y = ctsets[0]['ct']['av'] auger.get_fow(x, y, plot='wut', ax=ax1, ax2=ax2, ax3=ax3, smooth=0.2, filename=ctsets[0]['ct'] ['path']) #since high statistics, no smoothing needed # ax1.set_title('FOP = '+str(falloff_pos), fontsize=8) f.savefig(studyname + '-' + typ + '-FOW.pdf', bbox_inches='tight') plot.close('all') ############################################################################################# from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt print 'FOP distributions' fig = plt.figure() ax1 = plt.axes(projection='3d') ax1.view_init(30, -50) for i, ctset in enumerate(ctsets): auger.plotfodist_CTONLY(ax1, ctset, i, emisfops, labels, axlabel) if emisfops is not None and len(emisfops) == 1: ax1.set_title(studyname + ', $CT_{FOP_{em}}$ = ' + str(emisfops[0][0])[:5] + ', $RPCT_{FOP_{em}}$ = ' + str(emisfops[0][1])[:5], y=1.08) #plt.legend()#shadow = True,frameon = True,fancybox = True,ncol = 1,fontsize = 'x-small',loc = 'lower right') #plt.tight_layout(rect = [-0.1, 0.0, 1.0, 1.1])#L,B,R,T plt.savefig(studyname + '-' + typ + '-FOP-dist.pdf') #, bbox_inches='tight') plt.close('all')
def megaplot(ctsets, studyname, emisfops=None, labels=["$10^9$", "$10^8$", "$10^7$", "$10^6$"], axlabel='Primaries [nr]'): if len(ctsets) == 4: f, ((ax1, ax2), (ax3, ax4)) = plot.subplots(nrows=2, ncols=2, sharex=False, sharey=False) auger.plot_all_ranges_CTONLY(ax1, ctsets[0]) auger.plot_all_ranges_CTONLY(ax2, ctsets[1]) auger.plot_all_ranges_CTONLY(ax3, ctsets[2]) #auger.plot_all_ranges_CTONLY(ax4,ctsets[3]) if not 'Primaries' in axlabel: ax1.set_title(labels[0]) ax2.set_title(labels[1]) ax3.set_title(labels[2]) #ax4.set_title(labels[3]) f.subplots_adjust(hspace=.5) ax1.set_xlabel('') ax2.set_xlabel('') ax2.set_ylabel('') #ax4.set_ylabel('') f.savefig(studyname + '-' + typ + '-FOP.pdf', bbox_inches='tight') plot.close('all') ############################################################################################# # print 'FOP shift distributions' # from mpl_toolkits.mplot3d import Axes3D # import matplotlib.pyplot as plt # fig = plt.figure() # ax1 = plt.axes(projection='3d') # ax1.view_init(30, -50) # for i,ctset in enumerate(ctsets): # auger.plotfodiffdist(ax1,ctset,i,emisfops,labels,axlabel) # if not emisfops == None: # fopshifts=[] # for fopset in emisfops: # fopshifts.append( fopset[-1]-fopset[0] ) # ax1.set_xlim3d(np.mean(fopshifts)-20,np.mean(fopshifts)+20) # if emisfops is not None and len(emisfops) == 1: # ax1.set_title(studyname+', $Shift_{em}$ = '+str(emisfops[0][-1]-emisfops[0][0]), y=1.08) # #plt.tight_layout(rect = [-0.1, 0.0, 1.0, 1.1])#L,B,R,T # fig.savefig(studyname+'-'+typ+'-FOP-shift.pdf')#, bbox_inches='tight') # plt.close('all') ############################################################################################# # print 'FOP FOW Contrast DE averages over 10e9 ctset' # removed 2nd deriv from plot f, (ax1, ax2) = plot.subplots(nrows=2, ncols=1, sharex=False, sharey=False) x = ctsets[0]['ct']['x'] # 0 should be one with nprim=1e9 y = ctsets[0]['ct']['av'] if 'iba' in ctsets[0]['name']: # ctset['name'] == typ mm = 4 / 0.8 if 'ipnl' in ctsets[0]['name']: mm = 8 falloff_pos, g_fwhm, contrast = auger.get_fop_fow_contrast( x, y, plot='wut', ax=ax1, ax2=ax2, smooth=0.2, filename=ctsets[0]['ct']['path'], contrast_divisor=ctsets[0]['nprim'] * len(ctsets[0]['ct']['files']) * mm, fitlines=False) # some cosmetics maxyrounded = int(math.ceil(max(y) / 100.0)) * 100 ticks = np.arange(0, maxyrounded, 100) if len(ticks) > 10: ticks = np.arange(0, maxyrounded + 100, 200) if len(ticks) > 10: ticks = np.arange(0, maxyrounded + 200, 400) ax1.set_yticks(ticks) minor_locator = AutoMinorLocator(2) minor_locator1 = AutoMinorLocator(2) ax1.xaxis.set_minor_locator(minor_locator) ax2.xaxis.set_minor_locator(minor_locator) ax2.yaxis.set_minor_locator(minor_locator1) print "NPRIM", ctsets[0]['nprim'], "NJOBS", len( ctsets[0]['ct']['files']), "MM", mm #gebruiken deze falloff_pos niet. we doen contrast en fow over de average van 50 batches wegens smoothe curve. daardoor geen sigma f.savefig(studyname + '-' + typ + '-FOW.pdf', bbox_inches='tight') plot.close('all') ############################################################################################# # results table print 'Computing pgprod ratios...' pgprod_1mev = dump.count_ekine_in_phasespace( "/home/brent/phd/art2_lyso_box/stage2_box15_docker/output/pgprod-worldframe.root", 1.) pgprod_3mev = dump.count_ekine_in_phasespace( "/home/brent/phd/art2_lyso_box/stage2_box15_docker/output/pgprod-worldframe.root", 3.) print 'done.' for ctset in ctsets: res = [ typ, ctset['nprim'], ctset['ct']['fopmu'], ctset['ct']['fopsigma'], g_fwhm, contrast, ctset['detyieldmu'], ctset['detyieldsigma'], ctset['detcount'] ] if ctset['nprim'] == 10**9: if pgexit and '3' in typ: res[-1] = res[-1] / pgprod_3mev elif pgexit and '1' in typ: res[-1] = res[-1] / pgprod_1mev else: res[-1] = '' if precolli: res.extend( [ctset['precollidetyieldmu'], ctset['precollidetyieldsigma']]) resultstable.append(res) ############################################################################################# from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt print 'FOP distributions' fig = plt.figure() ax1 = plt.axes(projection='3d') ax1.view_init(30, -50) for i, ctset in enumerate(ctsets): auger.plotfodist_CTONLY(ax1, ctset, i, emisfops, labels, axlabel) if emisfops is not None and len(emisfops) == 1: ax1.set_title(studyname + ', $CT_{FOP_{em}}$ = ' + str(emisfops[0][0])[:5] + ', $RPCT_{FOP_{em}}$ = ' + str(emisfops[0][1])[:5], y=1.08) #plt.legend()#shadow = True,frameon = True,fancybox = True,ncol = 1,fontsize = 'x-small',loc = 'lower right') #plt.tight_layout(rect = [-0.1, 0.0, 1.0, 1.1])#L,B,R,T plt.savefig(studyname + '-' + typ + '-FOP-dist.pdf') #, bbox_inches='tight') plt.close('all')
def megaplot(ctsets,studyname,emisfops=None,labels=["$10^9$","$10^8$","$10^7$","$10^6$"],axlabel='Primaries [nr]'): if len(ctsets) == 4: f, ((ax1,ax2),(ax3,ax4)) = plot.subplots(nrows=2, ncols=2, sharex=False, sharey=False) auger.plot_all_ranges_CTONLY(ax1,ctsets[0]) auger.plot_all_ranges_CTONLY(ax2,ctsets[1]) auger.plot_all_ranges_CTONLY(ax3,ctsets[2]) auger.plot_all_ranges_CTONLY(ax4,ctsets[3]) if not 'Primaries' in axlabel: ax1.set_title(labels[0]) ax2.set_title(labels[1]) ax3.set_title(labels[2]) ax4.set_title(labels[3]) f.subplots_adjust(hspace=.5) ax1.set_xlabel('') ax2.set_xlabel('') ax2.set_ylabel('') ax4.set_ylabel('') f.savefig(studyname+'-'+typ+'-FOP.pdf', bbox_inches='tight') plot.close('all') ############################################################################################# # print 'FOP shift distributions' # from mpl_toolkits.mplot3d import Axes3D # import matplotlib.pyplot as plt # fig = plt.figure() # ax1 = plt.axes(projection='3d') # ax1.view_init(30, -50) # for i,ctset in enumerate(ctsets): # auger.plotfodiffdist(ax1,ctset,i,emisfops,labels,axlabel) # if not emisfops == None: # fopshifts=[] # for fopset in emisfops: # fopshifts.append( fopset[-1]-fopset[0] ) # ax1.set_xlim3d(np.mean(fopshifts)-20,np.mean(fopshifts)+20) # if emisfops is not None and len(emisfops) == 1: # ax1.set_title(studyname+', $Shift_{em}$ = '+str(emisfops[0][-1]-emisfops[0][0]), y=1.08) # #plt.tight_layout(rect = [-0.1, 0.0, 1.0, 1.1])#L,B,R,T # fig.savefig(studyname+'-'+typ+'-FOP-shift.pdf')#, bbox_inches='tight') # plt.close('all') ############################################################################################# # print 'FOP FOW Contrast DE averages over 10e9 ctset' f, (ax1,ax2,ax3) = plot.subplots(nrows=3, ncols=1, sharex=False, sharey=False) x=ctsets[0]['ct']['x'] y=ctsets[0]['ct']['av'] if 'iba' in ctsets[0]['name']: # ctset['name'] == typ mm=4/0.8 if 'ipnl' in ctsets[0]['name']: mm=8 falloff_pos,g_fwhm,contrast = auger.get_fop_fow_contrast(x,y,plot='wut',ax=ax1,ax2=ax2,ax3=ax3,smooth=0.2,filename=ctsets[0]['ct']['path'],contrast_divisor=ctsets[0]['nprim']*len(ctsets[0]['ct']['files'])*mm) print "NPRIM", ctsets[0]['nprim'],"NJOBS",len(ctsets[0]['ct']['files']),"MM",mm #gebruiken deze falloff_pos niet. we doen contrast en fow over de average van 50 batches wegens smoothe curve. daardoor geen sigma res=[typ,ctsets[0]['ct']['fopmu'],ctsets[0]['ct']['fopsigma'],g_fwhm,contrast,ctsets[0]['detyieldmu'],ctsets[0]['detyieldsigma']] resultstable.append(res) f.savefig(studyname+'-'+typ+'-FOW.pdf', bbox_inches='tight') plot.close('all') ############################################################################################# from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt print 'FOP distributions' fig = plt.figure() ax1 = plt.axes(projection='3d') ax1.view_init(30, -50) for i,ctset in enumerate(ctsets): auger.plotfodist_CTONLY(ax1,ctset,i,emisfops,labels,axlabel) if emisfops is not None and len(emisfops) == 1: ax1.set_title(studyname+', $CT_{FOP_{em}}$ = '+str(emisfops[0][0])[:5]+', $RPCT_{FOP_{em}}$ = '+str(emisfops[0][1])[:5], y=1.08) #plt.legend()#shadow = True,frameon = True,fancybox = True,ncol = 1,fontsize = 'x-small',loc = 'lower right') #plt.tight_layout(rect = [-0.1, 0.0, 1.0, 1.1])#L,B,R,T plt.savefig(studyname+'-'+typ+'-FOP-dist.pdf')#, bbox_inches='tight') plt.close('all')