mailr16197 - in /branches/uf_redesign: prompt/ user_functions/


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

Header


Content

Posted by edward on May 10, 2012 - 17:16:
Author: bugman
Date: Thu May 10 17:16:47 2012
New Revision: 16197

URL: http://svn.gna.org/viewcvs/relax?rev=16197&view=rev
Log:
Converted the relax_fit user functions to the auto-generation design.


Added:
    branches/uf_redesign/user_functions/relax_fit.py
      - copied, changed from r16195, branches/uf_redesign/prompt/relax_fit.py
Removed:
    branches/uf_redesign/prompt/relax_fit.py
Modified:
    branches/uf_redesign/prompt/__init__.py
    branches/uf_redesign/prompt/interpreter.py
    branches/uf_redesign/user_functions/__init__.py

Modified: branches/uf_redesign/prompt/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/prompt/__init__.py?rev=16197&r1=16196&r2=16197&view=diff
==============================================================================
--- branches/uf_redesign/prompt/__init__.py (original)
+++ branches/uf_redesign/prompt/__init__.py Thu May 10 17:16:47 2012
@@ -28,7 +28,6 @@
            'help',
            'interpreter',
            'objects',
-           'relax_fit',
            'reset',
            'residue',
            'results',

Modified: branches/uf_redesign/prompt/interpreter.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/prompt/interpreter.py?rev=16197&r1=16196&r2=16197&view=diff
==============================================================================
--- branches/uf_redesign/prompt/interpreter.py (original)
+++ branches/uf_redesign/prompt/interpreter.py Thu May 10 17:16:47 2012
@@ -63,7 +63,6 @@
 # User classes.
 from residue import Residue
 from structure import Structure
-from relax_fit import Relax_fit
 from results import Results
 from sequence import Sequence
 from spectrum import Spectrum
@@ -187,7 +186,6 @@
         objects['temperature'] = temp.set
 
         # Place the user classes in the local namespace.
-        objects['relax_fit'] = Relax_fit()
         objects['residue'] = Residue()
         objects['results'] = Results()
         objects['sequence'] = Sequence()

Removed: branches/uf_redesign/prompt/relax_fit.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/prompt/relax_fit.py?rev=16196&view=auto
==============================================================================
--- branches/uf_redesign/prompt/relax_fit.py (original)
+++ branches/uf_redesign/prompt/relax_fit.py (removed)
@@ -1,91 +1,0 @@
-###############################################################################
-#                                                                            
 #
-# Copyright (C) 2004-2012 Edward d'Auvergne                                  
 #
-#                                                                            
 #
-# This file is part of the program relax.                                    
 #
-#                                                                            
 #
-# relax is free software; you can redistribute it and/or modify              
 #
-# it under the terms of the GNU General Public License as published by       
 #
-# the Free Software Foundation; either version 2 of the License, or          
 #
-# (at your option) any later version.                                        
 #
-#                                                                            
 #
-# relax is distributed in the hope that it will be useful,                   
 #
-# but WITHOUT ANY WARRANTY; without even the implied warranty of             
 #
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              
 #
-# GNU General Public License for more details.                               
 #
-#                                                                            
 #
-# You should have received a copy of the GNU General Public License          
 #
-# along with relax; if not, write to the Free Software                       
 #
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  
 #
-#                                                                            
 #
