mailr5268 - /1.3/generic_fns/grace.py


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

Header


Content

Posted by sebastien . morin . 1 on April 03, 2008 - 19:23:
Author: semor
Date: Thu Apr  3 19:04:26 2008
New Revision: 5268

URL: http://svn.gna.org/viewcvs/relax?rev=5268&view=rev
Log:
Changed "for i in xrange(len(cdp.res)):" to the spin_loop.

This was proposed by Edward d'Auvergne in a post at :
https://mail.gna.org/public/relax-devel/2008-04/msg00012.html (Message-id:
<7f080ed10804030926p4be2e72apa2ccef85a9062e57@xxxxxxxxxxxxxx>)


Modified:
    1.3/generic_fns/grace.py

Modified: 1.3/generic_fns/grace.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/grace.py?rev=5268&r1=5267&r2=5268&view=diff
==============================================================================
--- 1.3/generic_fns/grace.py (original)
+++ 1.3/generic_fns/grace.py Thu Apr  3 19:04:26 2008
@@ -102,29 +102,29 @@
        cdp = relax_data_store[relax_data_store.current_pipe]
 
         # Loop over the residues.
-        for i in xrange(len(cdp.res)):
+        for spin in spin_loop(spin_id):
             # Remap the data structure 'cdp.res[i]'.
-            data = cdp.res[i]
+            spin = cdp.res[i]
 
             # Skip the residue if there is no match to 'self.res_num' 
(unless it is None).
             if type(self.res_num) == int:
-                if not data.num == self.res_num:
+                if not spin.num == self.res_num:
                     continue
             elif type(self.res_num) == str:
-                if not match(self.res_num, `data.num`):
+                if not match(self.res_num, `spin.num`):
                     continue
 
             # Skip the residue if there is no match to 'self.res_name' 
(unless it is None).
             if self.res_name != None:
-                if not match(self.res_name, data.name):
+                if not match(self.res_name, spin.name):
                     continue
 
             # Skip deselected residues.
-            if not data.select:
+            if not spin.select:
                 continue
 
             # Number of data points per residue.
-            if self.plot_data == 'sim':
+            if self.plot_spin == 'sim':
                 points = cdp.sim_number
             else:
                 points = 1
@@ -132,43 +132,43 @@
             # Loop over the data points.
             for j in xrange(points):
                 # Initialise an empty array for the individual residue data.
-                res_data = [data.num, data.name, None, None, None, None]
+                res_spin = [spin.num, spin.name, None, None, None, None]
 
                 # Residue number on the x-axis.
-                if self.x_data_type == 'res':
-                    res_data[2] = data.num
+                if self.x_spin_type == 'res':
+                    res_spin[2] = spin.num
 
                 # Parameter value for the x-axis.
                 else:
                     # Get the x-axis values and errors.
-                    if self.plot_data == 'sim':
-                        res_data[2], res_data[3] = 
self.x_return_value(self.run, i, self.x_data_type, sim=j)
+                    if self.plot_spin == 'sim':
+                        res_spin[2], res_spin[3] = 
self.x_return_value(self.run, i, self.x_spin_type, sim=j)
                     else:
-                        res_data[2], res_data[3] = 
self.x_return_value(self.run, i, self.x_data_type)
+                        res_spin[2], res_spin[3] = 
self.x_return_value(self.run, i, self.x_spin_type)
 
                 # Get the y-axis values and errors.
-                if self.plot_data == 'sim':
-                    res_data[4], res_data[5] = self.y_return_value(self.run, 
i, self.y_data_type, sim=j)
+                if self.plot_spin == 'sim':
+                    res_spin[4], res_spin[5] = self.y_return_value(self.run, 
i, self.y_spin_type, sim=j)
                 else:
-                    res_data[4], res_data[5] = self.y_return_value(self.run, 
i, self.y_data_type)
+                    res_spin[4], res_spin[5] = self.y_return_value(self.run, 
i, self.y_spin_type)
 
                 # Go to the next residue if there is missing data.
-                if res_data[2] == None or res_data[4] == None:
+                if res_spin[2] == None or res_spin[4] == None:
                     continue
 
                 # X-axis conversion factors.
-                if self.x_data_type != 'res':
-                    res_data[2] = array(res_data[2]) / 
self.x_return_conversion_factor(self.x_data_type)
-                    if res_data[3]:
-                        res_data[3] = array(res_data[3]) / 
self.x_return_conversion_factor(self.x_data_type)
+                if self.x_spin_type != 'res':
+                    res_spin[2] = array(res_spin[2]) / 
self.x_return_conversion_factor(self.x_spin_type)
+                    if res_spin[3]:
+                        res_spin[3] = array(res_spin[3]) / 
self.x_return_conversion_factor(self.x_spin_type)
 
                 # Y-axis conversion factors.
-                res_data[4] = array(res_data[4]) / 
self.y_return_conversion_factor(self.y_data_type)
-                if res_data[5]:
-                    res_data[5] = array(res_data[5]) / 
self.y_return_conversion_factor(self.y_data_type)
+                res_spin[4] = array(res_spin[4]) / 
self.y_return_conversion_factor(self.y_spin_type)
+                if res_spin[5]:
+                    res_spin[5] = array(res_spin[5]) / 
self.y_return_conversion_factor(self.y_spin_type)
 
                 # Append the array to the full data structure.
-                self.data.append(res_data)
+                self.spin.append(res_spin)
 
 
     def view(self, file=None, dir=None, grace_exe='xmgrace'):




Related Messages


Powered by MHonArc, Updated Thu Apr 03 20:00:28 2008