mailr20681 - /branches/relax_disp/target_functions/relax_disp.py


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

Header


Content

Posted by edward on August 23, 2013 - 16:59:
Author: bugman
Date: Fri Aug 23 16:59:16 2013
New Revision: 20681

URL: http://svn.gna.org/viewcvs/relax?rev=20681&view=rev
Log:
Changed how chemical shifts are handled in the dispersion target function 
class.

The chemical shifts in ppm are accepted and they are converted to rad/s 
inside the __init__()
method.  A structure for rotating frame tilt angles is now also accepted.


Modified:
    branches/relax_disp/target_functions/relax_disp.py

Modified: branches/relax_disp/target_functions/relax_disp.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/target_functions/relax_disp.py?rev=20681&r1=20680&r2=20681&view=diff
==============================================================================
--- branches/relax_disp/target_functions/relax_disp.py (original)
+++ branches/relax_disp/target_functions/relax_disp.py Fri Aug 23 16:59:16 
2013
@@ -46,7 +46,7 @@
 
 
 class Dispersion:
-    def __init__(self, model=None, num_params=None, num_spins=None, 
num_frq=None, num_disp_points=None, values=None, errors=None, missing=None, 
frqs=None, cpmg_frqs=None, spin_lock_nu1=None, relax_time=None, 
scaling_matrix=None, chemical_shifts=None):
+    def __init__(self, model=None, num_params=None, num_spins=None, 
num_frq=None, num_disp_points=None, values=None, errors=None, missing=None, 
frqs=None, cpmg_frqs=None, spin_lock_nu1=None, relax_time=None, 
scaling_matrix=None, chemical_shifts=None, tilt_angles=None):
         """Relaxation dispersion target functions for optimisation.
 
         Models
@@ -101,8 +101,10 @@
         @type relax_time:           float
         @keyword scaling_matrix:    The square and diagonal scaling matrix.
         @type scaling_matrix:       numpy rank-2 float array
-        @keyword chemical_shifts:   The chemical shifts for all spins in the 
cluster in rad/s.  The first dimension is that of the spin cluster (each 
element corresponds to a different spin in the block) and the second 
dimension is the spectrometer field strength.  The ppm values are not used to 
save computation time, therefore they must be converted to rad/s by the 
calling code.
-        @type chemical_shifts:      numpy rank-2 float array
+        @keyword chemical_shifts:   The chemical shifts for all spins in the 
cluster in ppm, only used for the off-resonance R1rho models.  The first 
dimension is that of the spin cluster (each element corresponds to a 
different spin in the block).
+        @type chemical_shifts:      numpy rank-1 float array
+        @keyword tilt_angles:       The pre-calculated rotating frame tilt 
angle theta, only for off-resonance models.  The first dimension is that of 
the spin cluster (each element corresponds to a different spin in the block), 
the second dimension is the spectrometer field strength, and the third is the 
different spin-lock offsets, and the fourth is the dispersion points.
+        @type tilt_angles:          numpy rank-4 float array
         """
 
         # Check the args.
@@ -130,12 +132,21 @@
         self.spin_lock_nu1 = spin_lock_nu1
         self.relax_time = relax_time
         self.scaling_matrix = scaling_matrix
-        self.chemical_shifts = chemical_shifts
 
         # Scaling initialisation.
         self.scaling_flag = False
         if self.scaling_matrix != None:
             self.scaling_flag = True
+
+        # Convert the chemical shifts from ppm to rad/s.
+        if chemical_shifts != None:
+            # Initialise the rad/s data structure.
+            self.chemical_shifts = zeros((self.num_spins, self.num_frq), 
float64)
+
+            # Loop over the elements.
+            for spin_index in range(self.num_spins):
+                for frq_index in range(self.num_frq):
+                    self.chemical_shifts[spin_index][frq_index] = 
chemical_shifts[spin_index] * self.frqs[spin_index, frq_index]
 
         # Create the structure for holding the back-calculated R2eff values 
(matching the dimensions of the values structure).
         self.back_calc = zeros((num_spins, num_frq, num_disp_points), 
float64)




Related Messages


Powered by MHonArc, Updated Mon Aug 26 10:00:02 2013