mailr4794 - /branches/N_state_model/specific_fns/n_state_model.py


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

Header


Content

Posted by edward on January 16, 2008 - 17:21:
Author: bugman
Date: Wed Jan 16 17:21:13 2008
New Revision: 4794

URL: http://svn.gna.org/viewcvs/relax?rev=4794&view=rev
Log:
Wrote the end of the N-state model specific minimise() method.

This includes the use of the isInf() and isNaN() functions, the call to the 
function for
disassembling the parameter vector, and the storing of the minimisation stats.


Modified:
    branches/N_state_model/specific_fns/n_state_model.py

Modified: branches/N_state_model/specific_fns/n_state_model.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/N_state_model/specific_fns/n_state_model.py?rev=4794&r1=4793&r2=4794&view=diff
==============================================================================
--- branches/N_state_model/specific_fns/n_state_model.py (original)
+++ branches/N_state_model/specific_fns/n_state_model.py Wed Jan 16 17:21:13 
2008
@@ -27,6 +27,7 @@
 
 # relax module imports.
 from data import Data as relax_data_store
+from float import isNaN, isInf
 from maths_fns.n_state_model import N_state_opt
 from minfx.generic import generic_minimise
 from relax_errors import RelaxNoModelError
@@ -296,6 +297,57 @@
             return
         param_vector, func, iter_count, f_count, g_count, h_count, warning = 
results
 
+        # Catch infinite chi-squared values.
+        if isInf(func):
+            raise RelaxInfError, 'chi-squared'
+
+        # Catch chi-squared values of NaN.
+        if isNaN(func):
+            raise RelaxNaNError, 'chi-squared'
+
+        # Disassemble the parameter vector.
+        self.disassemble_param_vector(param_vector=param_vector, 
sim_index=sim_index)
+
+        # Monte Carlo minimisation statistics.
+        if sim_index != None:
+            # Chi-squared statistic.
+            cdp.chi2_sim[sim_index] = func
+
+            # Iterations.
+            cdp.iter_sim[sim_index] = iter_count
+
+            # Function evaluations.
+            cdp.f_count_sim[sim_index] = f_count
+
+            # Gradient evaluations.
+            cdp.g_count_sim[sim_index] = g_count
+
+            # Hessian evaluations.
+            cdp.h_count_sim[sim_index] = h_count
+
+            # Warning.
+            cdp.warning_sim[sim_index] = warning
+
+        # Normal statistics.
+        else:
+            # Chi-squared statistic.
+            cdp.chi2 = func
+
+            # Iterations.
+            cdp.iter = iter_count
+
+            # Function evaluations.
+            cdp.f_count = f_count
+
+            # Gradient evaluations.
+            cdp.g_count = g_count
+
+            # Hessian evaluations.
+            cdp.h_count = h_count
+
+            # Warning.
+            cdp.warning = warning
+
 
     def model_setup(self, N=None):
         """Function for setting up the N-state model.




Related Messages


Powered by MHonArc, Updated Wed Jan 16 17:40:12 2008