mailr4254 - in /branches/N_state_model: ./ generic_fns/ prompt/ test_suite/unit_tests/_prompt/


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

Header


Content

Posted by edward on January 02, 2008 - 16:13:
Author: bugman
Date: Wed Jan  2 16:13:02 2008
New Revision: 4254

URL: http://svn.gna.org/viewcvs/relax?rev=4254&view=rev
Log:
Merged revisions 4241-4253 via svnmerge from 
svn+ssh://bugman@xxxxxxxxxxx/svn/relax/1.3

........
  r4241 | bugman | 2008-01-02 11:53:55 +0100 (Wed, 02 Jan 2008) | 5 lines
  
  Bug fix in the generic_fns.value.set() function.
  
  The diff_params variable is now called tensor_params.
........
  r4242 | bugman | 2008-01-02 11:56:41 +0100 (Wed, 02 Jan 2008) | 5 lines
  
  Bug fix in the generic_fns.value.set() function.
  
  The self.relax.generic data structure no longer exists.
........
  r4243 | bugman | 2008-01-02 12:22:57 +0100 (Wed, 02 Jan 2008) | 7 lines
  
  Implemented the generic_fns.minimise.reset_min_stats() function using the 
new relax design.
  
  This was copied from the old reset_min_stats() class method but has had a 
few significant changes
  made to it.  Now both the sequence specific and global min stats are reset 
all together by one call
  to the function.
........
  r4244 | bugman | 2008-01-02 12:36:52 +0100 (Wed, 02 Jan 2008) | 5 lines
  
  Bug fix for the value.set() user function.
  
  Empty lists are now caught.
........
  r4245 | bugman | 2008-01-02 14:51:28 +0100 (Wed, 02 Jan 2008) | 5 lines
  
  Updated the val arg unit test of the value.set() user function.
  
  The unit test now properly checks the arg when a list is passed into it.
........
  r4246 | bugman | 2008-01-02 14:59:35 +0100 (Wed, 02 Jan 2008) | 6 lines
  
  Updated the value.set() user function.
  
  More comments were added to the code, and empty lists passed in as the 
param argument are now
  checked for.
........
  r4247 | bugman | 2008-01-02 15:01:17 +0100 (Wed, 02 Jan 2008) | 5 lines
  
  Bug fix for the val arg unit test of the value.set() user function.
  
  An elif loop was incorrect.
........
  r4248 | bugman | 2008-01-02 15:09:46 +0100 (Wed, 02 Jan 2008) | 5 lines
  
  Bug fix for the param arg unit test of the value.set() user function.
  
  Lists are now properly checked.
........
  r4249 | bugman | 2008-01-02 15:14:37 +0100 (Wed, 02 Jan 2008) | 5 lines
  
  Bug fix for the generic_fns.value.set() function.
  
  The diff_values variable is now called tensor_values.
........
  r4250 | bugman | 2008-01-02 15:20:44 +0100 (Wed, 02 Jan 2008) | 3 lines
  
  Fixes to the docstring of the generic_fns.diffusion_tensor.set() function.
........
  r4251 | bugman | 2008-01-02 15:25:43 +0100 (Wed, 02 Jan 2008) | 6 lines
  
  Bug fix for the generic_fns.diffusion_tensor.set() function.
  
  If no diffusion tensor exists, then a RelaxError is thrown when trying to 
set the parameters.  It's
  not possible to create a tensor from scratch as the tensor type is unknown.
........
  r4252 | bugman | 2008-01-02 15:27:23 +0100 (Wed, 02 Jan 2008) | 5 lines
  
  Fixes to the docstring of the generic_fns.diffusion_tensor.set() function.
  
  The fact that the function cannot be used to initialise a tensor is now 
stated.
........
  r4253 | bugman | 2008-01-02 16:11:16 +0100 (Wed, 02 Jan 2008) | 5 lines
  
  Bug fix for the param arg unit test of the value.set() user function.
  
  Lists of params with a single value are allowed!
........

Modified:
    branches/N_state_model/   (props changed)
    branches/N_state_model/generic_fns/diffusion_tensor.py
    branches/N_state_model/generic_fns/minimise.py
    branches/N_state_model/generic_fns/value.py
    branches/N_state_model/prompt/value.py
    branches/N_state_model/test_suite/unit_tests/_prompt/test_value.py

