Author: bugman Date: Wed Jan 9 10:50:39 2008 New Revision: 4523 URL: http://svn.gna.org/viewcvs/relax?rev=4523&view=rev Log: Renamed 'print_flag' to 'verbosity' in the calc(), grid_search(), and minimise() user functions. This arg is not really a flag, and it is the verbosity level, so this makes more sense. Modified: 1.3/prompt/minimisation.py Modified: 1.3/prompt/minimisation.py URL: http://svn.gna.org/viewcvs/relax/1.3/prompt/minimisation.py?rev=4523&r1=4522&r2=4523&view=diff ============================================================================== --- 1.3/prompt/minimisation.py (original) +++ 1.3/prompt/minimisation.py Wed Jan 9 10:50:39 2008 @@ -37,31 +37,31 @@ self.relax = relax - def calc(self, print_flag=1): + def calc(self, verbosity=1): """Function for calculating the function value. Keyword Arguments ~~~~~~~~~~~~~~~~~ - print_flag: The amount of information to print to screen. Zero corresponds to minimal + verbosity: The amount of information to print to screen. Zero corresponds to minimal output while higher values increase the amount of output. The default value is 1. """ # Function intro text. if self.relax.interpreter.intro: text = sys.ps3 + "calc(" - text = text + "print_flag=" + `print_flag` + ")" + text = text + "verbosity=" + `verbosity` + ")" print text - # The print flag. - if type(print_flag) != int: - raise RelaxIntError, ('print flag', print_flag) + # The verbosity level. + if type(verbosity) != int: + raise RelaxIntError, ('verbosity level', verbosity) # Execute the functional code. - minimise.calc(print_flag=print_flag) - - - def grid_search(self, lower=None, upper=None, inc=21, constraints=1, print_flag=1): + minimise.calc(verbosity=verbosity) + + + def grid_search(self, lower=None, upper=None, inc=21, constraints=1, verbosity=1): """The grid search function. Keyword Arguments @@ -81,7 +81,7 @@ constraints: A flag specifying whether the parameters should be constrained. The default is to turn constraints on (constraints=1). - print_flag: The amount of information to print to screen. Zero corresponds to minimal + verbosity: The amount of information to print to screen. Zero corresponds to minimal output while higher values increase the amount of output. The default value is 1. """ @@ -92,7 +92,7 @@ text = text + ", upper=" + `upper` text = text + ", inc=" + `inc` text = text + ", constraints=" + `constraints` - text = text + ", print_flag=" + `print_flag` + ")" + text = text + ", verbosity=" + `verbosity` + ")" print text # The lower bounds. @@ -144,12 +144,12 @@ if type(constraints) != int or (constraints != 0 and constraints != 1): raise RelaxBinError, ('constraint flag', constraints) - # The print flag. - if type(print_flag) != int: - raise RelaxIntError, ('print flag', print_flag) + # The verbosity level. + if type(verbosity) != int: + raise RelaxIntError, ('verbosity level', verbosity) # Execute the functional code. - minimise.grid_search(lower=lower, upper=upper, inc=inc, constraints=constraints, print_flag=print_flag) + minimise.grid_search(lower=lower, upper=upper, inc=inc, constraints=constraints, verbosity=verbosity) def minimise(self, *args, **keywords): @@ -190,7 +190,7 @@ scaling: The diagonal scaling flag. The default that scaling is on (scaling=1). - print_flag: The amount of information to print to screen. Zero corresponds to minimal + verbosity: The amount of information to print to screen. Zero corresponds to minimal output while higher values increase the amount of output. The default value is 1. @@ -230,7 +230,7 @@ relax> minimise('newton', func_tol=1e-25, grad_tol=None) relax> minimise('newton', max_iter=1e7) relax> minimise('newton', constraints=1, max_iter=1e7) - relax> minimise('newton', print_flag=1) + relax> minimise('newton', verbosity=1) To use constrained Simplex minimisation with a maximum of 5000 iterations, type: @@ -289,11 +289,11 @@ else: scaling = 1 - # Keyword: print_flag. - if keywords.has_key('print_flag'): - print_flag = keywords['print_flag'] - else: - print_flag = 1 + # Keyword: verbosity. + if keywords.has_key('verbosity'): + verbosity = keywords['verbosity'] + else: + verbosity = 1 # Function intro text. if self.relax.interpreter.intro: @@ -303,7 +303,7 @@ text = text + ", max_iterations=" + `max_iterations` text = text + ", constraints=" + `constraints` text = text + ", scaling=" + `scaling` - text = text + ", print_flag=" + `print_flag` + ")" + text = text + ", verbosity=" + `verbosity` + ")" print text # Minimisation algorithm. @@ -318,7 +318,7 @@ min_options = args[1:] # Test for invalid keywords. - valid_keywords = ['func_tol', 'grad_tol', 'max_iter', 'max_iterations', 'constraints', 'scaling', 'print_flag'] + valid_keywords = ['func_tol', 'grad_tol', 'max_iter', 'max_iterations', 'constraints', 'scaling', 'verbosity'] for key in keywords: valid = 0 for valid_key in valid_keywords: @@ -350,12 +350,12 @@ if type(scaling) != int or (scaling != 0 and scaling != 1): raise RelaxBinError, ('scaling', scaling) - # Print flag. - if type(print_flag) != int: - raise RelaxIntError, ('print flag', print_flag) + # The verbosity level. + if type(verbosity) != int: + raise RelaxIntError, ('verbosity level', verbosity) # Execute the functional code. - minimise.minimise(min_algor=min_algor, min_options=min_options, func_tol=func_tol, grad_tol=grad_tol, max_iterations=max_iterations, constraints=constraints, scaling=scaling, print_flag=print_flag) + minimise.minimise(min_algor=min_algor, min_options=min_options, func_tol=func_tol, grad_tol=grad_tol, max_iterations=max_iterations, constraints=constraints, scaling=scaling, verbosity=verbosity)