mailr22724 - in /trunk/specific_analyses: ./ consistency_tests/ frame_order/ jw_mapping/ model_free/ n_state_model/ noe/ relax_d...


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

Header


Content

Posted by edward on April 11, 2014 - 19:55:
Author: bugman
Date: Fri Apr 11 19:55:58 2014
New Revision: 22724

URL: http://svn.gna.org/viewcvs/relax?rev=22724&view=rev
Log:
The label and caption for the parameter list user function documentation is 
now supplied to uf_doc().

This allows different types of tables to be generated, for example the 
default value is useful for
the value.set user function but not value.write, while allowing tables to 
still be shared.


Modified:
    trunk/specific_analyses/consistency_tests/parameter_object.py
    trunk/specific_analyses/frame_order/parameter_object.py
    trunk/specific_analyses/jw_mapping/parameter_object.py
    trunk/specific_analyses/model_free/parameter_object.py
    trunk/specific_analyses/n_state_model/parameter_object.py
    trunk/specific_analyses/noe/parameter_object.py
    trunk/specific_analyses/parameter_object.py
    trunk/specific_analyses/relax_disp/parameter_object.py
    trunk/specific_analyses/relax_fit/parameter_object.py

Modified: trunk/specific_analyses/consistency_tests/parameter_object.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/consistency_tests/parameter_object.py?rev=22724&r1=22723&r2=22724&view=diff
==============================================================================
--- trunk/specific_analyses/consistency_tests/parameter_object.py       
(original)
+++ trunk/specific_analyses/consistency_tests/parameter_object.py       Fri 
Apr 11 19:55:58 2014
@@ -49,3 +49,6 @@
         self._add('j0', scope='spin', desc='Spectral density value at 0 MHz 
(from Farrow et al. (1995) JBNMR, 6: 153-162)', py_type=float, set='params', 
grace_string='\\qJ(0)\\Q', err=True, sim=True)
         self._add('f_eta', scope='spin', desc='Eta-test (from Fushman et al. 
(1998) JACS, 120: 10947-10952)', py_type=float, set='params', 
grace_string='\\qF\\s\\xh\\Q', err=True, sim=True)
         self._add('f_r2', scope='spin', desc='R2-test (from Fushman et al. 
(1998) JACS, 120: 10947-10952)', py_type=float, set='params', 
grace_string='\\qF\\sR2\\Q', err=True, sim=True)
+
+        # Set up the user function documentation.
+        self._set_uf_title("Consistency testing parameters")

Modified: trunk/specific_analyses/frame_order/parameter_object.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/frame_order/parameter_object.py?rev=22724&r1=22723&r2=22724&view=diff
==============================================================================
--- trunk/specific_analyses/frame_order/parameter_object.py     (original)
+++ trunk/specific_analyses/frame_order/parameter_object.py     Fri Apr 11 
19:55:58 2014
@@ -68,4 +68,3 @@
 
         # Set up the user function documentation.
         self._set_uf_title("Frame order parameters")
-        self._set_uf_table(label="table: frame order parameters", 
caption="Frame order parameters.")

Modified: trunk/specific_analyses/jw_mapping/parameter_object.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/jw_mapping/parameter_object.py?rev=22724&r1=22723&r2=22724&view=diff
==============================================================================
--- trunk/specific_analyses/jw_mapping/parameter_object.py      (original)
+++ trunk/specific_analyses/jw_mapping/parameter_object.py      Fri Apr 11 
19:55:58 2014
@@ -49,4 +49,3 @@
 
         # Set up the user function documentation.
         self._set_uf_title("Reduced spectral density mapping parameters")
