Changes

Jump to navigation Jump to search

Relax disp.spin lock offset+field figure

1,920 bytes added, 17:35, 6 November 2015
→‎See also: Fix for the category.
{{lowercase title}}
 
__TOC__
 
== Reference to original figure ==
Comparing to Figure 1 and 10 the reference.: * {{#lst:Citations|PalmerMassi06}}  [[File:Fig1 Palmer, A.G. & Massi, F. (2006). Characterization of the dynamics of biomacromolecules using rotating-frame spin relaxation NMR spectroscopy. Chem. Rev. 106, 1700-1719 [http://dx.doi.org/10png|thumb|center|upright=4|Try to reproduce Figure 1.1021/cr04042875 DOI]]
== Script to produce figure ==
<source {{collapsible script| type = Python script| title = Reproduce figure 1 of Palmer and Massi, 2006 using matplotlib.| lang ="python">| script =
#############
# Made by Troels E. Linnet
label = labels[i]
label.xy = tX[i],tY[i]
label.update_positions(fig.canvas.renderer)
tX_t, tY_t, _ = proj3d.proj_transform(dataX_t, dataY_t, dataZ_t, ax.get_proj())
for i in range(len(dataX_t)):
label = labels_t[i]
label.xy = tX_t[i],tY_t[i]
label.update_positions(fig.canvas.renderer)
fig.canvas.draw()
#########
fig = plt.figure(figsize=(12, 12))
ax=fig.gca(projection='3d')
ax.add_patch(circle)
#art3d.pathpatch_2d_to_3d(circle, z=0, zdir='y')
pathpatch_2d_to_3d(circle, z=0, normal = ([1, 0, 1] ) ) 
#######
#Input 3D Data for Text
# Sx Sy Sx Szp Sxp w1 O1 we1 O_av w_edata = np.array([[1,0,0], Sy = [0,-1,0], Sz = [0,0,1], Szp = [01.9751,0,1.171], Sxp = [0.75,0,-0.75], w1 = [0.7,0,0], O1 = [0,0,0.3]we1 = [w1[0],0, O1[2]]O_av = [0.70,0,Szp[2]/Szp[0.3], *w1[0.]]we = [w1[0],0,Szp[2]/Szp[0.84], *w1[0]] data = np.7array([Sx, Sy, Sz , Szp , Sxp, w1, O1, we1,0O_av,0.84]we])
textlab = [r"S$_x$", r"S$_y$=S$_y$'", r"S$_z$", r"S$_z$'", r"S$_x$'", r"$\omega_1$", r"$\Omega_1$", r"$\omega_{e1}$", r"$\bar{\Omega}$", r"$\omega_{e}$"]
#Array of labels
labels = []
 
#Loop through data points to initially annotate scatter plot
#and populate labels array
label = ax.annotate(text,
xycoords='data',
xy = (tX[i], tY[i]), xytext = (-+20, -20),
textcoords = 'offset points', ha = 'right', va = 'top', fontsize=12,
bbox = dict(boxstyle = 'round,pad=0.5', fc = 'grey', alpha = 0.8),
arrowprops = dict(arrowstyle = '->', connectionstyle = 'arc3,rad=0'))
labels.append(label)
#######
 
#######
#Input 3D Data for Ttheta
 
t1 = [0.5*we1[0],0,0.5*we1[2]]
t = [0.5*we[0],0,0.5*we[2]]
 
data_t = np.array([t1, t])
textlab_t = [r"$\theta_1$", r"$\theta$"]
 
#Separate into X, Y, Z for greater clarity
dataX_t = data_t[:,0]
dataY_t = data_t[:,1]
dataZ_t = data_t[:,2]
 
#3D scatter plot
ax.scatter(dataX_t, dataY_t, dataZ_t, marker = 'o', c='k', s=1)
 
#Transform co-ordinates to get initial 2D projection
tX_t, tY_t, _ = proj3d.proj_transform(dataX_t, dataY_t, dataZ_t, ax.get_proj())
 
#Array of labels
labels_t = []
#Loop through data points to initially annotate scatter plot
#and populate labels array
for i in range(len(dataX_t)):
#text='['+str(int(dataX[i]))+','+str(int(dataY[i]))+','+str(int(dataZ[i]))+']'
text=textlab_t[i]
label = ax.annotate(text,
xycoords='data',
xy = (tX[i], tY[i]), xytext = (-100, 50),
textcoords = 'offset points', ha = 'right', va = 'top', fontsize=12,
bbox = dict(boxstyle = 'round,pad=0.5', fc = 'grey', alpha = 0.8),
arrowprops = dict(arrowstyle = '->', connectionstyle = 'angle3,angleA=0,angleB=90'))
labels_t.append(label)
#######
 
 
# Make Sx
i x, y, z = 0SxSx = Arrow3D([-1, dataX[i]x],[0, dataY[i]y], [0, dataZ[i]z], mutation_scale=20, lw=1, arrowstyle="-|{{!}}>", color="k")
ax.add_artist(Sx)
# Make Sy
i +x, y, z = 1SySy fSy = Arrow3D([0, dataX[i]x],[1, dataY[i]y], [0, dataZ[i]z], mutation_scale=20, lw=1, arrowstyle="-|{{!}}>", color="k")ax.add_artist(SyfSy)
# Make Sz
i +x, y, z = 1SzSz fSz = Arrow3D([0, dataX[i]x],[0, dataY[i]y], [-1, dataZ[i]z], mutation_scale=20, lw=1, arrowstyle="-|{{!}}>", color="k")ax.add_artist(SzfSz)
# Make Szp
i +x, y, z = 1SzpSzp fSzp = Arrow3D([0, dataX[i]x],[0, dataY[i]y], [0, dataZ[i]z], mutation_scale=20, lw=3, arrowstyle="-|{{!}}>", color="k")ax.add_artist(SzpfSzp)
# Make Sxp
i +x, y, z = 1SxpSxp fSxp = Arrow3D([0, dataX[i]x],[0, dataY[i]y], [0, dataZ[i]z], mutation_scale=20, lw=3, arrowstyle="-|{{!}}>", color="k")ax.add_artist(SxpfSxp)
# Make w1
i +x, y, z = 1w1w1 fw1 = Arrow3D([0, dataX[i]x],[0, dataY[i]y], [0, dataZ[i]z], mutation_scale=20, lw=1, arrowstyle="-", color="k")ax.add_artist(w1fw1)
# Make O1
i +x, y, z = 1O1O1 fO1 = Arrow3D([0, dataX[i]x],[0, dataY[i]y], [0, dataZ[i]y], mutation_scale=20, lw=1, arrowstyle="-", color="k")ax.add_artist(O1fO1)
# Make we1
i +x, y, z = we1fwe1 = Arrow3D([0, x],[0, y], [0, z], mutation_scale=20, lw= 1, arrowstyle="-{{!}}>", color="b")ax.add_artist(fwe1) # Make O1 -> we1 fO1_we1 = Arrow3D([O1[0], dataXwe1[i0]],[0O1[1], dataYwe1[i1]], [0O1[2], dataZwe1[i2]], mutation_scale=20, lw=1, arrowstyle="-|>", color="b")ax.add_artist(we1fO1_we1)
# Make O_av
i +x, y, z = 1O_avO_av fO_av = Arrow3D([0, dataX[i]x],[0, dataY[i]y], [0, dataZ[i]z], mutation_scale=20, lw=1, arrowstyle="-", color="k")ax.add_artist(O_avfO_av)
# Make we
i +x, y, z = wefwe = Arrow3D([0, x],[0, y], [0, z], mutation_scale=20, lw= 1, arrowstyle="-{{!}}>", color="r")ax.add_artist(fwe) # Make w1 -> we fw1_we = Arrow3D([w1[0], we[0]],[w1[1], we[1]], dataX[iw1[2], we[2]], mutation_scale=20, lw=1, arrowstyle="-", color="r")ax.add_artist(fw1_we) # Make O_ave -> wefO_av_we = Arrow3D([O_av[0],we[0]],[O_av[1], dataYwe[i1]], [0O_av[2], dataZwe[i2]], mutation_scale=20, lw=1, arrowstyle="-|>", color="r")ax.add_artist(wefO_av_we)
fig.canvas.mpl_connect('button_release_event', update_position)
plt.show()
</source>}} == See also == [[Category:Relaxation dispersion analysis]]
Trusted, Bureaucrats
4,223

edits

Navigation menu