Author: bugman Date: Tue May 29 10:58:24 2012 New Revision: 16499 URL: http://svn.gna.org/viewcvs/relax?rev=16499&view=rev Log: Created the specific API param list loop() method for looping over parameter names. Modified: branches/uf_redesign/specific_fns/api_objects.py Modified: branches/uf_redesign/specific_fns/api_objects.py URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/specific_fns/api_objects.py?rev=16499&r1=16498&r2=16499&view=diff ============================================================================== --- branches/uf_redesign/specific_fns/api_objects.py (original) +++ branches/uf_redesign/specific_fns/api_objects.py Tue May 29 10:58:24 2012 @@ -292,3 +292,29 @@ # Return the value. return self._units[name] + + + def loop(self, set=None): + """An iterator method for looping over all the parameters. + + @keyword set: The set of object names to return. This can be set to 'all' for all names, to 'generic' for generic object names, 'params' for analysis specific parameter names, or to 'min' for minimisation specific object names. + @type set: str + @returns: The parameter names. + @rtype: str + """ + + # Loop over the parameters. + for name in self._names: + # Skip the parameter if the set does not match. + if set == 'generic' and self._param_set[name] != 'generic': + continue + elif set == 'params' and self._param_set[name] != 'params': + continue + + # Yield the parameter name. + yield name + + # Yield the minimisation names. + if set == 'all' or set == 'min': + for name in ['chi2', 'iter', 'f_count', 'g_count', 'h_count', 'warning']: + yield name