mailr16252 - 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 11, 2012 - 21:11:
Author: bugman
Date: Fri May 11 21:11:32 2012
New Revision: 16252

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


Added:
    branches/uf_redesign/user_functions/temperature.py
      - copied, changed from r16249, 
branches/uf_redesign/prompt/temperature.py
Removed:
    branches/uf_redesign/prompt/temperature.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=16252&r1=16251&r2=16252&view=diff
==============================================================================
--- branches/uf_redesign/prompt/__init__.py (original)
+++ branches/uf_redesign/prompt/__init__.py Fri May 11 21:11:32 2012
@@ -29,7 +29,6 @@
            'interpreter',
            'objects',
            'tab_completion',
-           'temperature',
            'value',
            'view',
            'vmd']

Modified: branches/uf_redesign/prompt/interpreter.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/prompt/interpreter.py?rev=16252&r1=16251&r2=16252&view=diff
==============================================================================
--- branches/uf_redesign/prompt/interpreter.py (original)
+++ branches/uf_redesign/prompt/interpreter.py Fri May 11 21:11:32 2012
@@ -56,7 +56,6 @@
 
 # User functions.
 from gpl import GPL
-from temperature import Temp
 
 # User classes.
 from value import Value
@@ -166,12 +165,6 @@
 
         # Place functions in the local namespace.
         objects['gpl'] = objects['GPL'] = GPL()
-
-        # Initialise the user functions (those not in user function classes)
-        temp = Temp()
-
-        # Place the user functions in the local namespace.
-        objects['temperature'] = temp.set
 
         # Place the user classes in the local namespace.
         objects['value'] = Value()

Removed: branches/uf_redesign/prompt/temperature.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/prompt/temperature.py?rev=16251&view=auto
==============================================================================
--- branches/uf_redesign/prompt/temperature.py (original)
+++ branches/uf_redesign/prompt/temperature.py (removed)
@@ -1,66 +1,0 @@
-###############################################################################
-#                                                                            
 #
-# Copyright (C) 2008-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 'temperature' user function class."""
-__docformat__ = 'plaintext'
-
-# relax module imports.
-import arg_check
-from generic_fns import temperature
-from status import Status; status = Status()
-
-
-class Temp:
-    """Class containing the function for setting the experimental 
temperature."""
-
-    def set(self, id=None, temp=None):
-        """Specify the temperature of an experiment.
-
-        Keyword arguments
-        ~~~~~~~~~~~~~~~~~
-
-        id:  The experiment identification string.
-
-        temp:  The temperature of the experiment.
-
-
-        Description
-        ~~~~~~~~~~~
-
-        This function allows the temperature of an experiment to be set.  In 
certain analyses, for
-        example those which use pseudocontact shift data, knowledge of the 
temperature is essential.
-        """
-
-        # Function intro text.
-        if status.prompt_intro:
-            text = status.ps3 + "temperature("
-            text = text + "id=" + repr(id)
-            text = text + ", temp=" + repr(temp) + ")"
-            print(text)
-
-        # The argument checks.
-        arg_check.is_str(id, 'experiment identification string')
-        arg_check.is_num(temp, 'experiment temparture')
-
-        # Execute the functional code.
-        temperature.set(id=id, temp=temp)

Modified: branches/uf_redesign/user_functions/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/user_functions/__init__.py?rev=16252&r1=16251&r2=16252&view=diff
==============================================================================
--- branches/uf_redesign/user_functions/__init__.py (original)
+++ branches/uf_redesign/user_functions/__init__.py Fri May 11 21:11:32 2012
@@ -74,7 +74,8 @@
     'spin',
     'state',
     'structure',
-    'sys_info'
+    'sys_info',
+    'temperature'
 ]
 
 # Import all the modules to set up the data.
@@ -119,6 +120,7 @@
 import user_functions.state
 import user_functions.structure
 import user_functions.sys_info
+import user_functions.temperature
 
 # Import the data structure.
 from user_functions.data import Uf_info; uf_info = Uf_info()

Copied: branches/uf_redesign/user_functions/temperature.py (from r16249, 
branches/uf_redesign/prompt/temperature.py)
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/user_functions/temperature.py?p2=branches/uf_redesign/user_functions/temperature.py&p1=branches/uf_redesign/prompt/temperature.py&r1=16249&r2=16252&rev=16252&view=diff
==============================================================================
--- branches/uf_redesign/prompt/temperature.py (original)
+++ branches/uf_redesign/user_functions/temperature.py Fri May 11 21:11:32 
2012
@@ -21,46 +21,34 @@
 
###############################################################################
 
 # Module docstring.
-"""Module containing the 'temperature' user function class."""
-__docformat__ = 'plaintext'
+"""Module containing the 'temperature' user function data."""
 
 # relax module imports.
-import arg_check
 from generic_fns import temperature
-from status import Status; status = Status()
+from graphics import WIZARD_IMAGE_PATH
+from user_functions.data import Uf_info; uf_info = Uf_info()
 
 
-class Temp:
-    """Class containing the function for setting the experimental 
temperature."""
-
-    def set(self, id=None, temp=None):
-        """Specify the temperature of an experiment.
-
-        Keyword arguments
-        ~~~~~~~~~~~~~~~~~
-
-        id:  The experiment identification string.
-
-        temp:  The temperature of the experiment.
-
-
-        Description
-        ~~~~~~~~~~~
-
-        This function allows the temperature of an experiment to be set.  In 
certain analyses, for
-        example those which use pseudocontact shift data, knowledge of the 
temperature is essential.
-        """
-
-        # Function intro text.
-        if status.prompt_intro:
-            text = status.ps3 + "temperature("
-            text = text + "id=" + repr(id)
-            text = text + ", temp=" + repr(temp) + ")"
-            print(text)
-
-        # The argument checks.
-        arg_check.is_str(id, 'experiment identification string')
-        arg_check.is_num(temp, 'experiment temparture')
-
-        # Execute the functional code.
-        temperature.set(id=id, temp=temp)
+# The temperature user function.
+uf = uf_info.add_uf('temperature')
+uf.title = "Specify the temperature of an experiment."
+uf.title_short = "Experimental temperature."
+uf.add_keyarg(
+    name = "id",
+    py_type = "str",
+    desc_short = "experiment ID string",
+    desc = "The experiment identification string."
+)
+uf.add_keyarg(
+    name = "temp",
+    py_type = "num",
+    desc_short = "experimental temperature",
+    desc = "The temperature of the experiment in Kalvin."
+)
+uf.desc = """
+This allows the temperature of an experiment to be set.  This value should 
be in Kalvin.  In certain analyses, for example those which use pseudocontact 
shift data, knowledge of the temperature is essential.  For the pseudocontact 
shift, the experiment ID string should match one of the alignment IDs.
+"""
+uf.backend = temperature.set
+uf.menu_text = "&temperature"
+uf.gui_icon = "oxygen.status.weather-clear"
+uf.wizard_size = (700, 500)




Related Messages


Powered by MHonArc, Updated Fri May 11 21:20:02 2012