Changes

Jump to navigation Jump to search

Matplotlib DPL94 R1rho R2eff

1,272 bytes added, 22:22, 14 March 2014
point = (di + 1) * (max(spin_lock_nu1[ei][mi][oi])+extend) / num_points
spin_lock_nu1_new[ei][mi][oi].append(point)
# Intersert field 0
spin_lock_nu1_new[ei][mi][oi][0] = 0.1
# Convert to a numpy array.
# Then back calculate R2eff data for the interpolated points.
cdp.myspin.back_calc = optimisation.back_calc_r2eff(spin=cdp.myspin, spin_id=spin_inte, spin_lock_nu1=spin_lock_nu1_new)
 
# Calculate the offset data, interpolated
theta_spin_dic_inter, Domega_spin_dic_inter, w_eff_spin_dic_inter, dic_key_list_inter = calc_rotating_frame_params(spin=cdp.myspin, spin_id=spin_inte, fields = spin_lock_nu1_new, verbosity=0)
###### Store the data before plotting
cdp.mydic = collections.OrderedDict()
# Loop over the data structuresand save to dictionary
for exp_type, frq, offset, ei, mi, oi in loop_exp_frq_offset(return_indices=True):
r20_key = generate_r20_key(exp_type=exp_type, frq=frq)
cdp.mydic[exp_type][frq][offset]['point_inter'] = []
cdp.mydic[exp_type][frq][offset]['theta'] = []
cdp.mydic[exp_type][frq][offset]['theta_inter'] = []
cdp.mydic[exp_type][frq][offset]['w_eff'] = []
cdp.mydic[exp_type][frq][offset]['w_eff_inter'] = []
# Y val
cdp.mydic[exp_type][frq][offset]['R1_rho'] = []
cdp.mydic[exp_type][frq][offset]['R1_rho_R2eff'] = []
cdp.mydic[exp_type][frq][offset]['R1_rho_R2eff_err'] = []
cdp.mydic[exp_type][frq][offset]['R1_rho_R2eff_inter'] = []
  # Loop over the orginal original dispersion points.
for point, di in loop_point(exp_type=exp_type, frq=frq, offset=offset, return_indices=True):
param_key = return_param_key_from_data(exp_type=exp_type, frq=frq, offset=offset, point=point)
for di in range(len(cdp.myspin.back_calc[ei][0][mi][oi])):
point = spin_lock_nu1_new[ei][mi][oi][di]
print point
param_key = return_param_key_from_data(exp_type=exp_type, frq=frq, offset=offset, point=point)
# X val
cdp.mydic[exp_type][frq][offset]['point_inter'].append(point) theta = theta_spin_dic_inter[param_key] cdp.mydic[exp_type][frq][offset]['theta_inter'].append(theta) cdp.mydic[exp_type][frq][offset]['w_eff_inter'].append(w_eff_spin_dic_inter[param_key])
# Y val
cdp.mydic[exp_type][frq][offset]['R1_rho_inter'].append(R1_rho)
# Y2 val # Calc R1_rho_R2eff R1_rho_R2eff = (R1_rho - R1*cos(theta)*cos(theta)) / (sin(theta) * sin(theta)) cdp.mydic[exp_type][frq][offset]['R1_rho_R2eff_inter'].append(R1_rho_R2eff)
####### PLOT ####
## Modify data
w_eff_div = 10**4
## Define labels for plotting
xlabel_theta = 'Rotating frame tilt angle [rad]'
xlabel_w_eff = 'Effective field in rotating frame [%s rad.s^-1]'%(str(w_eff_div))
xlabel_lock = 'Spin-lock field strength [Hz]'
# Plot 1: R1_rho as function of theta.
plt.figure(1)
line, = plt.plot(val_dics['theta_inter'], val_dics['R1_rho_inter'], '-', label=graphlabel_inter) plt.errorbar(val_dics['theta'], val_dics['R1_rho'], yerr=val_dics['R1_rho_err'], fmt='o', label=graphlabel, color=line.get_color()) #plt.plot(val_dics['theta'], val_dics['R1_rhoR1_rho_bc'], '-oD', label=graphlabelgraphlabel_bc, color=line.get_color())
# Plot 2: R1_rho_R2eff as function of w_eff
plt.figure(2)
x_w_eff_mod line, = plt.plot(val_dics[x/w_eff_div for x in 'w_eff_inter'], val_dics['w_effR1_rho_R2eff_inter']], '-', label=graphlabel_inter) plt.errorbar(x_w_eff_modval_dics['w_eff'], val_dics['R1_rho_R2eff'], yerr=val_dics['R1_rho_R2eff_err'], fmt='o', label=graphlabel, color=line.get_color())
#plt.plot(x_w_eff_mod, val_dics['R1_rho_R2eff'], 'o', label=graphlabel)
plt.grid(True)
plt.ylim([0,16])
plt.xlim([0,220000])
plt.title("%s \n %s as function of %s"%(spin_inte, ylabel_R1_rho_R2eff, xlabel_w_eff))
#plt.savefig("matplotlib_%s_%s_w_eff.png"%(spin_inte_rep, plotlabel_R1_rho_R2eff) )

Navigation menu