mailr25709 - in /trunk: auto_analyses/relax_disp_repeat_cpmg.py test_suite/system_tests/relax_disp.py


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

Header


Content

Posted by tlinnet on September 08, 2014 - 22:23:
Author: tlinnet
Date: Mon Sep  8 22:23:07 2014
New Revision: 25709

URL: http://svn.gna.org/viewcvs/relax?rev=25709&view=rev
Log:
Initial try to implement plotting in the repeated auto analysis protocol.

Task #7826 (https://gna.org/task/index.php?7826): Write an python class for 
the repeated analysis of dispersion data.

Modified:
    trunk/auto_analyses/relax_disp_repeat_cpmg.py
    trunk/test_suite/system_tests/relax_disp.py

Modified: trunk/auto_analyses/relax_disp_repeat_cpmg.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/auto_analyses/relax_disp_repeat_cpmg.py?rev=25709&r1=25708&r2=25709&view=diff
==============================================================================
--- trunk/auto_analyses/relax_disp_repeat_cpmg.py       (original)
+++ trunk/auto_analyses/relax_disp_repeat_cpmg.py       Mon Sep  8 22:23:07 
2014
@@ -36,6 +36,7 @@
 from warnings import warn
 
 # relax module imports.
+import dep_check
 from lib.io import extract_data, get_file_path, sort_filenames, write_data
 from lib.text.sectioning import section, subsection, subtitle, title
 from lib.warnings import RelaxWarning
@@ -45,6 +46,9 @@
 from specific_analyses.relax_disp.data import generate_r20_key, 
has_exponential_exp_type, is_r1_optimised, loop_exp_frq_offset, 
loop_exp_frq_offset_point, return_param_key_from_data, spin_loop
 from specific_analyses.relax_disp.variables import MODEL_NOREX, 
MODEL_PARAMS, MODEL_R2EFF, PARAMS_R20
 from status import Status; status = Status()
+
+if dep_check.matplotlib_module:
+    import matplotlib.pyplot as plt
 
 
 # Define sfrq key to dic.
@@ -868,11 +872,11 @@
             res_dic[str(glob_ini)] = {}
 
             # Get the pipe name for R2eff values.
-            pipe_name = self.name_pipe(method=method, model=MODEL_R2EFF, 
analysis=analysis, glob_ini=glob_ini)
+            pipe_name = self.name_pipe(method=method, model=MODEL_R2EFF, 
analysis='int', glob_ini=glob_ini)
 
             # Check if pipe exists, or else calculate.
             if not pipes.has_pipe(pipe_name):
-                self.calc_r2eff(list_glob_ini=[glob_ini])
+                self.calc_r2eff(methods=[method], list_glob_ini=[glob_ini])
 
             if pipes.get_pipe() != pipe_name:
                 self.interpreter.pipe.switch(pipe_name)
@@ -929,6 +933,8 @@
             method_cur = r2eff_dic['method']
             res_dic[method_cur] = {}
             res_dic[method_cur]['method'] = method_cur
+            res_dic[method_cur]['glob_ini'] = []
+            res_dic[method_cur]['r2eff_norm_std'] = []
 
             # Now loop over glob_ini:
             for glob_ini in list_glob_ini:
@@ -953,12 +959,22 @@
                 r2eff_diff_norm_arr = (r2eff_arr - r2eff_arr_ref) / 
r2eff_arr_ref
                 r2eff_diff_norm_std = std(r2eff_diff_norm_arr, ddof=1)
 
+                # Store x
+                res_dic[method_cur]['glob_ini'].append(glob_ini)
+
                 # Store to result dic.
-                res_dic[method_cur]['r2eff_arr'] = r2eff_arr
-                res_dic[method_cur]['r2eff_norm_arr'] = r2eff_norm_arr
-                res_dic[method_cur]['r2eff_norm_std'] = r2eff_norm_std
-                res_dic[method_cur]['r2eff_diff_norm_arr'] = 
r2eff_diff_norm_arr
-                res_dic[method_cur]['r2eff_diff_norm_std'] = 
r2eff_diff_norm_std
+                res_dic[method_cur][str(glob_ini)] = {}
+                res_dic[method_cur][str(glob_ini)]['r2eff_arr'] = r2eff_arr
+                res_dic[method_cur][str(glob_ini)]['r2eff_norm_arr'] = 
r2eff_norm_arr
+                res_dic[method_cur][str(glob_ini)]['r2eff_norm_std'] = 
r2eff_norm_std
+                res_dic[method_cur]['r2eff_norm_std'].append(r2eff_norm_std)
+
+                res_dic[method_cur][str(glob_ini)]['r2eff_diff_norm_arr'] = 
r2eff_diff_norm_arr
+                res_dic[method_cur][str(glob_ini)]['r2eff_diff_norm_std'] = 
r2eff_diff_norm_std
+
+
+            res_dic[method_cur]['glob_ini'] = 
asarray(res_dic[method_cur]['glob_ini'])
+            res_dic[method_cur]['r2eff_norm_std'] = 
asarray(res_dic[method_cur]['r2eff_norm_std'])
 
 
         return res_dic
@@ -971,7 +987,16 @@
             if method not in r2eff_stat_dic:
                 continue
 
-            print method
+            if not dep_check.matplotlib_module:
+                continue
+
+            fig = plt.figure()
+            x = r2eff_stat_dic[method]['glob_ini']
+            y = r2eff_stat_dic[method]['r2eff_norm_std']
+            plt.plot(x, y)
+
+            if show:
+                plt.show()
 
 
     def interpreter_start(self):

Modified: trunk/test_suite/system_tests/relax_disp.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/test_suite/system_tests/relax_disp.py?rev=25709&r1=25708&r2=25709&view=diff
==============================================================================
--- trunk/test_suite/system_tests/relax_disp.py (original)
+++ trunk/test_suite/system_tests/relax_disp.py Mon Sep  8 22:23:07 2014
@@ -5959,8 +5959,8 @@
         # Setup base information.
         RDR.set_base_cpmg(glob_ini=128)
 
-        #methods = ['FT', 'MDD']
-        methods = ['FT']
+        methods = ['FT', 'MDD']
+        #methods = ['FT']
 
         # Set the intensity.
         #RDR.set_int(methods=methods, list_glob_ini=[128, 126])
@@ -5972,7 +5972,7 @@
             # Try for bad data.
             #RDR.calc_r2eff(methods=['FT'], list_glob_ini=[6, 4])
 
-            if False:
+            if True:
                 # Collect r2eff values.
                 r2eff_ft = RDR.col_r2eff(method='FT', list_glob_ini=[128, 
126, 6])
 
@@ -5983,10 +5983,10 @@
                 r2eff_stat_dic = 
RDR.get_r2eff_stat_dic(list_r2eff_dics=[r2eff_ft, r2eff_mdd], 
list_glob_ini=[128, 126, 6])
 
                 # Plot R2eff stats
-                RDR.plot_r2eff_stat(r2eff_stat_dic=r2eff_stat_dic, 
methods=['FT'], list_glob_ini=[128, 126, 6], show=True)
+                RDR.plot_r2eff_stat(r2eff_stat_dic=r2eff_stat_dic, 
methods=['FT'], list_glob_ini=[128, 126, 6], show=False)
 
         # Do minimisation
-        if True:
+        if False:
             # Deselect all spins.
             #self.interpreter.spin.display()
             RDR.deselect_all(methods=methods, model='setup', 
model_from=MODEL_R2EFF, analysis='grid setup', analysis_from='int', 
list_glob_ini=[128, 126])




Related Messages


Powered by MHonArc, Updated Tue Sep 09 09:20:02 2014