Propchange: branches/N_state_model/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Jan  2 16:13:02 2008
@@ -1,1 +1,1 @@
-/1.3:1-3692,3695,3697-3713,3715-3719,3721-3728,3730-3731,3733-3755,3757-3807,3809-3833,3836-3838,3840-3869,3872-3905,3907-3986,4004,4014-4015,4018-4021,4027-4031,4061-4102,4104-4114,4137-4175,4223
+/1.3:1-3692,3695,3697-3713,3715-3719,3721-3728,3730-3731,3733-3755,3757-3807,3809-3833,3836-3838,3840-3869,3872-3905,3907-3986,4004,4014-4015,4018-4021,4027-4031,4061-4102,4104-4114,4137-4175,4223,4241-4253

Modified: branches/N_state_model/generic_fns/diffusion_tensor.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/N_state_model/generic_fns/diffusion_tensor.py?rev=4254&r1=4253&r2=4254&view=diff
==============================================================================
--- branches/N_state_model/generic_fns/diffusion_tensor.py (original)
+++ branches/N_state_model/generic_fns/diffusion_tensor.py Wed Jan  2 
16:13:02 2008
@@ -871,16 +871,15 @@
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
     If the diffusion tensor has not been setup, use the more powerful 
function
-    'diffusion_tensor.init' to initialise the tensor parameters.
-
-    The diffusion tensor parameters can only be set when the run corresponds 
to model-free
-    analysis.  The units of the parameters are:
+    'diffusion_tensor.init' to initialise the tensor parameters.  This 
function cannot be used to
+    initialise a diffusion tensor.
+
+    The units of the parameters are:
 
         Inverse seconds for tm.
         Seconds for Diso, Da, Dx, Dy, Dz, Dpar, Dper.
         Unitless for Dratio and Dr.
         Radians for all angles (alpha, beta, gamma, theta, phi).
-
 
     When setting a diffusion tensor parameter, the residue number has no 
effect.  As the
     internal parameters of spherical diffusion are {tm}, spheroidal 
