################################################################## 14 degrees M_vs_M_Q_14 = Plotter([ data_14_degrees['M_Q'][condition_14], data_14_degrees['M'][condition_14] ]) #Create the base with the variables in a object M_vs_M_Q_14.SetFigSize(12, 7) M_vs_M_Q_14.SetBinX(500) M_vs_M_Q_14.SetBinY(500) M_vs_M_Q_14.SetFigTitle(r'M:M_Q 14$\degree$', 20) M_vs_M_Q_14.SetLabelX('M_Q', 20) M_vs_M_Q_14.SetLabelY('M', 20) M_vs_M_Q_14.SetSizeTicksX(10) M_vs_M_Q_14.SetBoxText( 'Selection:\n Z>0 \n Zi>0 \n M>0 \n -100<Pf<100 \n -110<Yf<50 \n Xf>-1500' ) M_vs_M_Q_14.Histo_2D() #Draw it ######### Save and show the created figure M_vs_M_Q_14.SetOutDir(basepath + 'Modules/' + MODULE_name + '/Outputfiles/Figures/Raw_figures/') M_vs_M_Q_14.SaveFig('M_vs_M_Q_14') M_vs_M_Q_14.Show(1) #show during 1 seconds, the close authomatically M_vs_M_Q_14.Close() #close all windows, axes and figures running backend del M_vs_M_Q_14 #erase M_vs_M_Q_14 (is an object) ################################################################## 21 degrees M_vs_M_Q_21 = Plotter([ data_21_degrees['M_Q'][condition_21], data_21_degrees['M'][condition_21] ]) #Create the base with the variables in a object M_vs_M_Q_21.SetFigSize(12, 7) M_vs_M_Q_21.SetBinX(500) M_vs_M_Q_21.SetBinY(500)
''' ----------------------------------------------------------------- Plot variables ------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------- Using "Plotter" Class --------------------------------------------------------------------------------------------------------------- ''' ################################################################## 14 degrees Yf_vs_Xf_14 = Plotter([data_14_degrees['Xf'][condition_14], data_14_degrees['Yf'][condition_14]]) #Create the base with the variables in a object Yf_vs_Xf_14.SetFigSize(12,7) Yf_vs_Xf_14.SetBinX(500) Yf_vs_Xf_14.SetBinY(500) Yf_vs_Xf_14.SetFigTitle(r'Yf:Xf 14$\degree$', 20) Yf_vs_Xf_14.SetLabelX('Xf [mm]', 20) Yf_vs_Xf_14.SetLabelY('Yf [mm]', 20) Yf_vs_Xf_14.SetSizeTicksX(10) Yf_vs_Xf_14.SetBoxText('Selection:\n Z>0 \n Zi>0 \n M>0 \n Xf>-1500 \n Yf>-1500') Yf_vs_Xf_14.Histo_2D() #Draw it ######### Save and show the created figure Yf_vs_Xf_14.SetOutDir(basepath + 'Modules/' + MODULE_name + '/Outputfiles/Figures/') Yf_vs_Xf_14.SaveFig('Yf_vs_Xf_14') Yf_vs_Xf_14.Show(1) #show during 1 seconds, the close authomatically Yf_vs_Xf_14.Close() #close all windows, axes and figures running backend del Yf_vs_Xf_14 #erase Yf_vs_Xf_14 (is an object) Pf_vs_Tf_14_mrad = Plotter([data_14_degrees['Tf'][condition_14], data_14_degrees['Pf'][condition_14]]) #Create the base with the variables in a object Pf_vs_Tf_14_mrad.SetFigSize(12,7) Pf_vs_Tf_14_mrad.SetBinX(500) Pf_vs_Tf_14_mrad.SetBinY(500) Pf_vs_Tf_14_mrad.SetFigTitle(r'Pf:Tf 14$\degree$', 20) Pf_vs_Tf_14_mrad.SetLabelX('Tf [mrad]', 20) Pf_vs_Tf_14_mrad.SetLabelY('Pf [mrad]', 20)
Histo2D_object.SetBinX(300) Histo2D_object.SetBinY(300) Histo2D_object.SetFigTitle('Variable 2 vs Variable 1', 15) Histo2D_object.SetNticksX(10) Histo2D_object.SetLabelX('Variable 1', 15) Histo2D_object.SetLabelY('Variable 2', 15) Histo2D_object.SetSizeTicksX(10) #Histo2D_object.SetScaleZ('Normalization') #Histo2D_object.SetScaleZ('SymLogNorm') #Histo2D_object.SetScaleZ('LogNorm') #Histo2D_object.SetScaleZ('PowerNorm', 0.5) ######### Generate the histogram, with weights weights = np.ones(len(Testing_data_hdf5['Brho'] [condition])) #one weight equal one per (Xi, Yi) pair Histo2D_object.Histo_2D(weights) histo_projection_Y = Histo2D_object.ShowProjectionY(x_range=[3.2, 3.22], binning=150) ######### Save and show the created figure Histo2D_object.SetOutDir(basepath + 'Modules/' + MODULE_name + '/Outputfiles/Figures/') Histo2D_object.SaveFig('figure_TEST_Histo2D') Histo2D_object.Show() #show all plots Histo2D_object.Close() #close all windows, axes and figures running backend del Histo2D_object #erase Histo2D (is an object) ################################################ Histo_2D_mountain() function ######################################################################################
plt.close('all') plt.close(fig) M_vs_M_Q_14_pattern_q = Plotter([data_14_degrees['M_Q'][condition_mass_14_q],data_14_degrees['M'][condition_mass_14_q]]) #Create the base with the variables in a object M_vs_M_Q_14_pattern_q.SetFigSize(12,7) M_vs_M_Q_14_pattern_q.SetBinX(500) M_vs_M_Q_14_pattern_q.SetBinY(500) M_vs_M_Q_14_pattern_q.SetFigTitle(r'M vs M_Q with pattern and q = %i 14$\degree$' %q, 20) M_vs_M_Q_14_pattern_q.SetLabelX('M_Q', 20) M_vs_M_Q_14_pattern_q.SetLabelY('M', 20) M_vs_M_Q_14_pattern_q.SetSizeTicksX(10) M_vs_M_Q_14_pattern_q.SetBoxText('Selection:\n Z>0 \n Zi>0 \n 100<M<160 \n 2.6<M_Q<3.5 \n -100<Pf<100 \n -110<Yf<50 \n Xf>-1500 \n MW_Nr>=0 \n Qi==%i' %q) M_vs_M_Q_14_pattern_q.SetLimX((2.4,3.6)) M_vs_M_Q_14_pattern_q.SetLimY((q*2.5,q*4.0)) M_vs_M_Q_14_pattern_q.Histo_2D() #Draw it #plot pattern charge plt.plot(q_x, q_y, '.-k', label='q = %i' %q) plt.legend() ##### make histograms in X to see the position of highs ######## left, width = 0.18, 0.45 bottom, height = 0.1, 0.40 bottom_h = left_h = left + width + 0.02 # definition of the rectangule-places for X-Histogram rect_histx = [left, bottom_h, width, 0.2] # define the axes for each plot-zone axHistx = plt.axes(rect_histx) axHistx.plot(bin_edges, histo) axHistx.plot(bin_edges[peaks], histo[peaks], "x")