mailRe: r5280 - /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 Edward d'Auvergne on April 04, 2008 - 09:40:
Seb,

I have a few fixes below.


On Thu, Apr 3, 2008 at 10:37 PM,  <sebastien.morin.1@xxxxxxxxx> wrote:
Author: semor
 Date: Thu Apr  3 22:37:16 2008
 New Revision: 5280

 URL: http://svn.gna.org/viewcvs/relax?rev=5280&view=rev
 Log:
 More modifications for the new design and the removal of a 'tab' character.


 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=5280&r1=5279&r2=5280&view=diff
 
==============================================================================
 --- 1.3/generic_fns/grace.py (original)
 +++ 1.3/generic_fns/grace.py Thu Apr  3 22:37:16 2008
 @@ -100,28 +100,29 @@
         """Function for getting all the xy data."""

         # Alias the current data pipe.
 -       cdp = relax_data_store[relax_data_store.current_pipe]
 +        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]

This will cause a failure.  There is no structure 'cdp.res'.  This
structure, which is now completely different, is now located at
'cdp.mol[i].res'.  This 'spin = ...' code should be removed.



             # 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.
 @@ -133,11 +134,11 @@
             # 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_data = [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
 +                    res_data[2] = spin.num

                 # Parameter value for the x-axis.
                 else:
 @@ -169,7 +170,7 @@
                     res_data[5] = array(res_data[5]) / 
self.y_return_conversion_factor(self.y_data_type)

                 # Append the array to the full data structure.
 -                self.data.append(res_data)
 +                self.spin.append(res_data)


     def view(self, file=None, dir=None, grace_exe='xmgrace'):
 @@ -262,7 +263,7 @@
         # Test for multiple data sets.
         self.multi = 1
         try:
 -            len(self.data[0][2])
 +            len(self.spin[0][2])

The structure 'self.spin' does not exist, 'self.data' should be
referenced instead.  'self.data' is a structure containing all the
information to place into the Grace '*.agr' graph file.


         except TypeError:
             self.multi = 0

 @@ -294,36 +295,36 @@
         self.file.write("@type " + self.graph_type + "\n")

         # Loop over the data.
 -        for i in xrange(len(self.data)):
 +        for i in xrange(len(self.spin)):

Again this should be 'self.data'.


             # Graph type xy.
             if self.graph_type == 'xy':
                 # Write the data.
 -                self.file.write("%-30s%-30s\n" % (self.data[i][2], 
self.data[i][4]))
 +                self.file.write("%-30s%-30s\n" % (self.spin[i][2], 
self.spin[i][4]))

And again.  Actually every change from here on down should be reverted
to 'self.data'.

Cheers,

Edward



             # Graph type xydy.
             elif self.graph_type == 'xydy':
                 # Catch y-axis errors of None.
 -                y_error = self.data[i][5]
 +                y_error = self.spin[i][5]

                 if y_error == None:
                     y_error = 0.0

                 # Write the data.
 -                self.file.write("%-30s%-30s%-30s\n" % (self.data[i][2], 
self.data[i][4], y_error))
 +                self.file.write("%-30s%-30s%-30s\n" % (self.spin[i][2], 
self.spin[i][4], y_error))

             # Graph type xydxdy.
             elif self.graph_type == 'xydxdy':
                 # Catch x-axis errors of None.
 -                x_error = self.data[i][3]
 +                x_error = self.spin[i][3]
                 if x_error == None:
                     x_error = 0.0

                 # Catch y-axis errors of None.
 -                y_error = self.data[i][5]
 +                y_error = self.spin[i][5]
                 if y_error == None:
                     y_error = 0.0

                 # Write the data.
 -                self.file.write("%-30s%-30s%-30s%-30s\n" % 
(self.data[i][2], self.data[i][4], x_error, y_error))
 +                self.file.write("%-30s%-30s%-30s%-30s\n" % 
(self.spin[i][2], self.spin[i][4], x_error, y_error))

         # End of graph and data set.
         self.file.write("&\n")
 @@ -396,7 +397,7 @@
         """Write the data into the grace file."""

         # Loop over the data.
 -        for i in xrange(len(self.data)):
 +        for i in xrange(len(self.spin)):
             # Multi data set (graph 0, set i).
             self.file.write("@target G0.S" + `i` + "\n")
             self.file.write("@type " + self.graph_type + "\n")
 @@ -404,39 +405,39 @@
             # Normalisation.
             norm_fact = 1.0
             if self.norm:
 -                norm_fact = self.data[i][4][0]
 +                norm_fact = self.spin[i][4][0]

             # Loop over the data of the set.
 -            for j in xrange(len(self.data[i][2])):
 +            for j in xrange(len(self.spin[i][2])):
                 # Graph type xy.
                 if self.graph_type == 'xy':
                     # Write the data.
 -                    self.file.write("%-30s%-30s\n" % (self.data[i][2][j], 
self.data[i][4][j]/norm_fact))
 +                    self.file.write("%-30s%-30s\n" % (self.spin[i][2][j], 
self.spin[i][4][j]/norm_fact))

                 # Graph type xydy.
                 elif self.graph_type == 'xydy':
                     # Catch y-axis errors of None.
 -                    y_error = self.data[i][5][j]
 +                    y_error = self.spin[i][5][j]
                     if y_error == None:
                         y_error = 0.0

                     # Write the data.
 -                    self.file.write("%-30s%-30s%-30s\n" % 
(self.data[i][2][j], self.data[i][4][j]/norm_fact, y_error/norm_fact))
 +                    self.file.write("%-30s%-30s%-30s\n" % 
(self.spin[i][2][j], self.spin[i][4][j]/norm_fact, y_error/norm_fact))

                 # Graph type xydxdy.
                 elif self.graph_type == 'xydxdy':
                     # Catch x-axis errors of None.
 -                    x_error = self.data[i][3][j]
 +                    x_error = self.spin[i][3][j]
                     if x_error == None:
                         x_error = 0.0

                     # Catch y-axis errors of None.
 -                    y_error = self.data[i][5][j]
 +                    y_error = self.spin[i][5][j]
                     if y_error == None:
                         y_error = 0.0

                     # Write the data.
 -                    self.file.write("%-30s%-30s%-30s%-30s\n" % 
(self.data[i][2][j], self.data[i][4][j]/norm_fact, x_error, 
y_error/norm_fact))
 +                    self.file.write("%-30s%-30s%-30s%-30s\n" % 
(self.spin[i][2][j], self.spin[i][4][j]/norm_fact, x_error, 
y_error/norm_fact))

             # End of the data set i.
             self.file.write("&\n")
 @@ -498,11 +499,11 @@
         self.file.write("@    frame linewidth 0.5\n")

         # Loop over the data sets.
 -        for i in xrange(len(self.data)):
 +        for i in xrange(len(self.spin)):
             # Error bars.
             self.file.write("@    s%i errorbar size 0.5\n" % i)
             self.file.write("@    s%i errorbar linewidth 0.5\n" % i)
             self.file.write("@    s%i errorbar riser linewidth 0.5\n" % i)

             # Legend.
 -            self.file.write("@    s%i legend \"Residue %s\"\n" % (i, 
self.data[i][1] + " " + `self.data[i][0]`))
 +            self.file.write("@    s%i legend \"Residue %s\"\n" % (i, 
self.spin[i][1] + " " + `self.spin[i][0]`))


 _______________________________________________
 relax (http://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




Related Messages


Powered by MHonArc, Updated Fri Apr 04 14:41:19 2008