Author: bugman Date: Wed Jan 18 15:38:17 2012 New Revision: 15170 URL: http://svn.gna.org/viewcvs/relax?rev=15170&view=rev Log: Some of the specific API common methods now use the new SPIN_PARAM structure. Some are now spin specific, and a few new spin specific methods have been added for the specific code to alias. Modified: branches/spec_api/specific_fns/api_common.py Modified: branches/spec_api/specific_fns/api_common.py URL: http://svn.gna.org/viewcvs/relax/branches/spec_api/specific_fns/api_common.py?rev=15170&r1=15169&r2=15170&view=diff ============================================================================== --- branches/spec_api/specific_fns/api_common.py (original) +++ branches/spec_api/specific_fns/api_common.py Wed Jan 18 15:38:17 2012 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2004-2011 Edward d'Auvergne # +# Copyright (C) 2004-2012 Edward d'Auvergne # # # # This file is part of the program relax. # # # @@ -227,7 +227,7 @@ return 1.0 - def _return_data_name(self, param): + def _return_data_name_spin(self, param): """Return a unique identifying string for the parameter. @param param: The parameter name. @@ -236,7 +236,11 @@ @rtype: str """ - # No name mappings. + # No parameter. + if not self.SPIN_PARAMS.contains(param): + return None + + # Return the name. return param @@ -277,6 +281,36 @@ # Return the list. return error + + + def _return_grace_string_spin(self, param): + """Return the Grace string representing the given spin parameter. + + @param param: The parameter name. + @type param: str + @return: The unique parameter identifying string. + @rtype: str + """ + + # The string. + return self.SPIN_PARAMS.get_grace_string(param) + + + def _return_units_spin(self, param): + """Return a string representing the spin parameter units. + + @param param: The parameter name. + @type param: str + @return: The string representation of the units. + @rtype: None or str + """ + + # No parameter. + if not self.SPIN_PARAMS.contains(param): + return None + + # Return the name. + return param def _return_value_general(self, spin, param, sim=None, bc=False): @@ -454,11 +488,8 @@ # Loop over the parameters. for i in range(len(param)): - # Get the object's name. - obj_name = self.return_data_name(param[i]) - # Is the parameter is valid? - if not obj_name: + if not self.SPIN_PARAMS.contains(param[i]): raise RelaxError("The parameter '%s' is not valid for this data pipe type." % param[i]) # Spin loop. @@ -468,7 +499,7 @@ continue # Set the parameter. - setattr(spin, obj_name, value[i]) + setattr(spin, param[i], value[i]) def _set_selected_sim_global(self, model_info, select_sim):