mailr27599 - in /trunk/pipe_control: grace.py plotting.py


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

Header


Content

Posted by edward on February 06, 2015 - 15:05:
Author: bugman
Date: Fri Feb  6 15:05:30 2015
New Revision: 27599

URL: http://svn.gna.org/viewcvs/relax?rev=27599&view=rev
Log:
Fixes for the new pipe_control.plotting.write_xy() function.

This includes missing imports which should have moved from 
pipe_control.grace, as well as shifting
the axis_setup() function from the pipe_control.grace module into the 
pipe_control.plotting module.


Modified:
    trunk/pipe_control/grace.py
    trunk/pipe_control/plotting.py

Modified: trunk/pipe_control/grace.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/pipe_control/grace.py?rev=27599&r1=27598&r2=27599&view=diff
==============================================================================
--- trunk/pipe_control/grace.py (original)
+++ trunk/pipe_control/grace.py Fri Feb  6 15:05:30 2015
@@ -29,85 +29,12 @@
 # relax module imports.
 from lib.errors import RelaxError, RelaxNoSequenceError, RelaxNoSimError
 from lib.io import get_file_path, open_write_file, test_binary
-from lib.plotting.api import write_xy_data, write_xy_header
 from lib.warnings import RelaxWarning
 from pipe_control.mol_res_spin import count_molecules, count_residues, 
count_spins, exists_mol_res_spin_data
 from pipe_control import pipes
-from pipe_control.pipes import check_pipe
 from pipe_control.plotting import assemble_data
 from specific_analyses.api import return_api
 from status import Status; status = Status()
-
-
-def axis_setup(data_type=None, norm=True):
-    """Determine the axis information for relax data store specific data.
-
-    @keyword data_type: The axis data category (in the [X, Y] list format).
-    @type data_type:    list of str
-    @keyword norm:      The normalisation flag which if set to True will 
cause all graphs to be normalised to a starting value of 1.
-    @type norm:         bool
-    @return:            The axis information.  This includes the sequence 
type, the list of lower bounds, the list of upper bounds, and the axis labels.
-    @rtype:             list of str or None, list of int or None, list of 
int or None, list of str or None
-    """
-
-    # Axis specific settings.
-    axes = ['x', 'y']
-    seq_type = [None, None]
-    axis_labels = [None, None]
-    for i in range(2):
-        # Determine the sequence data type.
-        if data_type[i] == 'res_num':
-            seq_type[i] = 'res'
-
-        # Analysis specific methods for making labels.
-        analysis_spec = False
-        if pipes.cdp_name():
-            # Flag for making labels.
-            analysis_spec = True
-
-            # The specific analysis API object.
-            api = return_api()
-
-        # Some axis default values for spin data.
-        if data_type[i] == 'res_num':
-            # Residue only data.
-            if seq_type[i] == 'res':
-                # X-axis label.
-                if not axis_labels[i]:
-                    axis_labels[i] = "Residue number"
-
-            # Spin only data.
-            if seq_type[i] == 'spin':
-                # X-axis label.
-                if not axis_labels[i]:
-                    axis_labels[i] = "Spin number"
-
-            # Mixed data.
-            if seq_type[i] == 'mixed':
-                # X-axis label.
-                if not axis_labels[i]:
-                    axis_labels[i] = "Spin identification string"
-
-        # Some axis default values for other data types.
-        else:
-            # Label.
-            if analysis_spec and not axis_labels[i]:
-                # Get the units.
-                units = api.return_units(data_type[i])
-
-                # Set the label.
-                axis_labels[i] = api.return_grace_string(data_type[i])
-
-                # Add units.
-                if units:
-                    axis_labels[i] = axis_labels[i] + "\\N (" + units + ")"
-
-                # Normalised data.
-                if norm and axes[i] == 'y':
-                    axis_labels[i] = axis_labels[i] + " 
\\N\\q(normalised)\\Q"
-
-    # Return the data.
-    return seq_type, axis_labels
 
 
 def determine_seq_type(spin_id=None):

