Re: r27834 - /trunk/auto_analyses/relax_disp_repeat_cpmg.py

2015-06-08 Thread Edward d'Auvergne
On 27 May 2015 at 03:09,  tlin...@nmr-relax.com wrote:
 Author: tlinnet
 Date: Wed May 27 03:09:35 2015
 New Revision: 27834

 URL: http://svn.gna.org/viewcvs/relax?rev=27834view=rev
 Log:
 Wrote a method to store parameter data and dispersion curves, for the 
 protocol of repeated analysis.

 This is to prepare for analysis in other programs.
 The method loops throug the data pipes, and write the data out.

 It then write a bash script, that will concatenate the data in an matrix 
 array style, for reading and processing in other programs.

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

 Modified:
 trunk/auto_analyses/relax_disp_repeat_cpmg.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=27834r1=27833r2=27834view=diff
 ==
 --- trunk/auto_analyses/relax_disp_repeat_cpmg.py   (original)
 +++ trunk/auto_analyses/relax_disp_repeat_cpmg.py   Wed May 27 03:09:35 
 2015
 @@ -32,10 +32,11 @@
  from copy import deepcopy
  from datetime import datetime
  from glob import glob
 -from os import F_OK, access, getcwd, sep
 +from os import F_OK, access, chmod, getcwd, sep
  from numpy import any, asarray, arange, concatenate, max, mean, min, sqrt, 
 std, sum
  if dep_check.scipy_module:
  from scipy.stats import pearsonr
 +from stat import S_IRWXU, S_IRGRP, S_IROTH
  import sys
  from warnings import warn

 @@ -48,7 +49,7 @@
  from pipe_control.mol_res_spin import display_spin, generate_spin_string, 
 return_spin, spin_loop
  from pipe_control import pipes
  from prompt.interpreter import Interpreter
 -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
 +from specific_analyses.relax_disp.data import generate_r20_key, 
 has_exponential_exp_type, has_cpmg_exp_type, is_r1_optimised, 
 loop_exp_frq_offset, loop_exp_frq_offset_point, return_param_key_from_data
  from status import Status; status = Status()

  if dep_check.matplotlib_module:
 @@ -2665,6 +2666,149 @@
  plt.show()


 +def write_results(self, method=None, model=None, analysis=None, 
 list_glob_ini=None, selection=None):
 +
 +for glob_ini in list_glob_ini:

Hi Troels,

I'm now back from holidays and have time to look at your changes and
proposals.  For future maintenance, I would highly recommend adding a
short docstring describing the intent of each of these methods.  That
will allow others to check that any new additions by future authors
actually fit into your method, or if they belong elsewhere.  It will
allow the code to be kept clean and well organised.  The text from the
commit message would be good for this.  The write_convert_file()
method as well would benefit with the text Write a bash script, that
will concatenate the data in an matrix array style, for reading and
processing in other programs..

Cheers,

Edward

