Author: bugman Date: Fri Nov 16 12:32:11 2012 New Revision: 17995 URL: http://svn.gna.org/viewcvs/relax?rev=17995&view=rev Log: Merged revisions 17994 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk ........ r17994 | bugman | 2012-11-16 12:27:38 +0100 (Fri, 16 Nov 2012) | 5 lines The model_selection user function is now using relax_io.write_data() for its printouts. This allows for clean formatting when data pipes have long names. ........ Modified: branches/frame_order_testing/ (props changed) branches/frame_order_testing/generic_fns/model_selection.py Propchange: branches/frame_order_testing/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Fri Nov 16 12:32:11 2012 @@ -1,1 +1,1 @@ -/trunk:1-17987 +/trunk:1-17994 Modified: branches/frame_order_testing/generic_fns/model_selection.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/generic_fns/model_selection.py?rev=17995&r1=17994&r2=17995&view=diff ============================================================================== --- branches/frame_order_testing/generic_fns/model_selection.py (original) +++ branches/frame_order_testing/generic_fns/model_selection.py Fri Nov 16 12:32:11 2012 @@ -24,11 +24,13 @@ # Python module imports. from math import log +import sys # relax module imports. import generic_fns.pipes from generic_fns.pipes import get_type, has_pipe, pipe_names, switch from relax_errors import RelaxError, RelaxPipeError +from relax_io import write_data from specific_fns.setup import get_specific_fn @@ -217,12 +219,15 @@ # Loop over the base models. for model_info in model_loop(): # Print out. - print("\n" + model_desc(model_info)) - print("%-20s %-20s %-20s %-20s %-20s" % ("Data pipe", "Num_params_(k)", "Num_data_sets_(n)", "Chi2", "Criterion")) + print("\n") + desc = model_desc(model_info) + if desc: + print(desc) # Initial model. best_model = None best_crit = 1e300 + data = [] # Loop over the pipes. for j in range(len(pipes)): @@ -278,14 +283,17 @@ # Calculate the criterion value. crit = formula(chi2, float(k), float(n)) - # Print out. - print("%-20s %-20i %-20i %-20.5f %-20.5f" % (pipe, k, n, chi2, crit)) + # Store the values for a later printout. + data.append([pipe, repr(k), repr(n), "%.5f" % chi2, "%.5f" % crit]) # Select model. if crit < best_crit: best_model = pipe best_crit = crit + # Write out the table. + write_data(out=sys.stdout, headings=["Data pipe", "Num_params_(k)", "Num_data_sets_(n)", "Chi2", "Criterion"], data=data) + # Duplicate the data from the 'best_model' to the model selection data pipe. if best_model != None: # Print out of selected model.