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
def read_baryon(pr): # read data baryon = pr.baryon2pt if baryon in ['proton', 'sigma', 'xi', 'lambda']: corr_up = c51.open_data(pr.data_loc['file_loc'], pr.data_loc[baryon + '_spin_up']) corr_dn = c51.open_data(pr.data_loc['file_loc'], pr.data_loc[baryon + '_spin_dn']) corrnp_up = c51.open_data(pr.data_loc['file_loc'], pr.data_loc[baryon + '_np_spin_up']) corrnp_dn = c51.open_data(pr.data_loc['file_loc'], pr.data_loc[baryon + '_np_spin_dn']) # spin avg corr = 0.5 * (corr_up + corr_dn) corrnp = 0.5 * (corrnp_up + corrnp_dn) elif baryon in ['delta', 'sigma_st', 'xi_st', 'omega']: corr_upup = c51.open_data(pr.data_loc['file_loc'], pr.data_loc[baryon + '_spin_upup']) corr_up = c51.open_data(pr.data_loc['file_loc'], pr.data_loc[baryon + '_spin_up']) corr_dn = c51.open_data(pr.data_loc['file_loc'], pr.data_loc[baryon + '_spin_dn']) corr_dndn = c51.open_data(pr.data_loc['file_loc'], pr.data_loc[baryon + '_spin_dndn']) corrnp_upup = c51.open_data(pr.data_loc['file_loc'], pr.data_loc[baryon + '_np_spin_upup']) corrnp_up = c51.open_data(pr.data_loc['file_loc'], pr.data_loc[baryon + '_np_spin_up']) corrnp_dn = c51.open_data(pr.data_loc['file_loc'], pr.data_loc[baryon + '_np_spin_dn']) corrnp_dndn = c51.open_data(pr.data_loc['file_loc'], pr.data_loc[baryon + '_np_spin_dndn']) # spin avg corr = 0.25 * (corr_upup + corr_up + corr_dn + corr_dndn) corrnp = 0.25 * (corrnp_upup + corrnp_up + corrnp_dn + corrnp_dndn) # parity avg corr_avg = c51.parity_avg(corr, corrnp, phase=-1.0) T = len(corr_avg[0]) corr_avg = corr_avg[:, :T / 2] # keep only first half of data ('folded' length) if pr.plot_data_flag == 'on': for src in range(len(corr_avg[0, 0, 0])): for snk in range(len(corr_avg[0, 0])): # folded correlator data corr_i = corr_avg[:, :, snk, src] #c51.scatter_plot(np.arange(len(corr_i[0])), c51.make_gvars(corr_i), '%s snk_%s src_%s folded' %(baryon,str(snk),str(src))) # effective mass eff = c51.effective_plots(T) meff = eff.effective_mass( c51.make_gvars(corr_i)[1:], 1, 'cosh') xlim = [1, len(meff)] ylim = c51.find_yrange(meff, xlim[0], xlim[1] * 2 / 5) c51.scatter_plot(np.arange(len(meff)) + 1, meff, '%s snk_%s src_%s effective mass' % (baryon, str(snk), str(src)), xlim=xlim, ylim=ylim) # scaled correlator E0 = pr.priors[baryon]['E0'][0] scaled = eff.scaled_correlator(c51.make_gvars(corr_i), E0, phase=1.0) ylim = c51.find_yrange(scaled, xlim[0], xlim[1] * 2 / 5) c51.scatter_plot( np.arange(len(scaled)), scaled, '%s snk_%s src_%s scaled correlator (take sqrt to get Z0_s)' % (baryon, str(snk), str(src)), xlim=xlim, ylim=ylim) plt.show() return corr_avg, T
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' data_up = c51.read_data(filename, datapath, 3, 0) datapath = path + 'proton_np/spin_dn' data_dn = c51.read_data(filename, datapath, 3, 0) data_neg = c51.ispin_avg(data_up, data_dn) #Parity average data_ps = c51.parity_avg(data_pos, data_neg, -1) ##READ SPIN AND PARITY AVG'D DATA
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' data_up = c51.read_data(filename, datapath, 3, 0) datapath = path+'proton_np/spin_dn' data_dn = c51.read_data(filename, datapath, 3, 0) data_neg = c51.ispin_avg(data_up, data_dn) #Parity average data_ps = c51.parity_avg(data_pos, data_neg, -1) ##READ SPIN AND PARITY AVG'D DATA