-        self._set_uf_table(label="table: J(w) parameters", caption="Reduced 
spectral density mapping parameters.")

Modified: trunk/specific_analyses/model_free/parameter_object.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/model_free/parameter_object.py?rev=22724&r1=22723&r2=22724&view=diff
==============================================================================
--- trunk/specific_analyses/model_free/parameter_object.py      (original)
+++ trunk/specific_analyses/model_free/parameter_object.py      Fri Apr 11 
19:55:58 2014
@@ -67,4 +67,3 @@
 
         # Set up the user function documentation.
         self._set_uf_title("Model-free parameters")
-        self._set_uf_table(label="table: mf parameters", caption="Model-free 
parameters.")

Modified: trunk/specific_analyses/n_state_model/parameter_object.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/n_state_model/parameter_object.py?rev=22724&r1=22723&r2=22724&view=diff
==============================================================================
--- trunk/specific_analyses/n_state_model/parameter_object.py   (original)
+++ trunk/specific_analyses/n_state_model/parameter_object.py   Fri Apr 11 
19:55:58 2014
@@ -53,4 +53,3 @@
 
         # Set up the user function documentation.
         self._set_uf_title("N-state model parameters")
-        self._set_uf_table(label="table: N-state parameters", 
caption="N-state model parameters.")

Modified: trunk/specific_analyses/noe/parameter_object.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/noe/parameter_object.py?rev=22724&r1=22723&r2=22724&view=diff
==============================================================================
--- trunk/specific_analyses/noe/parameter_object.py     (original)
+++ trunk/specific_analyses/noe/parameter_object.py     Fri Apr 11 19:55:58 
2014
@@ -46,4 +46,3 @@
 
         # Set up the user function documentation.
         self._set_uf_title("Steady-state NOE parameters")
-        self._set_uf_table(label="table: NOE parameters", 
caption="Steady-state NOE parameters.")

Modified: trunk/specific_analyses/parameter_object.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/parameter_object.py?rev=22724&r1=22723&r2=22724&view=diff
==============================================================================
--- trunk/specific_analyses/parameter_object.py (original)
+++ trunk/specific_analyses/parameter_object.py Fri Apr 11 19:55:58 2014
@@ -70,8 +70,9 @@
 
         # Default user function documentation.
         self._uf_title = "Parameters"
-        self._uf_table_label = "table: parameters"
         self._uf_table_caption = "Parameters"
+        self._uf_docs = {}
+        self._uf_captions = {}
 
 
     def __new__(self, *args, **kargs):
@@ -258,20 +259,6 @@
         self._add('peak_intensity', scope='spin', desc='The peak 
intensities', py_type=dict, grace_string='\\qPeak intensities\\Q')
 
 
-    def _set_uf_table(self, label=None, caption=None):
-        """Set the title for the user function documentation.
-
-        @keyword label:     The unique label of the table.  This is used to 
identify tables, and is also used in the table referencing in the LaTeX 
compilation of the user manual.
-        @type label:        str
-        @keyword caption:   The caption for the table.
-        @type caption:      str
-        """
-
-        # Store the text.
-        self._uf_table_label = label
-        self._uf_table_caption = caption
-
-
     def _set_uf_title(self, title):
         """Set the title for the user function documentation.
 
@@ -593,9 +580,15 @@
         return text.split("'")[1]
 
 
-    def uf_doc(self, default=False, units=False, type=False):
+    def uf_doc(self, label=None, caption=None, scope=None, default=False, 
units=False, type=False):
         """"Create the parameter documentation for the user function 
docstrings.
 
+        @keyword label:     The label of the table.  This is used to 
identify replicated tables, and is also used in the table referencing in the 
LaTeX compilation of the user manual.  If this label is already used, the 
corresponding pre-constructed documentation object will be returned.
+        @type label:        str
+        @keyword caption:   The caption for the table.
+        @type caption:      str
+        @keyword scope:     The parameter scope to restrict the table to.  
If not given, then all parameters of the 'params' and 'fixed' sets will be 
added.
+        @type scope:        str or None
         @keyword default:   A flag which if True will cause the default 
parameter value to be included in the table.
         @type default:      bool
         @keyword units:     A flag which if True will cause the units to be 
included in the table.
@@ -604,11 +597,27 @@
         @type type:         bool
         """
 
+        # Sanity check.
+        if label == None:
+            raise RelaxError("The table identifying label must be supplied.")
+
+        # The documentation is already set up.
+        if label in self._uf_docs:
+            # Check that the captions are consistent.
+            if self._uf_captions[label] != caption:
+                raise RelaxError("The new caption '%s' does not match the 
old '%s'." % (caption, self._uf_captions[label]))
+
+            # Return the existing documentation object.
+            return self._uf_docs[label]
+
         # Initialise the documentation object.
-        doc = Desc_container(self._uf_title)
+        self._uf_docs[label] = Desc_container(self._uf_title)
+
+        # Store the caption for checking purposes.
+        self._uf_captions[label] = caption
 
         # The parameter table.
-        table = uf_tables.add_table(label=self._uf_table_label, 
caption=self._uf_table_caption)
+        table = uf_tables.add_table(label=label, caption=caption)
 
         # Add the headings.
         headings = ["Name", "Description"]
@@ -623,6 +632,10 @@
         # Add each parameter, first of the parameter set, then the 'generic' 
set.
         for set in ['params', 'fixed']:
             for param in self.loop(set=set):
+                # Limit the scope.
+                if scope and self.scope(param) != scope:
+                    continue
+
                 row = []
                 row.append(param)
                 row.append(self.description(param))
@@ -635,10 +648,10 @@
                 table.add_row(row)
 
         # Add the table to the documentation object.
-        doc.add_table(table.label)
+        self._uf_docs[label].add_table(table.label)
 
         # Return the documentation object.
-        return doc
+        return self._uf_docs[label]
 
 
     def units(self, name):

Modified: trunk/specific_analyses/relax_disp/parameter_object.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/relax_disp/parameter_object.py?rev=22724&r1=22723&r2=22724&view=diff
==============================================================================
--- trunk/specific_analyses/relax_disp/parameter_object.py      (original)
+++ trunk/specific_analyses/relax_disp/parameter_object.py      Fri Apr 11 
19:55:58 2014
@@ -89,4 +89,3 @@
 
         # Set up the user function documentation.
         self._set_uf_title("Relaxation dispersion parameters")
-        self._set_uf_table(label="table: dispersion parameters", 
caption="Relaxation dispersion parameters.")

Modified: trunk/specific_analyses/relax_fit/parameter_object.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/relax_fit/parameter_object.py?rev=22724&r1=22723&r2=22724&view=diff
==============================================================================
--- trunk/specific_analyses/relax_fit/parameter_object.py       (original)
+++ trunk/specific_analyses/relax_fit/parameter_object.py       Fri Apr 11 
19:55:58 2014
@@ -57,4 +57,3 @@
 
         # Set up the user function documentation.
         self._set_uf_title("Relaxation curve fitting parameters")
-        self._set_uf_table(label="table: curve-fit parameters", 
caption="Relaxation curve fitting parameters.")




Related Messages


Powered by MHonArc, Updated Fri Apr 11 20:20:01 2014