-###############################################################################
-
-# Module docstring.
-"""Module containing the 'relax_fit' user function class."""
-__docformat__ = 'plaintext'
-
-# relax module imports.
-from base_class import User_fn_class, _build_doc
-import arg_check
-from specific_fns.setup import relax_fit_obj
-from status import Status; status = Status()
-
-
-class Relax_fit(User_fn_class):
-    """Class for relaxation curve fitting."""
-
-    def relax_time(self, time=0.0, spectrum_id=None):
-        # Function intro text.
-        if status.prompt_intro:
-            text = status.ps3 + "relax_fit.relax_time("
-            text = text + "time=" + repr(time)
-            text = text + ", spectrum_id=" + repr(spectrum_id) + ")"
-            print(text)
-
-        # The argument checks.
-        arg_check.is_num(time, 'relaxation time')
-        arg_check.is_str(spectrum_id, 'spectrum identification string')
-
-        # Execute the functional code.
-        relax_fit_obj._relax_time(time=time, spectrum_id=spectrum_id)
-
-    # The function doc info.
-    relax_time._doc_title = "Set the relaxation delay time associated with 
each spectrum."
-    relax_time._doc_title_short = "Relaxation delay time setting."
-    relax_time._doc_args = [
-        ["time", "The time, in seconds, of the relaxation period."],
-        ["spectrum_id", "The spectrum identification string."]
-    ]
-    relax_time._doc_desc = """
-        Peak intensities should be loaded before calling this user function 
via the spectrum.read_intensities user function.  The intensity values will 
then be associated with a spectrum identifier.  To associate each spectrum 
identifier with a time point in the relaxation curve prior to optimisation, 
this user function should be called.
-        """
-    _build_doc(relax_time)
-
-
-    def select_model(self, model='exp'):
-        # Function intro text.
-        if status.prompt_intro:
-            text = status.ps3 + "relax_fit.select_model("
-            text = text + "model=" + repr(model) + ")"
-            print(text)
-
-        # The argument checks.
-        arg_check.is_str(model, 'model')
-
-        # Execute the functional code.
-        relax_fit_obj._select_model(model=model)
-
-    # The function doc info.
-    select_model._doc_title = "Select the relaxation curve type."
-    select_model._doc_title_short = "Relaxation curve type selection."
-    select_model._doc_args = [
-        ["model", "The type of relaxation curve to fit."]
-    ]
-    select_model._doc_desc = """
-        The supported relaxation experiments include the default two 
parameter exponential fit, selected by setting the 'fit_type' argument to 
'exp', and the three parameter inversion recovery experiment in which the 
peak intensity limit is a non-zero value, selected by setting the argument to 
'inv'.
-
-        The parameters of these two models are
-            'exp': [Rx, I0],
-            'inv': [Rx, I0, Iinf].
-        """
-    _build_doc(select_model)

Modified: branches/uf_redesign/user_functions/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/user_functions/__init__.py?rev=16197&r1=16196&r2=16197&view=diff
==============================================================================
--- branches/uf_redesign/user_functions/__init__.py (original)
+++ branches/uf_redesign/user_functions/__init__.py Thu May 10 17:16:47 2012
@@ -64,6 +64,7 @@
     'pymol_control',
     'rdc',
     'relax_data',
+    'relax_fit',
     'select',
     'state'
 ]
@@ -99,6 +100,7 @@
 import user_functions.pymol_control
 import user_functions.rdc
 import user_functions.relax_data
+import user_functions.relax_fit
 import user_functions.select
 import user_functions.state
 

Copied: branches/uf_redesign/user_functions/relax_fit.py (from r16195, 
branches/uf_redesign/prompt/relax_fit.py)
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/user_functions/relax_fit.py?p2=branches/uf_redesign/user_functions/relax_fit.py&p1=branches/uf_redesign/prompt/relax_fit.py&r1=16195&r2=16197&rev=16197&view=diff
==============================================================================
--- branches/uf_redesign/prompt/relax_fit.py (original)
+++ branches/uf_redesign/user_functions/relax_fit.py Thu May 10 17:16:47 2012
@@ -21,71 +21,82 @@
 
###############################################################################
 
 # Module docstring.
-"""Module containing the 'relax_fit' user function class."""
-__docformat__ = 'plaintext'
+"""Module containing the relax_fit user function data."""
 
 # relax module imports.
-from base_class import User_fn_class, _build_doc
-import arg_check
+from generic_fns import spectrum
+from graphics import WIZARD_IMAGE_PATH
 from specific_fns.setup import relax_fit_obj
