mailRe: r24765 - /branches/r1rho_plotting/specific_analyses/relax_disp/data.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Edward d'Auvergne on July 28, 2014 - 12:10:
Hi,

I think it would be better to add a user function option called
something like {x_axis, x_data, plot_type} where you can choose
between {dispersion points, w_eff, theta}.  The reason is because it
would be best to make this independent of R1rho.  See
http://thread.gmane.org/gmane.science.nmr.relax.scm/22521/focus=6524
for why this also applies to CPMG-type data.  This also results in
more flexibility for the user and more documentation.  Also some users
chose to cover more of the offset dimension when collecting R1rho data
and others more of the dispersion point dimension - so then they can
choose which plots they would like.  However, in the auto-analysis, it
will make no difference in the end.  It is also a rather small change
to the front and backends.

Cheers,

Edward



On 28 July 2014 11:54, Troels Emtekær Linnet <tlinnet@xxxxxxxxxxxxx> wrote:
Hi Ed.

Is is currently hard-coded, that the relax_disp.plot_disp_curves user
function have the dispersion points along the X axis.

The current implementation will detect if it is an R1rho experiment.
Then it will produce:

R1rho R2 as function of the effective field w_eff.
http://wiki.nmr-relax.com/File:Matplotlib_52_N_R1_rho_R2eff_w_eff.png

R1rho as function of theta.
http://wiki.nmr-relax.com/File:Matplotlib_52_N_R1_rho_theta_sep.png

See for example.
http://wiki.nmr-relax.com/Matplotlib_DPL94_R1rho_R2eff


We can discuss if it the plotting should be voluntary, and thereby
adding a new/extending current user function.
Or it should just plot all the graphs.

Best
Troels



2014-07-28 11:32 GMT+02:00 Edward d'Auvergne <edward@xxxxxxxxxxxxx>:
Hi Troels,

The default, even for R1rho experiments for the
relax_disp.plot_disp_curves user function should be to have the
dispersion points along the X axis.  We should then present to the
user an option to switch this X axis to the offset.  Then, in the
auto-analysis, both sets of graphs could possibly be produced.  What
do you think?

Regards,

Edward


On 25 July 2014 20:56,  <tlinnet@xxxxxxxxxxxxx> wrote:
Author: tlinnet
Date: Fri Jul 25 20:56:37 2014
New Revision: 24765

URL: http://svn.gna.org/viewcvs/relax?rev=24765&view=rev
Log:
Changed interpolation function from offset to spin lock field strength, 
to plot R1rho R2 as function of effective field.

sr #3124(https://gna.org/support/?3124): Grace graphs production for 
R1rho analysis with R2_eff as function of Omega_eff.
sr #3138(https://gna.org/support/?3138): Interpolating theta through 
spin-lock offset [Omega], rather than spin-lock field strength [w1].

Modified:
    branches/r1rho_plotting/specific_analyses/relax_disp/data.py

Modified: branches/r1rho_plotting/specific_analyses/relax_disp/data.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/r1rho_plotting/specific_analyses/relax_disp/data.py?rev=24765&r1=24764&r2=24765&view=diff
==============================================================================
--- branches/r1rho_plotting/specific_analyses/relax_disp/data.py        
(original)
+++ branches/r1rho_plotting/specific_analyses/relax_disp/data.py        
Fri Jul 25 20:56:37 2014
@@ -1752,8 +1752,8 @@
         file_name = "theta%s.agr" % spin_id.replace('#', 
'_').replace(':', '_').replace('@', '_')

         if not spin.model in [MODEL_R2EFF]:
-            # Interpolate through spin-lock offset points.
-            interpolated_flag, back_calc, spin_lock_offset_new, 
chemical_shifts, spin_lock_fields_inter, offsets_inter, 
tilt_angles_inter, Delta_omega_inter, w_eff_inter = 
plot_disp_curves_interpolate_sl_offset(spin=spin, spin_id=spin_id, si=si, 
num_points=num_points, extend=extend)
+            # Interpolate through disp points.
+            interpolated_flag, back_calc, cpmg_frqs_new, 
spin_lock_nu1_new, chemical_shifts, spin_lock_fields_inter, 
offsets_inter, tilt_angles_inter, Delta_omega_inter, w_eff_inter = 
plot_disp_curves_interpolate_disp(spin=spin, spin_id=spin_id, si=si, 
num_points=num_points, extend=extend)

         else:
             back_calc = None
@@ -1786,7 +1786,7 @@
                 current_spin = proton

             # Loop over the spectrometer frequencies and offsets.