Modified: trunk/pipe_control/plotting.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/pipe_control/plotting.py?rev=27599&r1=27598&r2=27599&view=diff
==============================================================================
--- trunk/pipe_control/plotting.py      (original)
+++ trunk/pipe_control/plotting.py      Fri Feb  6 15:05:30 2015
@@ -28,7 +28,10 @@
 
 # relax module imports.
 from lib.errors import RelaxError
-from pipe_control.mol_res_spin import spin_loop
+from lib.io import get_file_path, open_write_file
+from lib.plotting.api import write_xy_data, write_xy_header
+from pipe_control.mol_res_spin import check_mol_res_spin_data, spin_loop
+from pipe_control.pipes import cdp_name, check_pipe
 from pipe_control.result_files import add_result_file
 from specific_analyses.api import return_api
 
@@ -466,6 +469,77 @@
 
     # Return the data.
     return data, set_labels, x_err_flag, y_err_flag
+
+
+def axis_setup(data_type=None, norm=True):
+    """Determine the axis information for relax data store specific data.
+
+    @keyword data_type: The axis data category (in the [X, Y] list format).
+    @type data_type:    list of str
+    @keyword norm:      The normalisation flag which if set to True will 
cause all graphs to be normalised to a starting value of 1.
+    @type norm:         bool
+    @return:            The axis information.  This includes the sequence 
type, the list of lower bounds, the list of upper bounds, and the axis labels.
+    @rtype:             list of str or None, list of int or None, list of 
int or None, list of str or None
+    """
+
+    # Axis specific settings.
+    axes = ['x', 'y']
+    seq_type = [None, None]
+    axis_labels = [None, None]
+    for i in range(2):
+        # Determine the sequence data type.
+        if data_type[i] == 'res_num':
+            seq_type[i] = 'res'
+
+        # Analysis specific methods for making labels.
+        analysis_spec = False
+        if cdp_name():
+            # Flag for making labels.
+            analysis_spec = True
+
+            # The specific analysis API object.
+            api = return_api()
+
+        # Some axis default values for spin data.
+        if data_type[i] == 'res_num':
+            # Residue only data.
+            if seq_type[i] == 'res':
+                # X-axis label.
+                if not axis_labels[i]:
+                    axis_labels[i] = "Residue number"
+
+            # Spin only data.
+            if seq_type[i] == 'spin':
+                # X-axis label.
+                if not axis_labels[i]:
+                    axis_labels[i] = "Spin number"
+
+            # Mixed data.
+            if seq_type[i] == 'mixed':
+                # X-axis label.
+                if not axis_labels[i]:
+                    axis_labels[i] = "Spin identification string"
+
+        # Some axis default values for other data types.
+        else:
+            # Label.
+            if analysis_spec and not axis_labels[i]:
+                # Get the units.
+                units = api.return_units(data_type[i])
+
+                # Set the label.
+                axis_labels[i] = api.return_grace_string(data_type[i])
+
+                # Add units.
+                if units:
+                    axis_labels[i] = axis_labels[i] + "\\N (" + units + ")"
+
+                # Normalised data.
+                if norm and axes[i] == 'y':
+                    axis_labels[i] = axis_labels[i] + " 
\\N\\q(normalised)\\Q"
+
+    # Return the data.
+    return seq_type, axis_labels
 
 
 def classify_graph_2D(x_data_name=None, y_data_name=None, x_type=None, 
y_type=None):
@@ -663,12 +737,9 @@
     @type norm:             bool
     """
 
-    # Test if the current pipe exists.
+    # Checks.
     check_pipe()
-
-    # Test if the sequence data is loaded.
-    if not exists_mol_res_spin_data():
-        raise RelaxNoSequenceError
+    check_mol_res_spin_data()
 
     # Test if the plot_data argument is one of 'value', 'error', or 'sim'.
     if plot_data not in ['value', 'error', 'sim']:




Related Messages


Powered by MHonArc, Updated Fri Feb 06 15:20:03 2015