def read_proton(pr): # read data p_up = c51.open_data(pr.data_loc['file_loc'], pr.data_loc['proton_spin_up']) p_dn = c51.open_data(pr.data_loc['file_loc'], pr.data_loc['proton_spin_dn']) pnp_up = c51.open_data(pr.data_loc['file_loc'], pr.data_loc['proton_np_spin_up']) pnp_dn = c51.open_data(pr.data_loc['file_loc'], pr.data_loc['proton_np_spin_dn']) p_savg = c51.ispin_avg(p_up, p_dn) pnp_savg = c51.ispin_avg(pnp_up, pnp_dn) p_avg = c51.parity_avg(p_savg, pnp_savg, phase=-1.0) T = len(p_avg[0]) p_avg = p_avg[:, :T/2] # keep only first half of data ('folded' length) if pr.plot_data_flag == 'on': # folded correlator data p_ss = p_avg[:,:,0,0] p_ps = p_avg[:,:,3,0] c51.scatter_plot(np.arange(len(p_ss[0])), c51.make_gvars(p_ss), 'proton ss folded') c51.scatter_plot(np.arange(len(p_ps[0])), c51.make_gvars(p_ps), 'proton ps folded') # effective mass eff = c51.effective_plots(T) meff_ss = eff.effective_mass(c51.make_gvars(p_ss)[1:], 1, 'cosh') meff_ps = eff.effective_mass(c51.make_gvars(p_ps)[1:], 1, 'cosh') xlim = [1, len(meff_ss)] #*2/5] #ylim = [0.7, 1.1] ylim = [0.3, 0.9] #ylim = c51.find_yrange(meff_ss, xlim[0], xlim[1]) c51.scatter_plot(np.arange(len(meff_ss))+1, meff_ss, 'proton ss effective mass', xlim = xlim, ylim = ylim) #ylim = c51.find_yrange(meff_ps, xlim[0], xlim[1]) c51.scatter_plot(np.arange(len(meff_ps))+1, meff_ps, 'proton ps effective mass', xlim = xlim, ylim = ylim) # scaled correlator E0 = pr.priors['proton']['E0'][0] scaled_ss = eff.scaled_correlator(c51.make_gvars(p_ss), E0, phase=1.0) scaled_ps = eff.scaled_correlator(c51.make_gvars(p_ps), E0, phase=1.0) ylim = c51.find_yrange(scaled_ss, xlim[0], xlim[1]/2) c51.scatter_plot(np.arange(len(scaled_ss)), scaled_ss, 'proton ss scaled correlator (take sqrt to get Z0_s)', xlim = xlim, ylim = ylim) ylim = c51.find_yrange(scaled_ps, xlim[0], xlim[1]/2) c51.scatter_plot(np.arange(len(scaled_ps)), scaled_ps, 'proton ps scaled correlator (divide by Z0_s to get Z0_p)', xlim = xlim, ylim = ylim) plt.show() return p_avg, T
def read_proton(pr): # read data p_up = c51.open_data(pr.data_loc['file_loc'], pr.data_loc['proton_spin_up']) p_dn = c51.open_data(pr.data_loc['file_loc'], pr.data_loc['proton_spin_dn']) pnp_up = c51.open_data(pr.data_loc['file_loc'], pr.data_loc['proton_np_spin_up']) pnp_dn = c51.open_data(pr.data_loc['file_loc'], pr.data_loc['proton_np_spin_dn']) p_savg = c51.ispin_avg(p_up, p_dn) pnp_savg = c51.ispin_avg(pnp_up, pnp_dn) p_avg = c51.parity_avg(p_savg, pnp_savg, phase=-1.0) T = len(p_avg[0]) p_avg = p_avg[:, :T/2] # keep only first half of data ('folded' length) if pr.plot_data_flag == 'on': # folded correlator data p_ss = p_avg[:,:,0,0] p_ps = p_avg[:,:,3,0] c51.scatter_plot(np.arange(len(p_ss[0])), c51.make_gvars(p_ss), 'proton ss folded') c51.scatter_plot(np.arange(len(p_ps[0])), c51.make_gvars(p_ps), 'proton ps folded') # effective mass eff = c51.effective_plots(T) meff_ss = eff.effective_mass(c51.make_gvars(p_ss)[1:], 1, 'cosh') meff_ps = eff.effective_mass(c51.make_gvars(p_ps)[1:], 1, 'cosh') xlim = [1, len(meff_ss)] #*2/5] ylim = [0.6, 1.2] #ylim = c51.find_yrange(meff_ss, xlim[0], xlim[1]) c51.scatter_plot(np.arange(len(meff_ss))+1, meff_ss, 'proton ss effective mass', xlim = xlim, ylim = ylim) #ylim = c51.find_yrange(meff_ps, xlim[0], xlim[1]) c51.scatter_plot(np.arange(len(meff_ps))+1, meff_ps, 'proton ps effective mass', xlim = xlim, ylim = ylim) # scaled correlator E0 = pr.priors['proton']['E0'][0] scaled_ss = eff.scaled_correlator(c51.make_gvars(p_ss), E0, phase=1.0) scaled_ps = eff.scaled_correlator(c51.make_gvars(p_ps), E0, phase=1.0) ylim = c51.find_yrange(scaled_ss, xlim[0], xlim[1]) c51.scatter_plot(np.arange(len(scaled_ss)), scaled_ss, 'proton ss scaled correlator (take sqrt to get Z0_s)', xlim = xlim, ylim = ylim) ylim = c51.find_yrange(scaled_ps, xlim[0], xlim[1]) c51.scatter_plot(np.arange(len(scaled_ps)), scaled_ps, 'proton ps scaled correlator (divide by Z0_s to get Z0_p)', xlim = xlim, ylim = ylim) return p_avg, T
#path = 'l2464f211b600m0102m0509m635/wf1p0_m51p2_l58_a51p5_smrw4p0_n100/spectrum/ml0p0126_ms0p0696/' #path = 'l2464f211b600m0102m0509m635/wf1p0_m51p2_l58_a51p5_smrw7p0_n150/spectrum/ml0p0126_ms0p0696/' #path = 'l2464f211b600m0102m0509m635/wf1p0_m51p2_l58_a51p5_smrw5p0_n75/spectrum/ml0p0126_ms0p0696/' #filename = 'l3296f211b630m0074m037m440e_tune_avg.h5' #path = 'l3296f211b630m0074m037m440/wf1p0_m51p1_l56_a51p5_smrw7p5_n167/spectrum/ml0p00950_ms0p0490/' #filename = 'l3264f211b600m00507m0507m628a_avg.h5' #path = 'l3264f211b600m00507m0507m628/wf1p0_m51p2_l512_a52p0_smrw5p5_n75/spectrum/ml0p00600_ms0p0693/' #path = 'l3264f211b600m00507m0507m628/wf1p0_m51p2_l512_a52p0_smrw6p0_n90/spectrum/ml0p00600_ms0p0693/' filename = 'l3248f211b580m00235m0647m831a_avg.h5' path = 'l3248f211b580m00235m0647m831/wf1p0_m51p3_l524_a53p5_smrw4p5_n60/spectrum/ml0p00211_ms0p0902/' datapath = path + 'proton/spin_up' data_up = c51.read_data(filename, datapath, 0, 0) datapath = path + 'proton/spin_dn' data_dn = c51.read_data(filename, datapath, 0, 0) data_pos = c51.ispin_avg(data_up, data_dn) #Read spin averaged negative parity proton datapath = path + 'proton_np/spin_up' data_up = c51.read_data(filename, datapath, 0, 0) datapath = path + 'proton_np/spin_dn' data_dn = c51.read_data(filename, datapath, 0, 0) data_neg = c51.ispin_avg(data_up, data_dn) #Parity average data_ss = c51.parity_avg(data_pos, data_neg, -1) datapath = path + 'proton/spin_up' data_up = c51.read_data(filename, datapath, 3, 0) datapath = path + 'proton/spin_dn' data_dn = c51.read_data(filename, datapath, 3, 0) data_pos = c51.ispin_avg(data_up, data_dn) #Read spin averaged negative parity proton datapath = path + 'proton_np/spin_up'
#path = 'l2464f211b600m0102m0509m635/wf1p0_m51p2_l58_a51p5_smrw4p0_n100/spectrum/ml0p0126_ms0p0696/' #path = 'l2464f211b600m0102m0509m635/wf1p0_m51p2_l58_a51p5_smrw7p0_n150/spectrum/ml0p0126_ms0p0696/' #path = 'l2464f211b600m0102m0509m635/wf1p0_m51p2_l58_a51p5_smrw5p0_n75/spectrum/ml0p0126_ms0p0696/' #filename = 'l3296f211b630m0074m037m440e_tune_avg.h5' #path = 'l3296f211b630m0074m037m440/wf1p0_m51p1_l56_a51p5_smrw7p5_n167/spectrum/ml0p00950_ms0p0490/' #filename = 'l3264f211b600m00507m0507m628a_avg.h5' #path = 'l3264f211b600m00507m0507m628/wf1p0_m51p2_l512_a52p0_smrw5p5_n75/spectrum/ml0p00600_ms0p0693/' #path = 'l3264f211b600m00507m0507m628/wf1p0_m51p2_l512_a52p0_smrw6p0_n90/spectrum/ml0p00600_ms0p0693/' filename = 'l3248f211b580m00235m0647m831a_avg.h5' path = 'l3248f211b580m00235m0647m831/wf1p0_m51p3_l524_a53p5_smrw4p5_n60/spectrum/ml0p00211_ms0p0902/' datapath = path+'proton/spin_up' data_up = c51.read_data(filename, datapath, 0, 0) datapath = path+'proton/spin_dn' data_dn = c51.read_data(filename, datapath, 0, 0) data_pos = c51.ispin_avg(data_up, data_dn) #Read spin averaged negative parity proton datapath = path+'proton_np/spin_up' data_up = c51.read_data(filename, datapath, 0, 0) datapath = path+'proton_np/spin_dn' data_dn = c51.read_data(filename, datapath, 0, 0) data_neg = c51.ispin_avg(data_up, data_dn) #Parity average data_ss = c51.parity_avg(data_pos, data_neg, -1) datapath = path+'proton/spin_up' data_up = c51.read_data(filename, datapath, 3, 0) datapath = path+'proton/spin_dn' data_dn = c51.read_data(filename, datapath, 3, 0) data_pos = c51.ispin_avg(data_up, data_dn) #Read spin averaged negative parity proton datapath = path+'proton_np/spin_up'