-            err, data, set_labels, set_colours, x_axis_type_zero, 
symbols, symbol_sizes, linetype, linestyle, axis_labels = 
plot_disp_curves_loop_frq(exp_type=exp_type, ei=ei, 
current_spin=current_spin, spin_id=spin_id, si=si, back_calc=back_calc, 
chemical_shifts=chemical_shifts, 
spin_lock_fields_inter=spin_lock_fields_inter, 
offsets_inter=offsets_inter, tilt_angles_inter=tilt_angles_inter, 
Delta_omega_inter=Delta_omega_inter, w_eff_inter=w_eff_inter, 
interpolated_flag=interpolated_flag, graph_index=graph_index, 
colour_order=colour_order, data=data, set_labels=set_labels, 
set_colours=set_colours, x_axis_type_zero=x_axis_type_zero, 
symbols=symbols, symbol_sizes=symbol_sizes, linetype=linetype, 
linestyle=linestyle, axis_labels=axis_labels)
+            err, data, set_labels, set_colours, x_axis_type_zero, 
symbols, symbol_sizes, linetype, linestyle, axis_labels = 
plot_disp_curves_loop_frq(exp_type=exp_type, ei=ei, 
current_spin=current_spin, spin_id=spin_id, si=si, back_calc=back_calc, 
spin_lock_nu1_new=spin_lock_nu1_new, chemical_shifts=chemical_shifts, 
tilt_angles_inter=tilt_angles_inter, Delta_omega_inter=Delta_omega_inter, 
w_eff_inter=w_eff_inter, interpolated_flag=interpolated_flag, 
graph_index=graph_index, colour_order=colour_order, data=data, 
set_labels=set_labels, set_colours=set_colours, 
x_axis_type_zero=x_axis_type_zero, symbols=symbols, 
symbol_sizes=symbol_sizes, linetype=linetype, linestyle=linestyle, 
axis_labels=axis_labels)

             # Increment the graph index.
             graph_index += 1
@@ -2033,7 +2033,7 @@
     return interpolated_flag, back_calc, spin_lock_offset_new, 
chemical_shifts, spin_lock_fields_inter, offsets, tilt_angles, 
Delta_omega, w_eff


