Author: bugman Date: Thu Jan 10 19:32:12 2008 New Revision: 4614 URL: http://svn.gna.org/viewcvs/relax?rev=4614&view=rev Log: Wrote the specific_fns.n_state_model.set_type() function. Modified: branches/N_state_model/specific_fns/n_state_model.py Modified: branches/N_state_model/specific_fns/n_state_model.py URL: http://svn.gna.org/viewcvs/relax/branches/N_state_model/specific_fns/n_state_model.py?rev=4614&r1=4613&r2=4614&view=diff ============================================================================== --- branches/N_state_model/specific_fns/n_state_model.py (original) +++ branches/N_state_model/specific_fns/n_state_model.py Thu Jan 10 19:32:12 2008 @@ -181,3 +181,28 @@ # The tensor label doesn't exist. if not match: raise RelaxNoTensorError, ('diffusion', tensor) + + + def set_type(self, tensor=None, red=None): + """Set the whether the given tensor is the full or reduced tensor. + + @param tensor: The alignment tensor label. + @type tensor: str + @param red: The flag specifying whether the given tensor is the full or reduced tensor. + @type red: bool + """ + + # Alias the current data pipe. + cdp = relax_data_store[relax_data_store.current_pipe] + + # Loop over the tensors. + match = False + for tensor_cont in cdp.align_tensor: + # Find the matching tensor and then store the tensor type. + if tensor_cont.name == tensor: + tensor_cont.red = red + match = True + + # The tensor label doesn't exist. + if not match: + raise RelaxNoTensorError, ('alignment', tensor)