-from status import Status; status = Status()
+from user_functions.data import Uf_info; uf_info = Uf_info()
 
 
-class Relax_fit(User_fn_class):
-    """Class for relaxation curve fitting."""
-
-    def relax_time(self, time=0.0, spectrum_id=None):
-        # Function intro text.
-        if status.prompt_intro:
-            text = status.ps3 + "relax_fit.relax_time("
-            text = text + "time=" + repr(time)
-            text = text + ", spectrum_id=" + repr(spectrum_id) + ")"
-            print(text)
-
-        # The argument checks.
-        arg_check.is_num(time, 'relaxation time')
-        arg_check.is_str(spectrum_id, 'spectrum identification string')
-
-        # Execute the functional code.
-        relax_fit_obj._relax_time(time=time, spectrum_id=spectrum_id)
-
-    # The function doc info.
-    relax_time._doc_title = "Set the relaxation delay time associated with 
each spectrum."
-    relax_time._doc_title_short = "Relaxation delay time setting."
-    relax_time._doc_args = [
-        ["time", "The time, in seconds, of the relaxation period."],
-        ["spectrum_id", "The spectrum identification string."]
-    ]
-    relax_time._doc_desc = """
-        Peak intensities should be loaded before calling this user function 
via the spectrum.read_intensities user function.  The intensity values will 
then be associated with a spectrum identifier.  To associate each spectrum 
identifier with a time point in the relaxation curve prior to optimisation, 
this user function should be called.
-        """
-    _build_doc(relax_time)
+# The user function class.
+uf_class = uf_info.add_class('relax_fit')
+uf_class.title = "Class for relaxation curve fitting."
+uf_class.menu_text = "&relax_fit"
 
 
-    def select_model(self, model='exp'):
-        # Function intro text.
-        if status.prompt_intro:
-            text = status.ps3 + "relax_fit.select_model("
-            text = text + "model=" + repr(model) + ")"
-            print(text)
+# The relax_fit.relax_time user function.
+uf = uf_info.add_uf('relax_fit.relax_time')
+uf.title = "Set the relaxation delay time associated with each spectrum."
+uf.title_short = "Relaxation delay time setting."
+uf.add_keyarg(
+    name = "time",
+    default = 0.0,
+    py_type = "num",
+    desc_short = "relaxation time",
+    desc = "The time, in seconds, of the relaxation period."
+)
+uf.add_keyarg(
+    name = "spectrum_id",
+    py_type = "str",
+    desc_short = "spectrum identification string",
+    desc = "The spectrum identification string.",
+    wiz_element_type = 'combo',
+    wiz_combo_iter = spectrum.get_ids,
+    wiz_read_only = True
+)
+uf.desc = """
+Peak intensities should be loaded before calling this user function via the 
spectrum.read_intensities user function.  The intensity values will then be 
associated with a spectrum identifier.  To associate each spectrum identifier 
with a time point in the relaxation curve prior to optimisation, this user 
function should be called.
+"""
+uf.backend = relax_fit_obj._relax_time
+uf.menu_text = "&relax_time"
+uf.gui_icon = "oxygen.actions.edit-rename"
+uf.wizard_size = (700, 500)
 
-        # The argument checks.
-        arg_check.is_str(model, 'model')
 
-        # Execute the functional code.
-        relax_fit_obj._select_model(model=model)
+# The relax_fit.select_model user function.
+uf = uf_info.add_uf('relax_fit.select_model')
+uf.title = "Select the relaxation curve type."
+uf.title_short = "Relaxation curve type selection."
+uf.display = True
+uf.add_keyarg(
+    name = "model",
+    default = "exp",
+    py_type = "str",
+    desc_short = "model",
+    desc = "The type of relaxation curve to fit.",
+    wiz_element_type = "combo",
+    wiz_combo_choices = [
+        "exp: [Rx, I0]",
+        "inv: [Rx, I0, Iinf]"
+    ],
+    wiz_combo_data = [
+        "exp",
+        "inv"
+    ],
+    wiz_read_only = True
+)
+uf.desc = """
+The supported relaxation experiments include the default two parameter 
exponential fit, selected by setting the model type to 'exp', and the three 
parameter inversion recovery experiment in which the peak intensity limit is 
a non-zero value, selected by setting the model to 'inv'.
 
-    # The function doc info.
-    select_model._doc_title = "Select the relaxation curve type."
-    select_model._doc_title_short = "Relaxation curve type selection."
-    select_model._doc_args = [
-        ["model", "The type of relaxation curve to fit."]
-    ]
-    select_model._doc_desc = """
-        The supported relaxation experiments include the default two 
parameter exponential fit, selected by setting the 'fit_type' argument to 
'exp', and the three parameter inversion recovery experiment in which the 
peak intensity limit is a non-zero value, selected by setting the argument to 
'inv'.
-
-        The parameters of these two models are
-            'exp': [Rx, I0],
-            'inv': [Rx, I0, Iinf].
-        """
-    _build_doc(select_model)
+The parameters of these two models are
+    'exp': [Rx, I0],
+    'inv': [Rx, I0, Iinf].
+"""
+uf.backend = relax_fit_obj._select_model
+uf.menu_text = "&select_model"
+uf.gui_icon = "oxygen.actions.list-add"
+uf.wizard_height_desc = 300
+uf.wizard_size = (800, 500)
+uf.wizard_apply_button = False




Related Messages


Powered by MHonArc, Updated Thu May 10 17:40:02 2012