___
relax (http://www.nmr-relax.com)

This is the relax-devel mailing list
relax-devel@gna.org

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-devel


Re: r27834 - /trunk/auto_analyses/relax_disp_repeat_cpmg.py

2015-06-08 Thread Edward d'Auvergne
Hi Troels,

Another point for the new write_convert_file() method, would this be
doable as a Python rather than Bash script?  This addition makes the
analysis GNU/Linux or Mac OS X specific, and MS Windows users miss
out.  Or am I missing something?

Cheers,

Edward


On 27 May 2015 at 03:09,  tlin...@nmr-relax.com wrote:
 Author: tlinnet
 Date: Wed May 27 03:09:35 2015
 New Revision: 27834

 URL: http://svn.gna.org/viewcvs/relax?rev=27834view=rev
 Log:
 Wrote a method to store parameter data and dispersion curves, for the 
 protocol of repeated analysis.

 This is to prepare for analysis in other programs.
 The method loops throug the data pipes, and write the data out.

 It then write a bash script, that will concatenate the data in an matrix 
 array style, for reading and processing in other programs.

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

 Modified:
 trunk/auto_analyses/relax_disp_repeat_cpmg.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=27834r1=27833r2=27834view=diff
 ==
 --- trunk/auto_analyses/relax_disp_repeat_cpmg.py   (original)
 +++ trunk/auto_analyses/relax_disp_repeat_cpmg.py   Wed May 27 03:09:35 
 2015
 @@ -32,10 +32,11 @@
  from copy import deepcopy
  from datetime import datetime
  from glob import glob
 -from os import F_OK, access, getcwd, sep
 +from os import F_OK, access, chmod, getcwd, sep
  from numpy import any, asarray, arange, concatenate, max, mean, min, sqrt, 
 std, sum
  if dep_check.scipy_module:
  from scipy.stats import pearsonr
 +from stat import S_IRWXU, S_IRGRP, S_IROTH
  import sys
  from warnings import warn

 @@ -48,7 +49,7 @@
  from pipe_control.mol_res_spin import display_spin, generate_spin_string, 
 return_spin, spin_loop
  from pipe_control import pipes
  from prompt.interpreter import Interpreter
 -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
 +from specific_analyses.relax_disp.data import generate_r20_key, 
 has_exponential_exp_type, has_cpmg_exp_type, is_r1_optimised, 
 loop_exp_frq_offset, loop_exp_frq_offset_point, return_param_key_from_data
  from status import Status; status = Status()

  if dep_check.matplotlib_module:
 @@ -2665,6 +2666,149 @@
  plt.show()


 +def write_results(self, method=None, model=None, analysis=None, 
 list_glob_ini=None, selection=None):
 +
 +for glob_ini in list_glob_ini:
 +# Check previous, and get the pipe name.
 +found, pipe_name, resfile, path = 
 self.check_previous_result(method=method, model=model, analysis=analysis, 
 glob_ini=glob_ini, bundle=method)
 +
 +if pipes.cdp_name() != pipe_name:
 +self.interpreter.pipe.switch(pipe_name)
 +
 +# Printout.
 +section(file=sys.stdout, text=Results writing for 
 pipe='%s%(pipe_name), prespace=2, postspace=0)
 +model_params = MODEL_PARAMS[model]
 +subsection(file=sys.stdout, text=Model %s, with 
 params='%s%(model, model_params), prespace=0)
 +
 +# Set path
 +model_path = model.replace( , _)
 +analysis_path = analysis.replace( , _)
 +path = self.results_dir+sep+model_path+sep+analysis_path
 +
 +# Dispersion curves.
 +path_disp = path+sep+disp_curves+sep+method+sep+str(glob_ini)
 +self.interpreter.relax_disp.plot_disp_curves(dir=path_disp, 
 force=True)
 +self.interpreter.relax_disp.write_disp_curves(dir=path_disp, 
 force=True)
 +
 +# The selected models for the final run.
 +self.interpreter.value.write(param='model', file='model.out', 
 dir=path, force=True)
 +
 +models_tested = None
 +
 +# For CPMG models.
 +filep = str(glob_ini)+_+method+_
 +path_par = path+sep+r2
 +if has_cpmg_exp_type():
 +# The R20 parameter.
 +self.write_results_test(path=path_par, model=model, 
 models_tested=models_tested, param='r2', file_name_ini=filep+'r20')
 +
 +# The R20A and R20B parameters.
 +self.write_results_test(path=path_par, model=model, 
 models_tested=models_tested, param='r2a', file_name_ini=filep+'r20a')
 +self.write_results_test(path=path_par, model=model, 
 models_tested=models_tested, param='r2b', file_name_ini=filep+'r20b')
 +
 +# The pA and pB parameters.
 +path_par = path+sep+pop
 +self.write_results_test(path=path_par, model=model, 
 models_tested=models_tested, param='pA', file_name_ini=filep+'pA')
 +self.write_results_test(path=path_par, model=model,