Author: bugman Date: Tue Jul 26 21:55:53 2011 New Revision: 13906 URL: http://svn.gna.org/viewcvs/relax?rev=13906&view=rev Log: Implemented the model-free version of the data_type() API method. Modified: 1.3/specific_fns/model_free/main.py Modified: 1.3/specific_fns/model_free/main.py URL: http://svn.gna.org/viewcvs/relax/1.3/specific_fns/model_free/main.py?rev=13906&r1=13905&r2=13906&view=diff ============================================================================== --- 1.3/specific_fns/model_free/main.py (original) +++ 1.3/specific_fns/model_free/main.py Tue Jul 26 21:55:53 2011 @@ -1343,6 +1343,50 @@ # Return the names. return names + + + def data_type(self, param=None): + """Return the type of data, as a string, that the parameter should be. + + @keyword param: The parameter name. + @type param: list of str + @return: The type of the parameter, as a string. I.e. 'int', 'float', 'str', 'bool', 'list of str', 'dict of bool', etc. + @rtype: str + """ + + # A dictionary of all the types. + types = { + 'select': bool, + 'fixed': bool, + 'proton_type': str, + 'heteronuc_type': str, + 'attached_proton': str, + 'nucleus': str, + 'model': str, + 'equation': str, + 'params': [str], + 'xh_vect': [float], + 's2': float, + 's2f': float, + 's2s': float, + 'local_tm': float, + 'te': float, + 'tf': float, + 'ts': float, + 'rex': float, + 'r': float, + 'csa': float, + 'chi2': float, + 'iter': int, + 'f_count': int, + 'g_count': int, + 'h_count': int, + 'warning': str + } + + # Return the type, if in the list. + if types.has_key(param): + return types[param] default_value_doc = """