Author: bugman Date: Mon Nov 26 11:59:58 2007 New Revision: 3992 URL: http://svn.gna.org/viewcvs/relax?rev=3992&view=rev Log: Implemented the align_tensor.copy(), align_tensor.delete(), align_tensor.display() user functions. The back end doesn't yet exist. Modified: branches/N_state_model/prompt/align_tensor.py Modified: branches/N_state_model/prompt/align_tensor.py URL: http://svn.gna.org/viewcvs/relax/branches/N_state_model/prompt/align_tensor.py?rev=3992&r1=3991&r2=3992&view=diff ============================================================================== --- branches/N_state_model/prompt/align_tensor.py (original) +++ branches/N_state_model/prompt/align_tensor.py Mon Nov 26 11:59:58 2007 @@ -25,7 +25,7 @@ # relax module imports. import help -from relax_errors import RelaxError, RelaxBinError, RelaxIntError, RelaxNumTupleError +from relax_errors import RelaxError, RelaxBinError, RelaxIntError, RelaxNoneStrError, RelaxNumTupleError class Align_tensor: @@ -39,6 +39,99 @@ # Place relax in the class namespace. self.__relax__ = relax + + + def copy(self, pipe_from=None, pipe_to=None): + """Function for copying alignment tensor data from one data pipe to another. + + Keyword Arguments + ~~~~~~~~~~~~~~~~~ + + pipe_from: The name of the data pipe to copy the alignment tensor data from. + + pipe_to: The name of the data pipe to copy the alignment tensor data to. + + + Description + ~~~~~~~~~~~ + + This function will copy the alignment tensor data between data pipes. The destination data + pipe must not contain any alignment tensor data. If the pipe_from or pipe_to arguments are + not supplied, then both will default to the current data pipe (hence giving one argument is + essential). + + + Examples + ~~~~~~~~ + + To copy the alignment tensor from the data pipe 'Pf1' to the current data pipe, type: + + relax> align_tensor.copy('Pf1') + relax> align_tensor.copy(pipe_from='Pf1') + + + To copy the alignment tensor from the current data pipe to the data pipe 'Otting', type: + + relax> align_tensor.copy(pipe_to='Otting') + + + To copy the alignment tensor from the data pipe 'Pf1' to 'Otting', type: + + relax> align_tensor.copy('Pf1', 'Otting') + relax> align_tensor.copy(pipe_from='Pf1', pipe_to='Otting') + """ + + # Function intro text. + if self.__relax__.interpreter.intro: + text = sys.ps3 + "align_tensor.copy(" + text = text + "pipe_from=" + `pipe_from` + text = text + ", pipe_to=" + `pipe_to` + ")" + print text + + # The pipe_from argument. + if pipe_from != None and type(pipe_from) != str: + raise RelaxNoneStrError, ('pipe from', pipe_from) + + # The pipe_to argument. + if pipe_to != None and type(pipe_to) != str: + raise RelaxNoneStrError, ('pipe to', pipe_to) + + # Both pipe arguments cannot be None. + if pipe_from == None and pipe_to == None: + raise RelaxError, "The pipe_from and pipe_to arguments cannot both be set to None." + + # Execute the functional code. + align_tensor.copy(pipe_from=pipe_from, pipe_to=pipe_to) + + + def delete(self): + """Function for deleting alignment tensor data. + + Description + ~~~~~~~~~~~ + + This function will delete all alignment tensor data from the current data pipe. + """ + + # Function intro text. + if self.__relax__.interpreter.intro: + text = sys.ps3 + "align_tensor.delete()" + print text + + # Execute the functional code. + align_tensor.delete() + + + def display(self): + """Function for displaying the alignment tensor information.""" + + # Function intro text. + if self.__relax__.interpreter.intro: + text = sys.ps3 + "align_tensor.display()" + print text + + # Execute the functional code. + align_tensor.display() def init(self, params=None, param_types=0, errors=0):