mailr24849 - /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 tlinnet on July 30, 2014 - 18:07:
Author: tlinnet
Date: Wed Jul 30 18:07:44 2014
New Revision: 24849

URL: http://svn.gna.org/viewcvs/relax?rev=24849&view=rev
Log:
Modified back-end of plot_disp_curves() to reflect changes to the front-end 
function.

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=24849&r1=24848&r2=24849&view=diff
==============================================================================
--- branches/r1rho_plotting/specific_analyses/relax_disp/data.py        
(original)
+++ branches/r1rho_plotting/specific_analyses/relax_disp/data.py        Wed 
Jul 30 18:07:44 2014
@@ -53,6 +53,7 @@
 # Python module imports.
 from math import cos, pi, sin, sqrt
 from numpy import array, float64, int32, ones, zeros
+from os import F_OK, access
 from os.path import expanduser
 from random import gauss
 from re import search
@@ -1798,44 +1799,43 @@
     # 1H MMQ flag.
     proton_mmq_flag = has_proton_mmq_cpmg()
 
-    # Plot dispersion curves, extending over number of dispersion points.
-    file_name_ini = "disp"
+    # Determine file name:
+    if y_axis == Y_AXIS_R2_EFF and x_axis == X_AXIS_DISP and interpolate == 
INTERPOLATE_DISP:
+        file_name_ini = "disp"
+
+    # Special file name for R2_R1RHO data.
+    elif has_r1rho_exp_type and y_axis == Y_AXIS_R2_EFF and x_axis != 
X_AXIS_DISP:
+        file_name_ini = "%s_vs_%s_inter_%s"%("r1rho", x_axis, interpolate)
+
+    else:
+        file_name_ini = "%s_vs_%s_inter_%s"%(y_axis, x_axis, interpolate)
+
+    # Plot dispersion curves.
     plot_disp_curves_to_file(file_name_ini=file_name_ini, dir=dir, 
y_axis=y_axis, x_axis=x_axis, interpolate=interpolate, num_points=num_points, 
extend_hz=extend_hz, extend_ppm=extend_ppm, force=force, 
proton_mmq_flag=proton_mmq_flag)
-
-    # For R1rho models, interpolate through spin-lock field strength, and 
plot R1rho R2 as function of effective field in rotating frame w_eff.
-    if cdp.exp_type_list == [EXP_TYPE_R1RHO]:
-        y_axis = Y_AXIS_R2_R1RHO
-        x_axis = X_AXIS_W_EFF
-        file_name_ini = "%s_vs_%s_inter_%s"%(y_axis, x_axis, interpolate)
-        plot_disp_curves_to_file(file_name_ini=file_name_ini, dir=dir, 
y_axis=y_axis, x_axis=x_axis, interpolate=interpolate, num_points=num_points, 
extend_hz=extend_hz, extend_ppm=extend_ppm, force=force, 
proton_mmq_flag=proton_mmq_flag)
-
-        y_axis = Y_AXIS_R2_EFF
-        x_axis = X_AXIS_THETA
-        file_name_ini = "%s_vs_%s_inter_%s"%("r1rho", x_axis, interpolate)
-        plot_disp_curves_to_file(file_name_ini=file_name_ini, dir=dir, 
y_axis=y_axis, x_axis=x_axis, interpolate=interpolate, num_points=num_points, 
extend_hz=extend_hz, extend_ppm=extend_ppm, force=force, 
proton_mmq_flag=proton_mmq_flag)
-
-        y_axis = Y_AXIS_R2_EFF
-        x_axis = X_AXIS_THETA
-        interpolate = INTERPOLATE_OFFSET
-        file_name_ini = "%s_vs_%s_inter_%s"%("r1rho", x_axis, interpolate)
-        plot_disp_curves_to_file(file_name_ini=file_name_ini, dir=dir, 
y_axis=y_axis, x_axis=x_axis, interpolate=interpolate, num_points=num_points, 
extend_hz=extend_hz, extend_ppm=extend_ppm, force=force, 
proton_mmq_flag=proton_mmq_flag)
 
     # Write a python "grace to PNG/EPS/SVG..." conversion script.
     # Open the file for writing.
     file_name = "grace2images.py"
-    file = open_write_file(file_name, dir, force)
-
-    # Write the file.
-    script_grace2images(file=file)
-
-    # Close the batch script, then make it executable (expanding any ~ 
characters).
-    file.close()
-    if dir:
-        dir = expanduser(dir)
-        chmod(dir + sep + file_name, S_IRWXU|S_IRGRP|S_IROTH)
+    file_path = get_file_path(file_name, dir)
+
+    # Prevent to write the file multiple times.
+    if access(file_path, F_OK) and not force:
+        pass
+
     else:
-        file_name = expanduser(file_name)
-        chmod(file_name, S_IRWXU|S_IRGRP|S_IROTH)
+        file = open_write_file(file_name, dir, force)
+
+        # Write the file.
+        script_grace2images(file=file)
+
+        # Close the batch script, then make it executable (expanding any ~ 
characters).
+        file.close()
+        if dir:
+            dir = expanduser(dir)
+            chmod(dir + sep + file_name, S_IRWXU|S_IRGRP|S_IROTH)
+        else:
+            file_name = expanduser(file_name)
+            chmod(file_name, S_IRWXU|S_IRGRP|S_IROTH)
 
 
 def plot_disp_curves_to_file(file_name_ini=None, dir=None, y_axis=None, 
x_axis=None, interpolate=None, num_points=None, extend_hz=None, 
extend_ppm=None, force=None, proton_mmq_flag=None):




Related Messages


Powered by MHonArc, Updated Wed Jul 30 18:40:04 2014