mailr18517 - in /trunk/specific_fns/model_free: macro_base.py main.py


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

Header


Content

Posted by edward on February 20, 2013 - 10:13:
Author: bugman
Date: Wed Feb 20 10:13:01 2013
New Revision: 18517

URL: http://svn.gna.org/viewcvs/relax?rev=18517&view=rev
Log:
Added some work-arounds for the model-free specific code for when no 
relaxation data is present.

This is needed for the Rex scaling, as the ID of the first relaxation data 
set was being used to
select the first frequency.  As caught by the 
Mf.test_bug_20531_molmol_macro_write_relaxfault system
test, this fails if no relaxation data is present.


Modified:
    trunk/specific_fns/model_free/macro_base.py
    trunk/specific_fns/model_free/main.py

Modified: trunk/specific_fns/model_free/macro_base.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/specific_fns/model_free/macro_base.py?rev=18517&r1=18516&r2=18517&view=diff
==============================================================================
--- trunk/specific_fns/model_free/macro_base.py (original)
+++ trunk/specific_fns/model_free/macro_base.py Wed Feb 20 10:13:01 2013
@@ -442,8 +442,18 @@
     def classic_rex(self, res_num, rex, colour_start, colour_end, 
colour_list):
         """Function for generating the bond width and colours for 
correlation times."""
 
-        # The Rex value at the first field strength.
-        rex = rex * (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2
+        # The 1st spectrometer frequency.
+        if not hasattr(cdp, 'frq'):
+            raise RelaxError("No spectrometer frequency information is 
present in the current data pipe.")
+        if hasattr(cdp, 'ri_ids'):
+            frq = cdp.frq[cdp.ri_ids[0]]
+        else:       # Take the highest frequency, if all else fails.
+            frqs = cdp.frq.values()
+            frqs.sort()
+            frq = frqs[-1]
+
+        # The Rex value.
+        rex = rex * (2.0 * pi * frq)**2
 
         # The bond width (aiming for a width range of 2 to 0 for Rex values 
of 0 to 25 s^-1).
         width = 2.0 - 2.0 / (rex/5.0 + 1.0)

Modified: trunk/specific_fns/model_free/main.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/specific_fns/model_free/main.py?rev=18517&r1=18516&r2=18517&view=diff
==============================================================================
--- trunk/specific_fns/model_free/main.py (original)
+++ trunk/specific_fns/model_free/main.py Wed Feb 20 10:13:01 2013
@@ -521,8 +521,22 @@
         @rtype:     float
         """
 
+        # No frequency info.
+        if not hasattr(cdp, 'frq'):
+            raise RelaxError("No spectrometer frequency information is 
present in the current data pipe.")
+
+        # The 1st spectrometer frequency.
+        if hasattr(cdp, 'ri_ids'):
+            frq = cdp.frq[cdp.ri_ids[0]]
+
+        # Take the highest frequency, if all else fails.
+        else:
+            frqs = cdp.frq.values()
+            frqs.sort()
+            frq = frqs[-1]
+
         # The factor.
-        return 1.0 / (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2
+        return 1.0 / (2.0 * pi * frq)**2
 
 
     def _create_model(self, model=None, equation=None, params=None, 
spin_id=None):




Related Messages


Powered by MHonArc, Updated Wed Feb 20 10:20:02 2013