mailr22284 - /trunk/specific_analyses/relax_disp/disp_data.py


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

Header


Content

Posted by tlinnet on February 24, 2014 - 14:20:
Author: tlinnet
Date: Mon Feb 24 14:20:43 2014
New Revision: 22284

URL: http://svn.gna.org/viewcvs/relax?rev=22284&view=rev
Log:
Expanded the loop_time function to optional take the spectrometer frequency 
as input for restricting looping.

Regarding bug #21665, (https://gna.org/bugs/?21665) - Running a CPMG analysis 
with two fields at two delay times.

Modified:
    trunk/specific_analyses/relax_disp/disp_data.py

Modified: trunk/specific_analyses/relax_disp/disp_data.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/relax_disp/disp_data.py?rev=22284&r1=22283&r2=22284&view=diff
==============================================================================
--- trunk/specific_analyses/relax_disp/disp_data.py (original)
+++ trunk/specific_analyses/relax_disp/disp_data.py Mon Feb 24 14:20:43 2014
@@ -873,7 +873,7 @@
                 # Then the dispersion points.
                 for point, di in loop_point(exp_type=exp_type, frq=frq, 
offset=offset, return_indices=True):
                     # Finally the relaxation times.
-                    for time, ti in loop_time(return_indices=True):
+                    for time, ti in loop_time(frq=frq, return_indices=True):
                         # Yield the data.
                         if return_indices:
                             yield exp_type, frq, offset, point, time, ei, 
mi, oi, di, ti
@@ -1281,9 +1281,13 @@
         yield id
 
 
-def loop_time(return_indices=False):
+def loop_time(exp_type=None, frq=None, return_indices=False):
     """Generator method for looping over the relaxation times.
 
+    @keyword exp_type:          The experiment type.
+    @type exp_type:             str
+    @keyword frq:               The spectrometer frequency in Hz.
+    @type frq:                  float
     @keyword return_indices:    A flag which if True will cause the 
relaxation time index to be returned as well.
     @type return_indices:       bool
     @return:                    The relaxation time.
@@ -1296,6 +1300,28 @@
     # Loop over the time points.
     if hasattr(cdp, 'relax_time_list'):
         for time in cdp.relax_time_list:
+            # Find a matching experiment ID.
+            found = False
+            for id in cdp.exp_type.keys():
+                # Skip non-matching experiments.
+                if exp_type != None and cdp.exp_type[id] != exp_type:
+                    continue
+
+                # Skip non-matching spectrometer frequencies.
+                if frq != None and hasattr(cdp, 'spectrometer_frq') and 
cdp.spectrometer_frq[id] != frq:
+                    continue
+
+                if time != cdp.relax_times[id]:
+                    continue
+
+                # Found.
+                found = True
+                break
+
+            # No data.
+            if not found:
+                continue
+
             # Increment the index.
             ti += 1
 




Related Messages


Powered by MHonArc, Updated Mon Feb 24 14:40:02 2014