mailr16055 - 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 07, 2012 - 16:05:
Author: bugman
Date: Mon May  7 16:05:21 2012
New Revision: 16055

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


Added:
    branches/uf_redesign/user_functions/dasha.py
      - copied, changed from r16052, branches/uf_redesign/prompt/dasha.py
Removed:
    branches/uf_redesign/prompt/dasha.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=16055&r1=16054&r2=16055&view=diff
==============================================================================
--- branches/uf_redesign/prompt/__init__.py (original)
+++ branches/uf_redesign/prompt/__init__.py Mon May  7 16:05:21 2012
@@ -23,7 +23,6 @@
 
 __all__ = ['base_class',
            'command',
-           'dasha',
            'deselect',
            'diffusion_tensor',
            'doc_string',

Removed: branches/uf_redesign/prompt/dasha.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/prompt/dasha.py?rev=16054&view=auto
==============================================================================
--- branches/uf_redesign/prompt/dasha.py (original)
+++ branches/uf_redesign/prompt/dasha.py (removed)
@@ -1,150 +1,0 @@
-###############################################################################
-#                                                                            
 #
-# Copyright (C) 2005-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 'dasha' user function class for controlling the 
Dasha model-free software."""
-__docformat__ = 'plaintext'
-
-# relax module imports.
-from base_class import User_fn_class
-import arg_check
-from generic_fns import dasha
-from status import Status; status = Status()
-
-
-class Dasha(User_fn_class):
-    """Class for interfacing with the program Dasha."""
-
-    def create(self, algor='LM', dir=None, force=False):
-        """Function for creating the Dasha script.
-
-        Keyword Arguments
-        ~~~~~~~~~~~~~~~~~
-
-        algor:  The minimisation algorithm.
-
-        dir:  The directory to place the files.
-
-        force:  A flag which if set to True will cause the results file to 
be overwritten if it
-        already exists.
-
-
-        Description
-        ~~~~~~~~~~~
-
-        The script file created is called 'dir/dasha_script'.
-
-
-        Optimisation algorithms
-        ~~~~~~~~~~~~~~~~~~~~~~~
-
-        The two minimisation algorithms within Dasha are accessible through 
the algor argument which
-        can be set to:
-
-            'LM' - The Levenberg-Marquardt algorithm.
-            'NR' - Newton-Raphson algorithm.
-
-        For Levenberg-Marquardt minimisation, the function 'lmin' will be 
called, while for Newton
-        -Raphson, the function 'min' will be executed.
-        """
-
-        # Function intro text.
-        if status.prompt_intro:
-            text = status.ps3 + "dasha.create("
-            text = text + "algor=" + repr(algor)
-            text = text + ", dir=" + repr(dir)
-            text = text + ", force=" + repr(force) + ")"
-            print(text)
-
-        # The argument checks.
-        arg_check.is_str(algor, 'optimisation algorithm')
-        arg_check.is_str(dir, 'directory name', can_be_none=True)
-        arg_check.is_bool(force, 'force flag')
-
-        # Execute the functional code.
-        dasha.create(algor=algor, dir=dir, force=force)
-
-
-    def execute(self, dir=None, force=False, binary='dasha'):
-        """Function for executing Dasha.
-
-        Keyword Arguments
-        ~~~~~~~~~~~~~~~~~
-
-        dir:  The directory to place the files.
-
-        force:  A flag which if set to True will cause the results file to 
be overwritten if it
-        already exists.
-
-        binary:  The name of the executable Dasha program file.
-
-
-        Execution
-        ~~~~~~~~~
-
-        Dasha will be executed as
-
-        $ dasha < dasha_script | tee dasha_results
-
-
-        If you would like to use a different Dasha executable file, change 
the keyword argument
-        'binary' to the appropriate file name.  If the file is not located 
within the environment's
-        path, include the full path in front of the binary file name.
-        """
-
-        # Function intro text.
-        if status.prompt_intro:
-            text = status.ps3 + "dasha.execute("
-            text = text + "dir=" + repr(dir)
-            text = text + ", force=" + repr(force)
-            text = text + ", binary=" + repr(binary) + ")"
-            print(text)
-
-        # The argument checks.
-        arg_check.is_str(dir, 'directory name', can_be_none=True)
-        arg_check.is_bool(force, 'force flag')
-        arg_check.is_str(binary, 'Dasha executable file')
-
-        # Execute the functional code.
-        dasha.execute(dir=dir, force=force, binary=binary)
-
-
-    def extract(self, dir=None):
-        """Function for extracting data from the Dasha results file.
-
-        Keyword Arguments
-        ~~~~~~~~~~~~~~~~~
-
-        dir:  The directory where the file 'dasha_results' is found.
-        """
-
-        # Function intro text.
-        if status.prompt_intro:
-            text = status.ps3 + "dasha.extract("
-            text = text + "dir=" + repr(dir) + ")"
-            print(text)
-
-        # The argument checks.
-        arg_check.is_str(dir, 'directory name', can_be_none=True)
-
-        # Execute the functional code.
-        dasha.extract(dir=dir)

Modified: branches/uf_redesign/prompt/interpreter.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/prompt/interpreter.py?rev=16055&r1=16054&r2=16055&view=diff
==============================================================================
--- branches/uf_redesign/prompt/interpreter.py (original)
+++ branches/uf_redesign/prompt/interpreter.py Mon May  7 16:05:21 2012
@@ -66,7 +66,6 @@
 from temperature import Temp
 
 # User classes.
-from dasha import Dasha
 from diffusion_tensor import Diffusion_tensor
 from frame_order import Frame_order
 from frq import Frq
@@ -215,7 +214,6 @@
         objects['temperature'] = temp.set
 
         # Place the user classes in the local namespace.
-        objects['dasha'] = Dasha()
         objects['deselect'] = Deselect()
         objects['diffusion_tensor'] = Diffusion_tensor()
         objects['frame_order'] = Frame_order()

Modified: branches/uf_redesign/user_functions/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/user_functions/__init__.py?rev=16055&r1=16054&r2=16055&view=diff
==============================================================================
--- branches/uf_redesign/user_functions/__init__.py (original)
+++ branches/uf_redesign/user_functions/__init__.py Mon May  7 16:05:21 2012
@@ -39,6 +39,7 @@
     'bmrb',
     'bruker',
     'consistency_tests',
+    'dasha',
     'pipe',
     'relax_data',
     'state'
@@ -50,6 +51,7 @@
 import user_functions.bmrb
 import user_functions.bruker
 import user_functions.consistency_tests
+import user_functions.dasha
 import user_functions.pipe
 import user_functions.relax_data
 import user_functions.state

Copied: branches/uf_redesign/user_functions/dasha.py (from r16052, 
branches/uf_redesign/prompt/dasha.py)
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/user_functions/dasha.py?p2=branches/uf_redesign/user_functions/dasha.py&p1=branches/uf_redesign/prompt/dasha.py&r1=16052&r2=16055&rev=16055&view=diff
==============================================================================
--- branches/uf_redesign/prompt/dasha.py (original)
+++ branches/uf_redesign/user_functions/dasha.py Mon May  7 16:05:21 2012
@@ -21,130 +21,125 @@
 
###############################################################################
 
 # Module docstring.
-"""Module containing the 'dasha' user function class for controlling the 
Dasha model-free software."""
-__docformat__ = 'plaintext'
+"""Module containing the 'dasha' user function data for controlling the 
Dasha model-free software."""
 
 # relax module imports.
-from base_class import User_fn_class
-import arg_check
 from generic_fns import dasha
-from status import Status; status = Status()
+from graphics import WIZARD_IMAGE_PATH
+from user_functions.data import Uf_info; uf_info = Uf_info()
 
 
-class Dasha(User_fn_class):
-    """Class for interfacing with the program Dasha."""
-
-    def create(self, algor='LM', dir=None, force=False):
-        """Function for creating the Dasha script.
-
-        Keyword Arguments
-        ~~~~~~~~~~~~~~~~~
-
-        algor:  The minimisation algorithm.
-
-        dir:  The directory to place the files.
-
-        force:  A flag which if set to True will cause the results file to 
be overwritten if it
-        already exists.
+# The user function class.
+uf_class = uf_info.add_class('dasha')
+uf_class.title = "Class for interfacing with the program Dasha."
+uf_class.menu_text = "&dasha"
 
 
-        Description
-        ~~~~~~~~~~~
+# The dasha.create user function.
+uf = uf_info.add_uf('dasha.create')
+uf.title = "Create the Dasha script."
+uf.title_short = "Script creation."
+uf.add_keyarg(
+    name = "algor",
+    default = "LM",
+    py_type = "str",
+    desc_short = "optimisation algorithm",
+    desc = "The minimisation algorithm.",
+    wiz_element_type = "combo",
+    wiz_combo_choices = ["Levenberg-Marquardt", "Newton-Raphson"],
+    wiz_combo_data = ["LM", "NR"],
+    wiz_read_only = True
+)
+uf.add_keyarg(
+    name = "dir",
+    py_type = "str",
+    arg_type = "dir sel",
+    desc_short = "directory name",
+    desc = "The directory to place the files.",
+    can_be_none = True
+)
+uf.add_keyarg(
+    name = "force",
+    default = False,
+    py_type = "bool",
+    desc_short = "force flag",
+    desc = "A flag which if set to True will cause the results file to be 
overwritten if it already exists."
+)
+uf.desc = """
+The script file created is called 'dir/dasha_script'.
+"""
+uf.additional = ["Optimisation algorithms", """
+The two minimisation algorithms within Dasha are accessible through the 
algor argument which
+can be set to:
 
-        The script file created is called 'dir/dasha_script'.
+    'LM' - The Levenberg-Marquardt algorithm.
+    'NR' - Newton-Raphson algorithm.
+
+For Levenberg-Marquardt minimisation, the function 'lmin' will be called, 
while for Newton
+-Raphson, the function 'min' will be executed.
+"""]
+uf.backend = dasha.create
+uf.menu_text = "&create"
+uf.wizard_size = (700, 600)
+uf.wizard_apply_button = False
 
 
-        Optimisation algorithms
-        ~~~~~~~~~~~~~~~~~~~~~~~
+# The dasha.execute user function.
+uf = uf_info.add_uf('dasha.execute')
+uf.title = "Perform a model-free optimisation using Dasha."
+uf.title_short = "Dasha execution."
+uf.add_keyarg(
+    name = "dir",
+    py_type = "str",
+    arg_type = "dir sel",
+    desc_short = "directory name",
+    desc = "The directory to place the files.",
+    can_be_none = True
+)
+uf.add_keyarg(
+    name = "force",
+    default = False,
+    py_type = "bool",
+    desc_short = "force flag",
+    desc = "A flag which if set to True will cause the results file to be 
overwritten if it already exists."
+)
+uf.add_keyarg(
+    name = "binary",
+    default = "dasha",
+    py_type = "str",
+    desc_short = "Dasha executable file",
+    desc = "The name of the executable Dasha program file."
+)
+uf.desc = """
+Dasha will be executed as
 
-        The two minimisation algorithms within Dasha are accessible through 
the algor argument which
-        can be set to:
-
-            'LM' - The Levenberg-Marquardt algorithm.
-            'NR' - Newton-Raphson algorithm.
-
-        For Levenberg-Marquardt minimisation, the function 'lmin' will be 
called, while for Newton
-        -Raphson, the function 'min' will be executed.
-        """
-
-        # Function intro text.
-        if status.prompt_intro:
-            text = status.ps3 + "dasha.create("
-            text = text + "algor=" + repr(algor)
-            text = text + ", dir=" + repr(dir)
-            text = text + ", force=" + repr(force) + ")"
-            print(text)
-
-        # The argument checks.
-        arg_check.is_str(algor, 'optimisation algorithm')
-        arg_check.is_str(dir, 'directory name', can_be_none=True)
-        arg_check.is_bool(force, 'force flag')
-
-        # Execute the functional code.
-        dasha.create(algor=algor, dir=dir, force=force)
+$ dasha < dasha_script | tee dasha_results
 
 
-    def execute(self, dir=None, force=False, binary='dasha'):
-        """Function for executing Dasha.
-
-        Keyword Arguments
-        ~~~~~~~~~~~~~~~~~
-
-        dir:  The directory to place the files.
-
-        force:  A flag which if set to True will cause the results file to 
be overwritten if it
-        already exists.
-
-        binary:  The name of the executable Dasha program file.
+If you would like to use a different Dasha executable file, change the 
keyword argument 'binary' to the appropriate file name.  If the file is not 
located within the environment's path, include the full path in front of the 
binary file name.
+"""
+uf.backend = dasha.execute
+uf.gui_icon = "oxygen.categories.applications-education"
+uf.menu_text = "&execute"
+uf.wizard_size = (700, 500)
+uf.wizard_apply_button = False
 
 
-        Execution
-        ~~~~~~~~~
-
-        Dasha will be executed as
-
-        $ dasha < dasha_script | tee dasha_results
-
-
-        If you would like to use a different Dasha executable file, change 
the keyword argument
-        'binary' to the appropriate file name.  If the file is not located 
within the environment's
-        path, include the full path in front of the binary file name.
-        """
-
-        # Function intro text.
-        if status.prompt_intro:
-            text = status.ps3 + "dasha.execute("
-            text = text + "dir=" + repr(dir)
-            text = text + ", force=" + repr(force)
-            text = text + ", binary=" + repr(binary) + ")"
-            print(text)
-
-        # The argument checks.
-        arg_check.is_str(dir, 'directory name', can_be_none=True)
-        arg_check.is_bool(force, 'force flag')
-        arg_check.is_str(binary, 'Dasha executable file')
-
-        # Execute the functional code.
-        dasha.execute(dir=dir, force=force, binary=binary)
-
-
-    def extract(self, dir=None):
-        """Function for extracting data from the Dasha results file.
-
-        Keyword Arguments
-        ~~~~~~~~~~~~~~~~~
-
-        dir:  The directory where the file 'dasha_results' is found.
-        """
-
-        # Function intro text.
-        if status.prompt_intro:
-            text = status.ps3 + "dasha.extract("
-            text = text + "dir=" + repr(dir) + ")"
-            print(text)
-
-        # The argument checks.
-        arg_check.is_str(dir, 'directory name', can_be_none=True)
-
-        # Execute the functional code.
-        dasha.extract(dir=dir)
+# The dasha.extract user function.
+uf = uf_info.add_uf('dasha.extract')
+uf.title = "Extract data from the Dasha results file."
+uf.title_short = "Dasha data extraction."
+uf.add_keyarg(
+    name = "dir",
+    py_type = "str",
+    arg_type = "dir sel",
+    desc_short = "directory name",
+    desc = "The directory where the file 'dasha_results' is found.",
+    can_be_none = True
+)
+uf.desc = """
+The model-free results will be extracted from the Dasha results file 
'dasha_results' located in the given directory.
+"""
+uf.backend = dasha.extract
+uf.menu_text = "ex&tract"
+uf.wizard_apply_button = False




Related Messages


Powered by MHonArc, Updated Mon May 07 16:20:02 2012