mailr4798 - /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:51:
Author: bugman
Date: Wed Jan 16 17:51:31 2008
New Revision: 4798

URL: http://svn.gna.org/viewcvs/relax?rev=4798&view=rev
Log:
Wrote the N-state model disassemble_param_vector() method.


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=4798&r1=4797&r2=4798&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:51:31 
2008
@@ -52,6 +52,49 @@
         # Return a numpy arrary.
         return array(param_vector, float64)
 
+
+    def disassemble_param_vector(self, param_vector=None, sim_index=None):
+        """Function for disassembling the parameter vector used in the 
minimisation.
+
+        The parameters are stored in the probability and Euler angle data 
structures.
+
+        @param param_vector:    The parameter vector returned from 
optimisation.
+        @type param_vector:     numpy array
+        @param sim_index:       The index of the simulation to optimise.  
This should be None if
+                                normal optimisation is desired.
+        @type sim_index:        None or int
+        """
+
+        # Alias the current data pipe.
+        cdp = relax_data_store[relax_data_store.current_pipe]
+
+        # Monte Carlo simulation data structures.
+        if sim_index != None:
+            probs = cdp.probs_sim[sim_index]
+            alpha = cdp.alpha_sim[sim_index]
+            beta = cdp.beta_sim[sim_index]
+            gamma = cdp.gamma_sim[sim_index]
+
+        # Normal data structures.
+        else:
+            probs = cdp.probs
+            alpha = cdp.alpha
+            beta = cdp.beta
+            gamma = cdp.gamma
+
+        # The probabilities for states 0 to N-1.
+        for i in xrange(cdp.N-1):
+            probs[i] = param_vector[i]
+
+        # The probability for state N.
+        probs[-1] = 1 - sum(probs[0:-2])
+
+        # The Euler angles.
+        for i in xrange(cdp.N):
+            alpha[i] = param_vector[cdp.N-1 + 3*i]
+            beta[i] = param_vector[cdp.N-1 + 3*i + 1]
+            gamma[i] = param_vector[cdp.N-1 + 3*i + 2]
+        
 
     def grid_search(self, lower, upper, inc, constraints=False, verbosity=0, 
sim_index=None):
         """The grid search function.




Related Messages


Powered by MHonArc, Updated Wed Jan 16 18:20:05 2008