ax2.set_title("Dose") ax3.set_title("Dose TLE") ax4.set_title("PhS, rel. unc") ax5.set_title("Dose, rel. unc") ax6.set_title("Dose TLE, rel. unc") # BIN EDGES! xbins = np.linspace(-410 / 2., 410 / 2., 256 + 1) ybins = np.linspace(-410 / 2., 410 / 2., 256 + 1) counts = plot.plot2dhist(ax1, all['X'], all['Y'], xbins=xbins, ybins=ybins, log=True) plot.plot1dhist(ax4, (1. / np.sqrt(counts.flatten())) * 100., bins=unc_axis, range=(min(unc_axis), max(unc_axis)), log=True, count=True) ax2.imshow(doseim_.imdata.squeeze(), extent=[0, 41, 0, 41], cmap='gray') plot.plot1dhist(ax5, doseuncim_.imdata.flatten(), bins=unc_axis, log=True) ax3.imshow(dosetleim_.imdata.squeeze(), extent=[0, 41, 0, 41], cmap='gray') plot.plot1dhist(ax6, dosetleuncim_.imdata.flatten(), bins=unc_axis, log=True) f.savefig(indir.replace('/', '_') + '_unc.pdf', bbox_inches='tight') plot.close('all')
ax4.set_title("Secon Phot") ax5.set_title("Nonphot") # BIN EDGES! xbins = np.linspace(-410/2.,410/2.,256+1) ybins = np.linspace(-410/2.,410/2.,256+1) a = plot.plot2dhist( ax1, all['X'], all['Y'], xbins=xbins,ybins=ybins, log=True) a = plot.plot2dhist( ax2, phot_trans['X'], phot_trans['Y'], xbins=xbins,ybins=ybins, log=True) a = plot.plot2dhist( ax3, phot_scatter['X'], phot_scatter['Y'], xbins=xbins,ybins=ybins, log=True) a = plot.plot2dhist( ax4, phot_other['X'], phot_other['Y'], xbins=xbins,ybins=ybins, log=True) a = plot.plot2dhist( ax5, nonphot['X'], nonphot['Y'], xbins=xbins,ybins=ybins, log=True) #,norm=matplotlib.colors.LogNorm(),vmin=1e0,vmax=1e2) plot.plot1dhist(ax6,all_E,count=True) plot.plot1dhist(ax7,phot_trans_E,count=True) plot.plot1dhist(ax8,phot_scatter_E,count=True) plot.plot1dhist(ax9,phot_other_E,count=True) ax9.set_xlim(0,2) plot.plot1dhist(ax10,nonphot_E,count=True) d = { 'e-':'Electron', 'e+':'Positron', 'gamma':'Photon' } plot.plotbar(ax14,partname,relabel=d,log=True) plot.plotbar(ax15,['Total Counts' for i in range(len(all['X']))]+['Prim Trans' for i in range(len(phot_trans['X']))]+['Prim Scat' for i in range(len(phot_scatter['X']))]+['Secon Phot' for i in range(len(phot_other['X']))],rotation=30) ax15.text(0.05, 0.95, 'Trans/Total: '+str( len(phot_trans['X'])/float(len(all['X'])) ) , ha='left', va='center', transform=ax15.transAxes)
for rootfile in rootfiles: all = dump.get2D(rootfile,['X','Y']) f, (ax1 ,ax2 )= plot.subplots(nrows=1, ncols=2, sharex=False, sharey=False)#,figsize=(28,10)) f.subplots_adjust(hspace=.5) f.subplots_adjust(wspace=.5) ax1.set_title("X,Y") ax2.set_title("unc histo") # BIN EDGES! xbins = np.linspace(-410/2.,410/2.,256+1) ybins = np.linspace(-410/2.,410/2.,256+1) counts = plot.plot2dhist( ax1, all['X'], all['Y'], xbins=xbins,ybins=ybins, log=True) #,norm=matplotlib.colors.LogNorm(),vmin=1e0,vmax=1e2) #plot.plot1dhist(ax2,counts.flatten(),bins=np.linspace(0,200,100), log=True,count=True) #with np.errstate(divide='ignore', invalid='ignore'): #unc = np.true_divide(1.,counts.flatten()*100.) #unc[unc == np.inf] = 0 #unc[unc == np.nan] = 0 plot.plot1dhist(ax2,(1./np.sqrt(counts.flatten()))*100.,bins=np.linspace(0,50,50), range=(0,50), log=True,count=True) f.savefig(rootfile+'.unc.pdf', bbox_inches='tight') plot.close('all')
f, ((ax1 ,ax2, ax3 ),(ax4, ax5, ax6))= plot.subplots(nrows=2, ncols=3, sharex=False, sharey=False)#,figsize=(28,10)) #f.subplots_adjust(hspace=.5) #f.subplots_adjust(wspace=.5) f.suptitle('Runtime: '+runtime+'s', fontsize=10) ax1.set_title("PhS, X,Y") ax2.set_title("Dose") ax3.set_title("Dose TLE") ax4.set_title("PhS, rel. unc") ax5.set_title("Dose, rel. unc") ax6.set_title("Dose TLE, rel. unc") # BIN EDGES! xbins = np.linspace(-410/2.,410/2.,256+1) ybins = np.linspace(-410/2.,410/2.,256+1) counts = plot.plot2dhist( ax1, all['X'], all['Y'], xbins=xbins,ybins=ybins, log=True) plot.plot1dhist(ax4,(1./np.sqrt(counts.flatten()))*100.,bins=unc_axis, range=(min(unc_axis),max(unc_axis)), log=True,count=True) ax2.imshow( doseim_.imdata.squeeze() , extent = [0,41,0,41], cmap='gray') plot.plot1dhist( ax5, doseuncim_.imdata.flatten(), bins=unc_axis, log=True) ax3.imshow( dosetleim_.imdata.squeeze() , extent = [0,41,0,41], cmap='gray') plot.plot1dhist( ax6, dosetleuncim_.imdata.flatten(), bins=unc_axis, log=True) f.savefig(indir.replace('/','_')+'_unc.pdf', bbox_inches='tight') plot.close('all')
ax1.set_title("X,Y") ax2.set_title("unc histo") # BIN EDGES! xbins = np.linspace(-410 / 2., 410 / 2., 256 + 1) ybins = np.linspace(-410 / 2., 410 / 2., 256 + 1) counts = plot.plot2dhist(ax1, all['X'], all['Y'], xbins=xbins, ybins=ybins, log=True) #,norm=matplotlib.colors.LogNorm(),vmin=1e0,vmax=1e2) #plot.plot1dhist(ax2,counts.flatten(),bins=np.linspace(0,200,100), log=True,count=True) #with np.errstate(divide='ignore', invalid='ignore'): #unc = np.true_divide(1.,counts.flatten()*100.) #unc[unc == np.inf] = 0 #unc[unc == np.nan] = 0 plot.plot1dhist(ax2, (1. / np.sqrt(counts.flatten())) * 100., bins=np.linspace(0, 50, 50), range=(0, 50), log=True, count=True) f.savefig(rootfile + '.unc.pdf', bbox_inches='tight') plot.close('all')
a = plot.plot2dhist(ax4, phot_other['X'], phot_other['Y'], xbins=xbins, ybins=ybins, log=True) a = plot.plot2dhist(ax5, nonphot['X'], nonphot['Y'], xbins=xbins, ybins=ybins, log=True) #,norm=matplotlib.colors.LogNorm(),vmin=1e0,vmax=1e2) plot.plot1dhist(ax6, all_E, count=True) plot.plot1dhist(ax7, phot_trans_E, count=True) plot.plot1dhist(ax8, phot_scatter_E, count=True) plot.plot1dhist(ax9, phot_other_E, count=True) ax9.set_xlim(0, 2) plot.plot1dhist(ax10, nonphot_E, count=True) d = {'e-': 'Electron', 'e+': 'Positron', 'gamma': 'Photon'} plot.plotbar(ax14, partname, relabel=d, log=True) plot.plotbar(ax15, ['Total Counts' for i in range(len(all['X']))] + ['Prim Trans' for i in range(len(phot_trans['X']))] + ['Prim Scat' for i in range(len(phot_scatter['X']))] + ['Secon Phot' for i in range(len(phot_other['X']))], rotation=30) ax15.text(0.05,
axrow[0].set_title(label + '\n$\sum$ Dose: ' + plot.sn(fracties_totaal[-1])) axrow[1].set_title(label + ' Profile') axrow[1].plot(*yim_.getprofile('y'), color='steelblue', label='x') axrow[1].plot(*yim_.getprofile('x'), color='indianred', label='y') axrow[1].legend(loc='upper right', bbox_to_anchor=(1., 1.), frameon=False) axrow[1].axvline(41. / 2. - 8., color='#999999', ls='--') #10x10 at isoc is 16x16 at epid level axrow[1].axvline(41. / 2. + 8., color='#999999', ls='--') axrow[1].set_xlim(0, 41) plot.set_metric_prefix_y(axrow[1]) axrow[2].set_title(label + ' relunc') plot.plot1dhist(axrow[2], uim_.imdata.flatten(), bins=np.linspace(0, 100, 50), log=True) frac_trans = 1. frac_nontrans = 1. if args.phosphor: npart_trans = 112525576. npart_tot = 127153038. frac_trans = npart_trans / npart_tot frac_nontrans = 1. - frac_trans sumim = image.image(imyields[0], type='yield') sumim.imdata = sumim.imdata.squeeze() * frac_nontrans + image.image( imyields[1], type='yield').imdata.squeeze() * frac_trans axes[-1][0].imshow(sumim.imdata, extent=[0, 41, 0, 41], cmap='gray') axes[-1][0].set_title('Sum' + '\n$\sum$ Dose: ' + plot.sn(sumim.imdata.sum()))
fracties_isocentrum.append( yim_.getcenter().mean() ) fracties_totaal.append( yim_.imdata.sum() ) axrow[0].imshow( yim_.imdata.squeeze() , extent = [0,41,0,41], cmap='gray') axrow[0].set_title(label + '\n$\sum$ Dose: '+ plot.sn(fracties_totaal[-1])) axrow[1].set_title(label + ' Profile') axrow[1].plot(*yim_.getprofile('y'), color = 'steelblue' , label='x') axrow[1].plot(*yim_.getprofile('x'), color = 'indianred' , label='y') axrow[1].legend(loc='upper right', bbox_to_anchor=(1., 1.),frameon=False) axrow[1].axvline(41./2.-8., color='#999999', ls='--') #10x10 at isoc is 16x16 at epid level axrow[1].axvline(41./2.+8., color='#999999', ls='--') axrow[1].set_xlim(0,41) plot.set_metric_prefix_y(axrow[1]) axrow[2].set_title(label+' relunc') plot.plot1dhist( axrow[2], uim_.imdata.flatten(), bins=np.linspace(0,100,50), log=True) frac_trans=1. frac_nontrans=1. if args.phosphor: npart_trans=112525576. npart_tot=127153038. frac_trans=npart_trans/npart_tot frac_nontrans=1.-frac_trans sumim = image.image(imyields[0],type='yield') sumim.imdata=sumim.imdata.squeeze()*frac_nontrans+image.image(imyields[1],type='yield').imdata.squeeze()*frac_trans axes[-1][0].imshow( sumim.imdata , extent = [0,41,0,41], cmap='gray') axes[-1][0].set_title('Sum' + '\n$\sum$ Dose: '+ plot.sn(sumim.imdata.sum())) axes[-1][1].set_title('Sum Profile')
sharey=False) #,figsize=(28,10)) f.subplots_adjust(hspace=.5, wspace=.5) ax1.set_title("Positions") ax2.set_title("Energy") xbins = np.linspace(-panelsize / 2., panelsize / 2., numpix + 1) ybins = xbins xbins2 = plot.chopcentral(xbins, 5) ybins2 = xbins2 xbins3 = np.linspace(-5, 5, 10 + 1) ybins3 = xbins3 xbins4 = np.linspace(-10, 0, 10 + 1) ybins4 = xbins4 plot.plot2dhist(ax1, fpos_e['X'], fpos_e['Z'], xbins=xbins, ybins=ybins, log=True) plot.plot1dhist(ax2, fE_e, count=True) #ax3.pcolormesh(pos_e[0], pos_e[1], pos_e[2].T)#, log=True) #ax3.pcolormesh(pos_e[0], pos_e[1], pos_e[2])#, log=True) ax4.step(E_e[0][:-1], E_e[1]) f.savefig(rootfile + '.pdf', bbox_inches='tight') plot.close('all')