mailr4776 - in /branches/N_state_model: maths_fns/n_state_model.py test_suite/system_tests/scripts/5_state_xz.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 - 11:18:
Author: bugman
Date: Wed Jan 16 11:18:14 2008
New Revision: 4776

URL: http://svn.gna.org/viewcvs/relax?rev=4776&view=rev
Log:
The reduced back calculated tensors are now calculated.

The dimensions of the structures red_bc and red_bc_vector have been fixed.


Modified:
    branches/N_state_model/maths_fns/n_state_model.py
    branches/N_state_model/test_suite/system_tests/scripts/5_state_xz.py

Modified: branches/N_state_model/maths_fns/n_state_model.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/N_state_model/maths_fns/n_state_model.py?rev=4776&r1=4775&r2=4776&view=diff
==============================================================================
--- branches/N_state_model/maths_fns/n_state_model.py (original)
+++ branches/N_state_model/maths_fns/n_state_model.py Wed Jan 16 11:18:14 2008
@@ -58,6 +58,7 @@
         self.params = 1.0 * init_params    # Force a copy of the data to be 
stored.
         self.total_num_params = len(init_params)
         self.full_tensors = array(full_tensors, float64)
+        self.num_tensors = len(self.full_tensors)
         self.red_data = red_data
         self.red_errors = red_errors
 
@@ -66,10 +67,10 @@
         # RT:  the transposes of the rotation matricies.
         # red_bc:  the back-calculated reduced alignment tensors.
         # red_bc_vector:  the back-calculated reduced alignment tensors in 
vector form {Sxx, Syy, Sxy, Sxz, Syz}.
-        self.R = zeros((N,3,3), float64)
-        self.RT = zeros((N,3,3), float64)
-        self.red_bc = zeros((N,3,3), float64)
-        self.red_bc_vector = zeros(N*5, float64)
+        self.R = zeros((self.N,3,3), float64)
+        self.RT = zeros((self.N,3,3), float64)
+        self.red_bc = zeros((self.num_tensors,3,3), float64)
+        self.red_bc_vector = zeros(self.num_tensors*5, float64)
 
 
     def func(self, params):
@@ -88,12 +89,26 @@
         """
 
         # Update the rotation matricies.
-        for i in xrange(self.N):
+        for c in xrange(self.N):
             # The matrix itself.
-            rotation_matrix_zyz(self.R[i], params[self.N-1+3*i], 
params[self.N-1+3*i+1], params[self.N-1+3*i+2])
+            rotation_matrix_zyz(self.R[c], params[self.N-1+3*c], 
params[self.N-1+3*c+1], params[self.N-1+3*c+2])
 
             # Its rotation.
-            self.RT[i] = transpose(self.R[i])
+            self.RT[c] = transpose(self.R[c])
+
+            # The probability of state c.
+            if c < self.N:
+                pc = params[c]
+
+            # The probability of state N (1 minus the pc of all other 
states).
+            else:
+                pc = 1.0
+                for c2 in xrange(self.N-1):
+                    pc = pc - params[c2]
+
+            # Back-calculate the reduced tensors for sum element c and add 
these to red_bc.
+            for i in xrange(self.num_tensors):
+                self.red_bc[i] = self.red_bc[i]  +  pc * self.RT[c] * 
self.full_tensors[i] * self.R[c]
 
         # Return the chi-squared value.
         return chi2(self.red_data, self.red_bc_vector, self.red_errors)

Modified: branches/N_state_model/test_suite/system_tests/scripts/5_state_xz.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/N_state_model/test_suite/system_tests/scripts/5_state_xz.py?rev=4776&r1=4775&r2=4776&view=diff
==============================================================================
--- branches/N_state_model/test_suite/system_tests/scripts/5_state_xz.py 
(original)
+++ branches/N_state_model/test_suite/system_tests/scripts/5_state_xz.py Wed 
Jan 16 11:18:14 2008
@@ -76,7 +76,7 @@
 align_tensor.matrix_angles(basis_set=1, tensors=['chi1 N-dom', 'chi2 N-dom', 
'chi3 N-dom', 'chi4 N-dom', 'chi5 N-dom'])
 
 # Set up the 5-state model.
-n_state_model.model(N=5)
+n_state_model.model(N=3)
 
 # Grid search.
 grid_search(inc=2)




Related Messages


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