-def plot_disp_curves_loop_frq(exp_type=None, ei=None, current_spin=None, 
spin_id=None, si=None, back_calc=None, chemical_shifts=None, 
spin_lock_fields_inter=None, offsets_inter=None, tilt_angles_inter=None, 
Delta_omega_inter=None, w_eff_inter=None, interpolated_flag=None, 
graph_index=None, colour_order=None, data=None, set_labels=None, 
set_colours=None, x_axis_type_zero=None, symbols=None, symbol_sizes=None, 
linetype=None, linestyle=None, axis_labels=None):
+def plot_disp_curves_loop_frq(exp_type=None, ei=None, current_spin=None, 
spin_id=None, si=None, back_calc=None, spin_lock_nu1_new=None, 
chemical_shifts=None, spin_lock_fields_inter=None, offsets_inter=None, 
tilt_angles_inter=None, Delta_omega_inter=None, w_eff_inter=None, 
interpolated_flag=None, graph_index=None, colour_order=None, data=None, 
set_labels=None, set_colours=None, x_axis_type_zero=None, symbols=None, 
symbol_sizes=None, linetype=None, linestyle=None, axis_labels=None):
     """Loop function over the spectrometer frequencies and offsets for 
2D Grace plotting function.

     @keyword exp_type:                  The experiment type.
@@ -2048,14 +2048,10 @@
     @type si:                           int
     @keyword back_calc:                 The back calculated data.  The 
first index corresponds to the experiment type, the second is the spin of 
the cluster, the third is the magnetic field strength, and the fourth is 
the dispersion point.
     @type back_calc:                    list of lists of lists of lists 
of float
-    @keyword cpmg_frqs_new:             The interpolated CPMG 
frequencies in Hertz.  The dimensions are {Ei, Mi, Oi}.
-    @type cpmg_frqs_new:                rank-3 list of floats
+    @keyword spin_lock_nu1_new:         The interpolated spin-lock field 
strengths in Hertz.  The dimensions are {Ei, Mi, Oi}.
+    @type spin_lock_nu1_new:            rank-3 list of floats
     @keyword chemical_shifts:           The chemical shifts in rad/s 
{Ei, Si, Mi}
     @type chemical_shifts:              rank-3 list of floats
-    @keyword spin_lock_fields_inter:    The interpolated spin-lock field 
strengths in Hertz {Ei, Mi, Oi}
-    @type spin_lock_fields_inter:       rank-3 list of floats
-    @keyword offsets_inter:             The interpolated spin-lock 
offsets in rad/s {Ei, Si, Mi, Oi}
-    @type offsets_inter:                rank-4 list of floats
     @keyword tilt_angles_inter:         The interpolated rotating frame 
tilt angles {Ei, Si, Mi, Oi, Di}
     @type tilt_angles_inter:            rank-5 list of floats
     @keyword Delta_omega_inter:         The interpolated average 
resonance offset in the rotating frame in rad/s {Ei, Si, Mi, Oi, Di}
@@ -2237,66 +2233,61 @@
     # Add the interpolated back calculated data.
     if interpolated_flag:
         colour_index = 0
-        for frq, mi in loop_frq(return_indices=True):
-            # Loop over interpolated offset.
-            for oi, offset_rad in enumerate(offsets_inter[ei][si][mi]):
-                # Add a new set for the data at each frequency and 
offset.
-                #data[graph_index].append([])
-
-                # Convert offset to ppm from rad/s.
-                offset = frequency_to_ppm_from_rad(frq=offset_rad, 
B0=frq, isotope=current_spin.isotope)
-
-                # Add a new label.
-                if exp_type in EXP_TYPE_LIST_CPMG:
-                    label = "R\\s2eff\\N interpolated curve"
-                else:
-                    label = "R\\s1\\xr\\B\\N interpolated curve"
-                if offset != None and frq != None:
-                    label += " (%.1f MHz, %.3f ppm)" % (frq / 1e6, 
offset)
-                elif frq != None:
-                    label += " (%.1f MHz)" % (frq / 1e6)
-                elif offset != None:
-                    label += " (%.3f ppm)" % (offset)
-                #set_labels[ei].append(label)
-
-                # The other settings.
-                
#set_colours[graph_index].append(colour_order[colour_index])
-                #x_axis_type_zero[graph_index].append(True)
-                #if current_spin.model in MODEL_LIST_NUMERIC_CPMG:
-                #    symbols[graph_index].append(8)
-                #else:
-                #    symbols[graph_index].append(0)
-                #symbol_sizes[graph_index].append(0.20)
-                #linetype[graph_index].append(1)
-                #linestyle[graph_index].append(1)
-
-                # Loop over the dispersion points.
-                for di, point in 
enumerate(spin_lock_fields_inter[ei][mi][oi]):
-                    # Assign r2eff.
-                    r2eff = back_calc[ei][si][mi][oi][di]
-
-                    # Skip invalid points (values of 1e100).
-                    if r2eff > 1e50:
-                        continue
-
-                    # Set x_point.
-                    x_point = w_eff_inter[ei][si][mi][oi][di]
-
-                    theta = tilt_angles_inter[ei][si][mi][oi][di]
-
-                    # R_2 = R1rho / sin^2(theta) - R_1 / tan^2(theta) = 
(R1rho - R_1 * cos^2(theta) ) / sin^2(theta)
-                    y_point = ( r2eff - r1[si][mi]*cos(theta)**2 ) / 
sin(theta)**2
-
-                    # Add the data.
-                    #data[graph_index][set_index].append([x_point, 
y_point])
-
-                    # Handle the errors.
-                    #if err:
-                    #    data[graph_index][set_index][-1].append(None)
-
-                # Increment the graph set index.
-                #set_index += 1
-                #colour_index += 1
+        for frq, offset, mi, oi in loop_frq_offset(exp_type=exp_type, 
return_indices=True):
+            # Add a new set for the data at each frequency and offset.
+            data[graph_index].append([])
+
+            # Add a new label.
+            if exp_type in EXP_TYPE_LIST_CPMG:
+                label = "R\\s2eff\\N interpolated curve"
+            else:
+                label = "R\\s1\\xr\\B\\N interpolated curve"
+            if offset != None and frq != None:
+                label += " (%.1f MHz, %.3f ppm)" % (frq / 1e6, offset)
+            elif frq != None:
+                label += " (%.1f MHz)" % (frq / 1e6)
+            elif offset != None:
+                label += " (%.3f ppm)" % (offset)
+            set_labels[ei].append(label)
+
+            # The other settings.
+            set_colours[graph_index].append(colour_order[colour_index])
+            x_axis_type_zero[graph_index].append(True)
+            if current_spin.model in MODEL_LIST_NUMERIC_CPMG:
+                symbols[graph_index].append(8)
+            else:
+                symbols[graph_index].append(0)
+            symbol_sizes[graph_index].append(0.20)
+            linetype[graph_index].append(1)
+            linestyle[graph_index].append(1)
+
+            # Loop over the dispersion points.
+            for di, point in enumerate(spin_lock_nu1_new[ei][mi][oi]):
+                # Assign r2eff.
+                r2eff = back_calc[ei][si][mi][oi][di]
+
+                # Skip invalid points (values of 1e100).
+                if r2eff > 1e50:
+                    continue
+
+                # Set x_point.
+                x_point = w_eff_inter[ei][si][mi][oi][di]
+
+                theta = tilt_angles_inter[ei][si][mi][oi][di]
+
+                # R_2 = R1rho / sin^2(theta) - R_1 / tan^2(theta) = 
(R1rho - R_1 * cos^2(theta) ) / sin^2(theta)
+                y_point = ( r2eff - r1[si][mi]*cos(theta)**2 ) / 
sin(theta)**2
+
+                # Add the data.
+                data[graph_index][set_index].append([x_point, y_point])
+
+                # Handle the errors.
+                if err:
+                    data[graph_index][set_index][-1].append(None)
+
+            # Increment the graph set index.
+            set_index += 1
+            colour_index += 1

     # Add the residuals for statistical comparison.
     colour_index = 0


_______________________________________________
relax (http://www.nmr-relax.com)

This is the relax-commits mailing list
relax-commits@xxxxxxx

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits

_______________________________________________
relax (http://www.nmr-relax.com)

This is the relax-devel mailing list
relax-devel@xxxxxxx

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-devel



Related Messages


Powered by MHonArc, Updated Mon Jul 28 12:20:27 2014