#en_coeff1 = [-0.931608, 0.391917] #28-day coeff #en_coeff2 = [-1.646097, 0.414058] f = tb.openFile(file_path, 'r') evtstab = f.root.bin_data_parse.readout emax = 800 gg_list_1 = np.array([row['energy_1'] for row in evtstab.where("""(energy_1 <= emax) & (energy_2 <= emax) & (energy_1 > 0) & (energy_2 > 0)""")]) gg_list_2 = np.array([row['energy_2'] for row in evtstab.where("""(energy_1 <= emax) & (energy_2 <= emax) & (energy_1 > 0) & (energy_2 > 0)""")]) gg_en_1 = np.zeros(len(gg_list_1)) gg_en_2 = np.zeros(len(gg_list_2)) for i in range(len(gg_list_1)): gg_en_1[i] = marker2energy(gg_list_1[i], en_coeff1) for i in range(len(gg_list_2)): gg_en_2[i] = marker2energy(gg_list_2[i], en_coeff2) xmin = 0 xmax = gg_en_1.max() ymin = 0 ymax = gg_en_2.max() plt.clf() hexplot = plt.hexbin(gg_en_1, gg_en_2, cmap=cm.jet, gridsize=200,) plt.axis([xmin, xmax, xmin, xmax]) plt.title('WFP2 28-Day Decay') plt.xlabel('Lower Detector Energy (keV)') plt.ylabel('Upper Detector Energy (keV)')