Difference between revisions of "Matplotlib DPL94 R1rho R2eff"
(→References: Switched to a labelled section transclusion for the citations.) |
|||
(31 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
+ | __TOC__ | ||
+ | |||
== About == | == About == | ||
+ | The production to these figures relates to the Suppport Request:<br> | ||
+ | [https://gna.org/support/?3124 sr #3124: Grace graphs production for R1rho analysis with R2_eff as function of Omega_eff] | ||
+ | |||
+ | == References == | ||
+ | [http://www.nmr-relax.com/manual/Dispersion_model_summary.html Refer to the manual for parameter explanation] | ||
+ | |||
+ | * {{#lst:Citations|Evenäs01}} | ||
+ | * {{#lst:Citations|KempfLoria04}} | ||
+ | * {{#lst:Citations|Massi05}} | ||
+ | * {{#lst:Citations|Palmer01}} | ||
+ | * {{#lst:Citations|PalmerMassi06}} | ||
+ | |||
+ | === Figures === | ||
+ | |||
+ | Ref [1], Figure 1.b. | ||
+ | '''The bell-curves''' As function of angle calculation. | ||
+ | |||
+ | Ref [1], Figure 1.c. | ||
+ | The wanted graph. No clear "name" for the calculated parameter. | ||
+ | |||
+ | Ref [2], Equation 27. | ||
+ | Here the calculated value is noted as: {{:Reff}} = {{:R1rho}} / sin<sup>2</sup>(θ) - {{:R1}} / tan<sup>2</sup>(θ) = {{:R2zero}} + {{:Rex}}, where {{:R2zero}} refers to {{:R1rhoprime}} as seen at [[DPL94]] | ||
+ | |||
+ | Ref [3], Equation 20. | ||
+ | Here the calculated value is noted as: {{:R2}} = {{:R1rho}} / sin<sup>2</sup>(θ) - {{:R1}} / tan<sup>2</sup>(θ). Figure 11+16, would be the reference. | ||
+ | |||
+ | Ref [4], Equation 43. {{:Reff}} = {{:R1rho}} / sin<sup>2</sup>(θ) - {{:R1}} / tan<sup>2</sup>(θ). | ||
+ | |||
+ | Ref [5], Material and Methods, page 740. Here the calculated value is noted as: {{:R2}}: {{:R2}} = {{:R2zero}} + {{:Rex}}. Figure 4 would be the wished graphs. | ||
+ | |||
+ | |||
+ | A little table of conversion then gives | ||
+ | |||
+ | <source lang="text"> | ||
+ | Relax equation | Relax store | Articles | ||
+ | --------------------------------------------------------------- | ||
+ | R1rho' spin.r2 R^{0}_2 or Bar{R}_2 | ||
+ | Fitted pars Not stored R_ex | ||
+ | R1rho spin.r2eff R1rho | ||
+ | R_1 spin.ri_data['R1'] R_1 or Bar{R}_1 | ||
+ | </source> | ||
+ | |||
+ | The parameter is called R_2 or R_eff in the articles. | ||
+ | Since reff is not used in relax, this could be used? | ||
+ | |||
+ | A description could be: | ||
+ | * The effective rate | ||
+ | * The effective transverse relaxation rate constant | ||
+ | * The effective relaxation rate constant. | ||
+ | |||
+ | == Make graphs == | ||
+ | |||
+ | === The outcome === | ||
+ | [[File:Matplotlib 52 N R1 rho theta sep.png|center|upright=2|Figure 1]] | ||
+ | [[File:Matplotlib 52 N R1 rho R2eff w eff.png|center|upright=2|Figure 2]] | ||
+ | [[File:Matplotlib 52 N R1 rho R2eff disp.png|center|upright=2|Figure 3]] | ||
+ | |||
+ | == To run == | ||
+ | <source lang="bash"> | ||
+ | relax -p r1rhor2eff.py | ||
+ | </source> | ||
+ | |||
+ | === Code === | ||
− | = | + | {{Collapsible script |
− | + | | title = r1rhor2eff.py Python script | |
− | + | | lang = python | |
+ | | script = | ||
### python imports | ### python imports | ||
import sys | import sys | ||
import os | import os | ||
− | from math import cos, sin | + | from math import cos, sin, sqrt, pi |
from numpy import array, float64 | from numpy import array, float64 | ||
− | + | ||
### plotting facility. | ### plotting facility. | ||
import matplotlib.pyplot as plt | import matplotlib.pyplot as plt | ||
− | + | ||
# Ordered dictionary | # Ordered dictionary | ||
import collections | import collections | ||
− | + | ||
### relax modules | ### relax modules | ||
# Import some tools to loop over the spins. | # Import some tools to loop over the spins. | ||
Line 22: | Line 88: | ||
from specific_analyses.relax_disp.disp_data import calc_rotating_frame_params, generate_r20_key, loop_exp_frq, loop_exp_frq_offset, loop_point, return_param_key_from_data, return_spin_lock_nu1 | from specific_analyses.relax_disp.disp_data import calc_rotating_frame_params, generate_r20_key, loop_exp_frq, loop_exp_frq_offset, loop_point, return_param_key_from_data, return_spin_lock_nu1 | ||
from specific_analyses.relax_disp import optimisation | from specific_analyses.relax_disp import optimisation | ||
− | + | from lib.nmr import frequency_to_Hz, frequency_to_ppm, frequency_to_rad_per_s | |
+ | |||
############### | ############### | ||
− | + | ||
# You have to provide a DPL94 results state file | # You have to provide a DPL94 results state file | ||
res_folder = "resultsR1" | res_folder = "resultsR1" | ||
#res_folder = "results_clustering" | #res_folder = "results_clustering" | ||
res_state = os.path.join(res_folder, "DPL94", "results") | res_state = os.path.join(res_folder, "DPL94", "results") | ||
− | spin_inte = ": | + | spin_inte = ":44@N" |
− | + | # Make a fake spin, from the spin of interest | |
+ | fake_spin_inte = spin_inte.replace("N","X") | ||
+ | |||
# Interpolate graph settings | # Interpolate graph settings | ||
#num_points=1000, extend=500.0 | #num_points=1000, extend=500.0 | ||
num_points=100 | num_points=100 | ||
extend=5000.0 | extend=5000.0 | ||
− | + | ||
################ | ################ | ||
spin_inte_rep = spin_inte.replace('#', '_').replace(':', '_').replace('@', '_') | spin_inte_rep = spin_inte.replace('#', '_').replace(':', '_').replace('@', '_') | ||
− | + | ||
# Load the state | # Load the state | ||
state.load(res_state, force=True) | state.load(res_state, force=True) | ||
+ | # Get the dictionary key | ||
+ | for exp_type, frq in loop_exp_frq(): | ||
+ | r20_key = generate_r20_key(exp_type=exp_type, frq=frq) | ||
+ | |||
# Show pipes | # Show pipes | ||
pipe.display() | pipe.display() | ||
pipe.current() | pipe.current() | ||
− | + | ||
# Get the spin of interest and save it in cdp, to access it after execution of script. | # Get the spin of interest and save it in cdp, to access it after execution of script. | ||
cdp.myspin = return_spin(spin_inte) | cdp.myspin = return_spin(spin_inte) | ||
+ | |||
+ | # Copy the parameters from spin of interest to a fake spin to be modified. | ||
+ | spin.copy(spin_from=spin_inte, spin_to=fake_spin_inte) | ||
+ | # Returnspin | ||
+ | cdp.fakespin = return_spin(fake_spin_inte) | ||
+ | |||
+ | # Modify data | ||
+ | if spin_inte == ":52@N": | ||
+ | # Set reference data | ||
+ | cdp.fakespin.r2[r20_key] = 6.51945 | ||
+ | cdp.fakespin.kex = 13193.82986 | ||
+ | cdp.fakespin.kex_err = 2307.09152 | ||
+ | phi_ex_rad2_s2 = 93499.92172 | ||
+ | phi_ex_err_rad2_s2 = 33233.23039 | ||
+ | scaling_rad2_s2 = frequency_to_ppm(frq=1/(2*pi), B0=cdp.spectrometer_frq_list[0], isotope='15N')**2 | ||
+ | print scaling_rad2_s2 | ||
+ | |||
+ | cdp.fakespin.phi_ex = phi_ex_rad2_s2*scaling_rad2_s2 | ||
+ | cdp.fakespin.phi_ex_err = phi_ex_err_rad2_s2*scaling_rad2_s2 | ||
+ | |||
+ | print cdp.myspin.ri_data['R1'], cdp.myspin.ri_data_err['R1'], cdp.myspin.r2[r20_key], cdp.myspin.kex, cdp.myspin.phi_ex | ||
+ | print cdp.fakespin.ri_data['R1'], cdp.fakespin.ri_data_err['R1'], cdp.fakespin.r2[r20_key], cdp.fakespin.kex, cdp.fakespin.phi_ex | ||
+ | |||
# Calculate the offset data | # Calculate the offset data | ||
− | theta_spin_dic, Domega_spin_dic, w_eff_spin_dic, dic_key_list = calc_rotating_frame_params(spin=cdp.myspin, spin_id=spin_inte, verbosity= | + | theta_spin_dic, Domega_spin_dic, w_eff_spin_dic, dic_key_list = calc_rotating_frame_params(spin=cdp.myspin, spin_id=spin_inte, verbosity=0) |
# Save the data in cdp to access it after execution of script. | # Save the data in cdp to access it after execution of script. | ||
cdp.myspin.theta_spin_dic = theta_spin_dic | cdp.myspin.theta_spin_dic = theta_spin_dic | ||
cdp.myspin.w_eff_spin_dic = w_eff_spin_dic | cdp.myspin.w_eff_spin_dic = w_eff_spin_dic | ||
cdp.myspin.dic_key_list = dic_key_list | cdp.myspin.dic_key_list = dic_key_list | ||
− | + | ||
############################ | ############################ | ||
# First creacte back calculated R2eff data for interpolated plots. | # First creacte back calculated R2eff data for interpolated plots. | ||
############################ | ############################ | ||
+ | |||
+ | |||
+ | # Return the original structure for frq, offset | ||
+ | spin_lock_nu1 = return_spin_lock_nu1(ref_flag=False) | ||
+ | # Back calculate R2eff data for the set parameters. | ||
+ | cdp.fakespin.back_calc = optimisation.back_calc_r2eff(spin=cdp.fakespin, spin_id=fake_spin_inte, spin_lock_nu1=spin_lock_nu1) | ||
− | |||
− | |||
# Prepare list to hold new data | # Prepare list to hold new data | ||
spin_lock_nu1_new = [] | spin_lock_nu1_new = [] | ||
− | |||
# Loop over the structures to generate data | # Loop over the structures to generate data | ||
for ei in range(len(spin_lock_nu1)): | for ei in range(len(spin_lock_nu1)): | ||
# Add a new dimension. | # Add a new dimension. | ||
spin_lock_nu1_new.append([]) | spin_lock_nu1_new.append([]) | ||
− | + | ||
# Then loop over the spectrometer frequencies. | # Then loop over the spectrometer frequencies. | ||
for mi in range(len(spin_lock_nu1[ei])): | for mi in range(len(spin_lock_nu1[ei])): | ||
# Add a new dimension. | # Add a new dimension. | ||
spin_lock_nu1_new[ei].append([]) | spin_lock_nu1_new[ei].append([]) | ||
− | + | ||
# Finally the offsets. | # Finally the offsets. | ||
for oi in range(len(spin_lock_nu1[ei][mi])): | for oi in range(len(spin_lock_nu1[ei][mi])): | ||
# Add a new dimension. | # Add a new dimension. | ||
spin_lock_nu1_new[ei][mi].append([]) | spin_lock_nu1_new[ei][mi].append([]) | ||
− | + | ||
# No data. | # No data. | ||
if not len(spin_lock_nu1[ei][mi][oi]): | if not len(spin_lock_nu1[ei][mi][oi]): | ||
continue | continue | ||
− | + | ||
# Interpolate (adding the extended amount to the end). | # Interpolate (adding the extended amount to the end). | ||
for di in range(num_points): | for di in range(num_points): | ||
Line 91: | Line 190: | ||
# Intersert field 0 | # Intersert field 0 | ||
#spin_lock_nu1_new[ei][mi][oi][0] = 0.0 | #spin_lock_nu1_new[ei][mi][oi][0] = 0.0 | ||
− | + | ||
# Convert to a numpy array. | # Convert to a numpy array. | ||
spin_lock_nu1_new[ei][mi][oi] = array(spin_lock_nu1_new[ei][mi][oi], float64) | spin_lock_nu1_new[ei][mi][oi] = array(spin_lock_nu1_new[ei][mi][oi], float64) | ||
− | + | ||
# Then back calculate R2eff data for the interpolated points. | # 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) | 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 | # 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) | 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 | ###### Store the data before plotting | ||
# Create a dictionary to hold data | # Create a dictionary to hold data | ||
cdp.mydic = collections.OrderedDict() | cdp.mydic = collections.OrderedDict() | ||
− | + | ||
# Loop over the data structures and save to dictionary | # Loop over the data structures and save to dictionary | ||
for exp_type, frq, offset, ei, mi, oi in loop_exp_frq_offset(return_indices=True): | for exp_type, frq, offset, ei, mi, oi in loop_exp_frq_offset(return_indices=True): | ||
− | |||
− | |||
# This is not used, but could be used to get Rex. | # This is not used, but could be used to get Rex. | ||
R1_rho_prime = cdp.myspin.r2[r20_key] | R1_rho_prime = cdp.myspin.r2[r20_key] | ||
− | + | #print R1_rho_prime | |
+ | |||
# Get R1 | # Get R1 | ||
R1 = cdp.myspin.ri_data['R1'] | R1 = cdp.myspin.ri_data['R1'] | ||
R1_err = cdp.myspin.ri_data_err['R1'] | R1_err = cdp.myspin.ri_data_err['R1'] | ||
− | + | ||
# Add to dic | # Add to dic | ||
if exp_type not in cdp.mydic: | if exp_type not in cdp.mydic: | ||
Line 135: | Line 233: | ||
cdp.mydic[exp_type][frq][offset]['R1_rho_bc'] = [] | cdp.mydic[exp_type][frq][offset]['R1_rho_bc'] = [] | ||
cdp.mydic[exp_type][frq][offset]['R1_rho_inter'] = [] | cdp.mydic[exp_type][frq][offset]['R1_rho_inter'] = [] | ||
+ | |||
+ | # Y val fake | ||
+ | cdp.mydic[exp_type][frq][offset]['fake_R1_rho'] = [] | ||
+ | |||
# Y2 val | # Y2 val | ||
cdp.mydic[exp_type][frq][offset]['R1_rho_R2eff'] = [] | cdp.mydic[exp_type][frq][offset]['R1_rho_R2eff'] = [] | ||
Line 140: | Line 242: | ||
cdp.mydic[exp_type][frq][offset]['R1_rho_R2eff_bc'] = [] | cdp.mydic[exp_type][frq][offset]['R1_rho_R2eff_bc'] = [] | ||
cdp.mydic[exp_type][frq][offset]['R1_rho_R2eff_inter'] = [] | cdp.mydic[exp_type][frq][offset]['R1_rho_R2eff_inter'] = [] | ||
− | + | ||
# Loop over the original dispersion points. | # Loop over the original dispersion points. | ||
for point, di in loop_point(exp_type=exp_type, frq=frq, offset=offset, return_indices=True): | 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) | param_key = return_param_key_from_data(exp_type=exp_type, frq=frq, offset=offset, point=point) | ||
− | + | ||
# X val | # X val | ||
cdp.mydic[exp_type][frq][offset]['point'].append(point) | cdp.mydic[exp_type][frq][offset]['point'].append(point) | ||
Line 151: | Line 253: | ||
w_eff = w_eff_spin_dic[param_key] | w_eff = w_eff_spin_dic[param_key] | ||
cdp.mydic[exp_type][frq][offset]['w_eff'].append(w_eff) | cdp.mydic[exp_type][frq][offset]['w_eff'].append(w_eff) | ||
− | + | ||
# Average resonance spin_lock_offset | # Average resonance spin_lock_offset | ||
#print Domega_spin_dic[param_key] | #print Domega_spin_dic[param_key] | ||
− | + | ||
# Y val | # Y val | ||
R1_rho = cdp.myspin.r2eff[param_key] | R1_rho = cdp.myspin.r2eff[param_key] | ||
Line 162: | Line 264: | ||
R1_rho_bc = cdp.myspin.r2eff_bc[param_key] | R1_rho_bc = cdp.myspin.r2eff_bc[param_key] | ||
cdp.mydic[exp_type][frq][offset]['R1_rho_bc'].append(R1_rho_bc) | cdp.mydic[exp_type][frq][offset]['R1_rho_bc'].append(R1_rho_bc) | ||
+ | |||
+ | # Y val, fake | ||
+ | fake_R1_rho = cdp.fakespin.back_calc[ei][0][mi][oi][di] | ||
+ | cdp.mydic[exp_type][frq][offset]['fake_R1_rho'].append(fake_R1_rho) | ||
# Y2 val | # Y2 val | ||
Line 167: | Line 273: | ||
R1_rho_R2eff = (R1_rho - R1*cos(theta)*cos(theta)) / (sin(theta) * sin(theta)) | R1_rho_R2eff = (R1_rho - R1*cos(theta)*cos(theta)) / (sin(theta) * sin(theta)) | ||
cdp.mydic[exp_type][frq][offset]['R1_rho_R2eff'].append(R1_rho_R2eff) | cdp.mydic[exp_type][frq][offset]['R1_rho_R2eff'].append(R1_rho_R2eff) | ||
− | + | ||
R1_rho_R2eff_err = (R1_rho_err - R1_err*cos(theta)*cos(theta)) / (sin(theta) * sin(theta)) | R1_rho_R2eff_err = (R1_rho_err - R1_err*cos(theta)*cos(theta)) / (sin(theta) * sin(theta)) | ||
cdp.mydic[exp_type][frq][offset]['R1_rho_R2eff_err'].append(R1_rho_R2eff_err) | cdp.mydic[exp_type][frq][offset]['R1_rho_R2eff_err'].append(R1_rho_R2eff_err) | ||
− | + | ||
R1_rho_R2eff_bc = (R1_rho_bc - R1*cos(theta)*cos(theta)) / (sin(theta) * sin(theta)) | R1_rho_R2eff_bc = (R1_rho_bc - R1*cos(theta)*cos(theta)) / (sin(theta) * sin(theta)) | ||
cdp.mydic[exp_type][frq][offset]['R1_rho_R2eff_bc'].append(R1_rho_R2eff_bc) | cdp.mydic[exp_type][frq][offset]['R1_rho_R2eff_bc'].append(R1_rho_R2eff_bc) | ||
− | + | ||
## Loop over the new dispersion points. | ## Loop over the new dispersion points. | ||
for di in range(len(cdp.myspin.back_calc[ei][0][mi][oi])): | for di in range(len(cdp.myspin.back_calc[ei][0][mi][oi])): | ||
point = spin_lock_nu1_new[ei][mi][oi][di] | point = spin_lock_nu1_new[ei][mi][oi][di] | ||
param_key = return_param_key_from_data(exp_type=exp_type, frq=frq, offset=offset, point=point) | param_key = return_param_key_from_data(exp_type=exp_type, frq=frq, offset=offset, point=point) | ||
− | + | ||
# X val | # X val | ||
cdp.mydic[exp_type][frq][offset]['point_inter'].append(point) | cdp.mydic[exp_type][frq][offset]['point_inter'].append(point) | ||
Line 185: | Line 291: | ||
w_eff = w_eff_spin_dic_inter[param_key] | w_eff = w_eff_spin_dic_inter[param_key] | ||
cdp.mydic[exp_type][frq][offset]['w_eff_inter'].append(w_eff) | cdp.mydic[exp_type][frq][offset]['w_eff_inter'].append(w_eff) | ||
− | + | ||
# Y val | # Y val | ||
R1_rho = cdp.myspin.back_calc[ei][0][mi][oi][di] | R1_rho = cdp.myspin.back_calc[ei][0][mi][oi][di] | ||
cdp.mydic[exp_type][frq][offset]['R1_rho_inter'].append(R1_rho) | cdp.mydic[exp_type][frq][offset]['R1_rho_inter'].append(R1_rho) | ||
− | + | ||
# Y2 val | # Y2 val | ||
# Calc R1_rho_R2eff | # Calc R1_rho_R2eff | ||
R1_rho_R2eff = (R1_rho - R1*cos(theta)*cos(theta)) / (sin(theta) * sin(theta)) | 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) | cdp.mydic[exp_type][frq][offset]['R1_rho_R2eff_inter'].append(R1_rho_R2eff) | ||
− | + | ||
#if oi == 0: | #if oi == 0: | ||
#print exp_type, frq, offset, point, theta, w_eff | #print exp_type, frq, offset, point, theta, w_eff | ||
− | + | ||
####### PLOT #### | ####### PLOT #### | ||
− | + | ||
## Define labels for plotting | ## Define labels for plotting | ||
filesave_R1_rho_R2eff = 'R1_rho_R2eff' | filesave_R1_rho_R2eff = 'R1_rho_R2eff' | ||
filesave_R1_rho = 'R1_rho' | filesave_R1_rho = 'R1_rho' | ||
− | + | ||
# For writing math in matplotlib, see | # For writing math in matplotlib, see | ||
# http://matplotlib.org/1.3.1/users/mathtext.html | # http://matplotlib.org/1.3.1/users/mathtext.html | ||
− | + | ||
ylabel_R1_rho = r'R$_{1\rho}$ [rad s$^{-1}$]' | ylabel_R1_rho = r'R$_{1\rho}$ [rad s$^{-1}$]' | ||
− | ylabel_R1_rho_R2eff = r'R$_{1\rho, | + | ylabel_R1_rho_R2eff = r'R$_{1\rho}$, R$_{2,eff}$ [rad s$^{-1}$]' |
− | + | ||
xlabel_theta = 'Rotating frame tilt angle [rad]' | xlabel_theta = 'Rotating frame tilt angle [rad]' | ||
xlabel_w_eff = r'Effective field in rotating frame [rad s$^{-1}$]' | xlabel_w_eff = r'Effective field in rotating frame [rad s$^{-1}$]' | ||
xlabel_lock = 'Spin-lock field strength [Hz]' | xlabel_lock = 'Spin-lock field strength [Hz]' | ||
− | + | ||
# Set image inches size | # Set image inches size | ||
img_inch_x = 12 | img_inch_x = 12 | ||
img_inch_y = img_inch_x / 1.6 | img_inch_y = img_inch_x / 1.6 | ||
legend_size = 6 | legend_size = 6 | ||
− | + | ||
− | + | ||
# Plot values in dic | # Plot values in dic | ||
for exptype, frq_dic in cdp.mydic.items(): | for exptype, frq_dic in cdp.mydic.items(): | ||
Line 228: | Line 334: | ||
graphlabel_bc = "%3.1f_%3.3f_bc"%(frq/1E6, offset) | graphlabel_bc = "%3.1f_%3.3f_bc"%(frq/1E6, offset) | ||
graphlabel_inter = "%3.1f_%3.3f_inter"%(frq/1E6, offset) | graphlabel_inter = "%3.1f_%3.3f_inter"%(frq/1E6, offset) | ||
− | + | graphlabel_fake = "%3.1f_%3.3f_fake"%(frq/1E6, offset) | |
+ | |||
# Plot 1: R1_rho as function of theta. | # Plot 1: R1_rho as function of theta. | ||
plt.figure(1) | plt.figure(1) | ||
Line 234: | Line 341: | ||
plt.errorbar(val_dics['theta'], val_dics['R1_rho'], yerr=val_dics['R1_rho_err'], fmt='o', label=graphlabel, color=line.get_color()) | 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_rho_bc'], 'D', label=graphlabel_bc, color=line.get_color()) | plt.plot(val_dics['theta'], val_dics['R1_rho_bc'], 'D', label=graphlabel_bc, color=line.get_color()) | ||
− | + | ||
# Plot 2: R1_rho_R2eff as function of w_eff | # Plot 2: R1_rho_R2eff as function of w_eff | ||
plt.figure(2) | plt.figure(2) | ||
Line 245: | Line 352: | ||
plt.errorbar(val_dics['w_eff'], val_dics['R1_rho_R2eff'], yerr=val_dics['R1_rho_R2eff_err'], fmt='o', label=graphlabel, color=line.get_color()) | plt.errorbar(val_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(val_dics['w_eff'], val_dics['R1_rho_R2eff_bc'], 'D', label=graphlabel_bc, color=line.get_color()) | plt.plot(val_dics['w_eff'], val_dics['R1_rho_R2eff_bc'], 'D', label=graphlabel_bc, color=line.get_color()) | ||
− | + | ||
# Plot 3: R1_rho as function of as function of disp_point, the Spin-lock field strength | # Plot 3: R1_rho as function of as function of disp_point, the Spin-lock field strength | ||
plt.figure(3) | plt.figure(3) | ||
Line 251: | Line 358: | ||
plt.errorbar(val_dics['point'], val_dics['R1_rho'], yerr=val_dics['R1_rho_err'], fmt='o', label=graphlabel, color=line.get_color()) | plt.errorbar(val_dics['point'], val_dics['R1_rho'], yerr=val_dics['R1_rho_err'], fmt='o', label=graphlabel, color=line.get_color()) | ||
plt.plot(val_dics['point'], val_dics['R1_rho_bc'], 'D', label=graphlabel_bc, color=line.get_color()) | plt.plot(val_dics['point'], val_dics['R1_rho_bc'], 'D', label=graphlabel_bc, color=line.get_color()) | ||
− | + | plt.plot(val_dics['point'], val_dics['fake_R1_rho'], '*', label=graphlabel_fake, color=line.get_color()) | |
− | + | ||
+ | |||
# Define settings for each graph | # Define settings for each graph | ||
# Plot 1: R1_rho as function of theta. | # Plot 1: R1_rho as function of theta. | ||
Line 260: | Line 368: | ||
plt.legend(loc='best', prop={'size':legend_size}) | plt.legend(loc='best', prop={'size':legend_size}) | ||
plt.grid(True) | plt.grid(True) | ||
− | plt.ylim([0,16]) | + | #plt.ylim([0,16]) |
plt.title("%s \n %s as function of %s"%(spin_inte, ylabel_R1_rho, xlabel_theta)) | plt.title("%s \n %s as function of %s"%(spin_inte, ylabel_R1_rho, xlabel_theta)) | ||
fig1.set_size_inches(img_inch_x, img_inch_y) | fig1.set_size_inches(img_inch_x, img_inch_y) | ||
plt.savefig("matplotlib_%s_%s_theta_sep.png"%(spin_inte_rep, filesave_R1_rho) ) | plt.savefig("matplotlib_%s_%s_theta_sep.png"%(spin_inte_rep, filesave_R1_rho) ) | ||
− | + | ||
## Plot 2: R1_rho_R2eff as function of w_eff | ## Plot 2: R1_rho_R2eff as function of w_eff | ||
fig2 = plt.figure(2) | fig2 = plt.figure(2) | ||
Line 271: | Line 379: | ||
plt.legend(loc='best', prop={'size':legend_size}) | plt.legend(loc='best', prop={'size':legend_size}) | ||
plt.grid(True) | plt.grid(True) | ||
− | plt.ylim([0,16]) | + | #plt.ylim([0,16]) |
#plt.xlim([0,20000*20000]) | #plt.xlim([0,20000*20000]) | ||
plt.xlim([0,20000]) | plt.xlim([0,20000]) | ||
Line 277: | Line 385: | ||
fig2.set_size_inches(img_inch_x, img_inch_y) | fig2.set_size_inches(img_inch_x, img_inch_y) | ||
plt.savefig("matplotlib_%s_%s_w_eff.png"%(spin_inte_rep, filesave_R1_rho_R2eff) ) | plt.savefig("matplotlib_%s_%s_w_eff.png"%(spin_inte_rep, filesave_R1_rho_R2eff) ) | ||
− | + | ||
## Plot 3: R1_rho as function of as function of disp_point, the Spin-lock field strength | ## Plot 3: R1_rho as function of as function of disp_point, the Spin-lock field strength | ||
fig3 = plt.figure(3) | fig3 = plt.figure(3) | ||
Line 284: | Line 392: | ||
plt.legend(loc='best', prop={'size':legend_size}) | plt.legend(loc='best', prop={'size':legend_size}) | ||
plt.grid(True) | plt.grid(True) | ||
− | plt.ylim([0,16]) | + | #plt.ylim([0,16]) |
plt.title("%s \n %s as function of %s"%(spin_inte, ylabel_R1_rho, xlabel_lock)) | plt.title("%s \n %s as function of %s"%(spin_inte, ylabel_R1_rho, xlabel_lock)) | ||
fig3.set_size_inches(img_inch_x, img_inch_y) | fig3.set_size_inches(img_inch_x, img_inch_y) | ||
Line 290: | Line 398: | ||
plt.show() | plt.show() | ||
− | + | }} | |
− | == | + | == Bugs ? == |
− | + | Do you get an error with matplotlib about dateutil? Then see [[Matplotlib_dateutil_bug]] | |
− | |||
− | |||
== See also == | == See also == | ||
[[Category:Matplotlib]] | [[Category:Matplotlib]] | ||
− | [[Category:Relaxation_dispersion]] | + | [[Category:Relaxation_dispersion analysis]] |
Latest revision as of 15:53, 6 November 2015
Contents
About
The production to these figures relates to the Suppport Request:
sr #3124: Grace graphs production for R1rho analysis with R2_eff as function of Omega_eff
References
Refer to the manual for parameter explanation
- Evenäs, J., Malmendal, A. and Akke, M. (2001). Dynamics of the transition between open and closed conformations in a calmodulin C-terminal domain mutant. Structure, 9(3), 185-195. (DOI: 10.1016/S0969-2126(01)00575-5)
- Kempf, J. G. and Loria, J. P. (2004). Measurement of intermediate exchange phenomena. Methods Mol. Biol., 278, 185-231. (DOI: 10.1385/1-59259-809-9:185)
- Massi, F., Grey, M. J., Palmer, 3rd, A. G. (2005). Microsecond timescale backbone conformational dynamics in ubiquitin studied with NMR R1ρ relaxation experiments Protein science, 14(3), 735-742. (DOI: 10.1110/ps.041139505)
- Palmer, 3rd, A. G., Kroenke, C. D., and Loria, J. P. (2001). Nuclear magnetic resonance methods for quantifying microsecond-to-millisecond motions in biological macromolecules. Methods Enzymol., 339, 204-238. (DOI: 10.1016/S0076-6879(01)39315-1)
- Palmer, 3rd, A. G. and Massi, F. (2006). Characterization of the dynamics of biomacromolecules using rotating-frame spin relaxation NMR spectroscopy. Chem. Rev., 106(5), 1700-1719. (DOI: 10.1021/cr0404287)
Figures
Ref [1], Figure 1.b. The bell-curves As function of angle calculation.
Ref [1], Figure 1.c. The wanted graph. No clear "name" for the calculated parameter.
Ref [2], Equation 27. Here the calculated value is noted as: Reff = R1ρ / sin2(θ) - R1 / tan2(θ) = R20 + Rex, where R20 refers to R1ρ' as seen at DPL94
Ref [3], Equation 20. Here the calculated value is noted as: R2 = R1ρ / sin2(θ) - R1 / tan2(θ). Figure 11+16, would be the reference.
Ref [4], Equation 43. Reff = R1ρ / sin2(θ) - R1 / tan2(θ).
Ref [5], Material and Methods, page 740. Here the calculated value is noted as: R2: R2 = R20 + Rex. Figure 4 would be the wished graphs.
A little table of conversion then gives
Relax equation | Relax store | Articles
---------------------------------------------------------------
R1rho' spin.r2 R^{0}_2 or Bar{R}_2
Fitted pars Not stored R_ex
R1rho spin.r2eff R1rho
R_1 spin.ri_data['R1'] R_1 or Bar{R}_1
The parameter is called R_2 or R_eff in the articles. Since reff is not used in relax, this could be used?
A description could be:
- The effective rate
- The effective transverse relaxation rate constant
- The effective relaxation rate constant.
Make graphs
The outcome
To run
relax -p r1rhor2eff.py
Code
Bugs ?
Do you get an error with matplotlib about dateutil? Then see Matplotlib_dateutil_bug