diffusion are {tm, Da,
@@ -911,6 +910,10 @@
 
     # Alias the current data pipe.
     cdp = relax_data_store[relax_data_store.current_pipe]
+
+    # Set up the diffusion tensor data if it doesn't exist.
+    if not diff_data_exists():
+        raise RelaxNoTensorError, 'diffusion'
 
     # Initialise.
     geo_params = []

Modified: branches/N_state_model/generic_fns/minimise.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/N_state_model/generic_fns/minimise.py?rev=4254&r1=4253&r2=4254&view=diff
==============================================================================
--- branches/N_state_model/generic_fns/minimise.py (original)
+++ branches/N_state_model/generic_fns/minimise.py Wed Jan  2 16:13:02 2008
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2003-2005, 2007 Edward d'Auvergne                            
 #
+# Copyright (C) 2003-2005, 2007-2008 Edward d'Auvergne                       
 #
 #                                                                            
 #
 # This file is part of the program relax.                                    
 #
 #                                                                            
 #
@@ -25,12 +25,80 @@
 from re import search
 
 # relax module imports.
-from data import Data as elax_data_store
+from data import Data as relax_data_store
+from selection import spin_loop
 #from processes import RelaxPopen3
 from relax_errors import RelaxError, RelaxNoPipeError
 from thread_classes import RelaxParentThread, RelaxThread
 
 
+def reset_min_stats(data_pipe=None, index=None):
+    """Function for resetting the minimisation statistics."""
+
+    # The data pipe.
+    if data_pipe == None:
+        data_pipe = relax_data_store.current_pipe
+
+    # Alias the current data pipe.
+    cdp = relax_data_store[data_pipe]
+
+
+    # Global minimisation statistics.
+    #################################
+
+    # Chi-squared.
+    if hasattr(cdp, 'chi2'):
+        cdp.chi2 = None
+
+    # Iteration count.
+    if hasattr(cdp, 'iter'):
+        cdp.iter = None
+
+    # Function count.
+    if hasattr(cdp, 'f_count'):
+        cdp.f_count = None
+
+    # Gradient count.
+    if hasattr(cdp, 'g_count'):
+        cdp.g_count = None
+
+    # Hessian count.
+    if hasattr(cdp, 'h_count'):
+        cdp.h_count = None
+
+    # Warning.
+    if hasattr(cdp, 'warning'):
+        cdp.warning = None
+
+
+    # Sequence specific minimisation statistics.
+    ############################################
+
+    # Loop over all spins.
+    for spin in spin_loop():
+        # Chi-squared.
+        if hasattr(spin, 'chi2'):
+            spin.chi2 = None
+
+        # Iteration count.
+        if hasattr(spin, 'iter'):
+            spin.iter = None
+
+        # Function count.
+        if hasattr(spin, 'f_count'):
+            spin.f_count = None
+
+        # Gradient count.
+        if hasattr(spin, 'g_count'):
+            spin.g_count = None
+
+        # Hessian count.
+        if hasattr(spin, 'h_count'):
+            spin.h_count = None
+
+        # Warning.
+        if hasattr(spin, 'warning'):
+            spin.warning = None
 
 
 
@@ -143,65 +211,6 @@
         # Standard minimisation.
         else:
             minimise(run=run, min_algor=min_algor, min_options=min_options, 
func_tol=func_tol, grad_tol=grad_tol, max_iterations=max_iterations, 
constraints=constraints, scaling=scaling, print_flag=print_flag)
-
-
-    def reset_min_stats(self, run, index=None):
-        """Function for resetting the minimisation statistics."""
-
-        # Arguments.
-        self.run = run
-
-        # Global minimisation statistics.
-        if index == None:
-            # Chi-squared.
-            if hasattr(relax_data_store, 'chi2') and 
relax_data_store.chi2.has_key(self.run):
-                relax_data_store.chi2[self.run] = None
-
-            # Iteration count.
-            if hasattr(relax_data_store, 'iter') and 
relax_data_store.iter.has_key(self.run):
-                relax_data_store.iter[self.run] = None
-
-            # Function count.
-            if hasattr(relax_data_store, 'f_count') and 
relax_data_store.f_count.has_key(self.run):
-                relax_data_store.f_count[self.run] = None
-
-            # Gradient count.
-            if hasattr(relax_data_store, 'g_count') and 
relax_data_store.g_count.has_key(self.run):
-                relax_data_store.g_count[self.run] = None
-
-            # Hessian count.
-            if hasattr(relax_data_store, 'h_count') and 
relax_data_store.h_count.has_key(self.run):
-                relax_data_store.h_count[self.run] = None
-
-            # Warning.
-            if hasattr(relax_data_store, 'warning') and 
relax_data_store.warning.has_key(self.run):
-                relax_data_store.warning[self.run] = None
-
-        # Sequence specific minimisation statistics.
-        else:
-            # Chi-squared.
-            if hasattr(relax_data_store.res[self.run][index], 'chi2'):
-                relax_data_store.res[self.run][index].chi2 = None
-
-            # Iteration count.
-            if hasattr(relax_data_store.res[self.run][index], 'iter'):
-                relax_data_store.res[self.run][index].iter = None
-
-            # Function count.
-            if hasattr(relax_data_store.res[self.run][index], 'f_count'):
-                relax_data_store.res[self.run][index].f_count = None
-
-            # Gradient count.
-            if hasattr(relax_data_store.res[self.run][index], 'g_count'):
-                relax_data_store.res[self.run][index].g_count = None
-
-            # Hessian count.
-            if hasattr(relax_data_store.res[self.run][index], 'h_count'):
-                relax_data_store.res[self.run][index].h_count = None
-
-            # Warning.
-            if hasattr(relax_data_store.res[self.run][index], 'warning'):
-                relax_data_store.res[self.run][index].warning = None
 
 
     def return_conversion_factor(self, stat_type):

Modified: branches/N_state_model/generic_fns/value.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/N_state_model/generic_fns/value.py?rev=4254&r1=4253&r2=4254&view=diff
==============================================================================
--- branches/N_state_model/generic_fns/value.py (original)
+++ branches/N_state_model/generic_fns/value.py Wed Jan  2 16:13:02 2008
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2003-2007 Edward d'Auvergne                                  
 #
+# Copyright (C) 2003-2008 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax.                                    
 #
 #                                                                            
 #
@@ -28,6 +28,7 @@
 # relax module imports.
 from data import Data as relax_data_store
 from generic_fns import diffusion_tensor
+from generic_fns.minimise import reset_min_stats
 from relax_errors import RelaxError, RelaxFileEmptyError, RelaxNoResError, 
RelaxNoPipeError, RelaxNoSequenceError, RelaxRegExpError, 
RelaxUnknownParamError, RelaxValueError
 from specific_fns import get_specific_fn
 
@@ -211,9 +212,9 @@
     # Diffusion tensor parameters.
     ##############################
 
-    if diff_params:
+    if tensor_params:
         # Set the diffusion parameters.
-        diffusion_tensor.set(value=diff_values, param=diff_params)
+        diffusion_tensor.set(value=tensor_values, param=tensor_params)
 
 
     # Residue specific parameters.
@@ -287,18 +288,8 @@
                 set(run=run, value=spin_values[j], error=None, 
param=spin_params[j], index=i)
 
 
-    # Reset the minimisation statistics.
-    ####################################
-
-    # Reset the global minimisation statistics.
-    relax.generic.minimise.reset_min_stats(run)
-
-    # Reset the sequence specific minimisation statistics.
-    if relax_data_store.res.has_key(run):
-        for i in xrange(len(relax_data_store.res[run])):
-            relax.generic.minimise.reset_min_stats(run, i)
-
-
+    # Reset all minimisation statistics.
+    reset_min_stats()
 
 
 

Modified: branches/N_state_model/prompt/value.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/N_state_model/prompt/value.py?rev=4254&r1=4253&r2=4254&view=diff
==============================================================================
--- branches/N_state_model/prompt/value.py (original)
+++ branches/N_state_model/prompt/value.py Wed Jan  2 16:13:02 2008
@@ -380,6 +380,11 @@
         if val != None and type(val) != float and type(val) != int and 
type(val) != list:
             raise RelaxNoneFloatListError, ('value', val)
         if type(val) == list:
+            # Empty list.
+            if val == []:
+                raise RelaxListFloatError, ('value', val)
+
+            # Check for values.
             for i in xrange(len(val)):
                 if type(val[i]) != float and type(val[i]) != int:
                     raise RelaxListFloatError, ('value', val)
@@ -388,6 +393,11 @@
         if param != None and type(param) != str and type(param) != list:
             raise RelaxNoneStrListError, ('parameter', param)
         if type(param) == list:
+            # Empty list.
+            if param == []:
+                raise RelaxListStrError, ('parameter', param)
+
+            # Check for strings.
             for i in xrange(len(param)):
                 if type(param[i]) != str:
                     raise RelaxListStrError, ('parameter', param)

Modified: branches/N_state_model/test_suite/unit_tests/_prompt/test_value.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/N_state_model/test_suite/unit_tests/_prompt/test_value.py?rev=4254&r1=4253&r2=4254&view=diff
==============================================================================
--- branches/N_state_model/test_suite/unit_tests/_prompt/test_value.py 
(original)
+++ branches/N_state_model/test_suite/unit_tests/_prompt/test_value.py Wed 
Jan  2 16:13:02 2008
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2007 Edward d'Auvergne                                       
 #
+# Copyright (C) 2007-2008 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax.                                    
 #
 #                                                                            
 #
@@ -26,7 +26,7 @@
 # relax module imports.
 from data import Data as relax_data_store
 from prompt.value import Value
-from relax_errors import RelaxListFloatError, RelaxNoneFloatListError, 
RelaxNoneStrError, RelaxNoneStrListError
+from relax_errors import RelaxError, RelaxListFloatError, RelaxListStrError, 
RelaxNoneFloatListError, RelaxNoneStrError, RelaxNoneStrListError
 from test_suite.unit_tests.value_testing_base import Value_base_class
 
 # Unit test imports.
@@ -50,11 +50,17 @@
             if data[0] == 'None' or data[0] == 'int' or data[0] == 'bin' or 
data[0] == 'float':
                 continue
 
-            # Catch the list arguments.
-            if data[0] == 'list':
+            # Catch all number lists.
+            if data[0] == 'int list' or data[0] == 'float list' or data[0] 
== 'number list':
+                self.assertRaises(RelaxError, self.value_fns.set, 
val=data[1], param='CSA')
+                if len(data[1]) != 1:
+                    self.assertRaises(RelaxError, self.value_fns.set, 
val=data[1], param=['CSA'])
+
+            # Catch all other list arguments.
+            elif type(data[1]) == list:
                 self.assertRaises(RelaxListFloatError, self.value_fns.set, 
val=data[1], param=None)
 
-            # The argument test.
+            # All other arguments.
             else:
                 self.assertRaises(RelaxNoneFloatListError, 
self.value_fns.set, val=data[1], param='CSA')
 
@@ -68,11 +74,18 @@
             if data[0] == 'None' or data[0] == 'str':
                 continue
 
-            # Catch the list arguments.
-            if data[0] == 'list':
-                self.assertRaises(RelaxListFloatError, self.value_fns.set, 
param=data[1], val=None)
+            # Catch the string list arguments.
+            if data[0] == 'str list':
+                if len(data[1]) != 1:
+                    self.assertRaises(RelaxError, self.value_fns.set, 
param=data[1], val=[1.0])
+                else:
+                    self.assertRaises(RelaxError, self.value_fns.set, 
param=data[1], val=[1.0, 2.0])
 
-            # The argument test.
+            # Catch all other list arguments.
+            elif type(data[1]) == list:
+                self.assertRaises(RelaxListStrError, self.value_fns.set, 
param=data[1], val=None)
+
+            # All other arguments.
             else:
                 self.assertRaises(RelaxNoneStrListError, self.value_fns.set, 
param=data[1], val=None)
 




Related Messages


Powered by MHonArc, Updated Wed Jan 02 16:40:11 2008