Author: bugman Date: Tue Dec 11 12:32:10 2012 New Revision: 18102 URL: http://svn.gna.org/viewcvs/relax?rev=18102&view=rev Log: Fixes for the align_tensor.copy user function for when the tensor_to argument is not supplied. Now it is assumed that the new tensor will have the same name as the old. The new tensor is also properly initialised. Modified: trunk/generic_fns/align_tensor.py Modified: trunk/generic_fns/align_tensor.py URL: http://svn.gna.org/viewcvs/relax/trunk/generic_fns/align_tensor.py?rev=18102&r1=18101&r2=18102&view=diff ============================================================================== --- trunk/generic_fns/align_tensor.py (original) +++ trunk/generic_fns/align_tensor.py Tue Dec 11 12:32:10 2012 @@ -115,8 +115,8 @@ @type tensor_from: str @param pipe_from: The data pipe to copy the alignment tensor data from. This defaults to the current data pipe. @type pipe_from: str - @param tensor_to: The identification string of the alignment tensor to copy the data to. - @type tensor_to: str + @param tensor_to: The identification string of the alignment tensor to copy the data to. If set to None, then the ID string will be set to the value of tensor_from. + @type tensor_to: str or None @param pipe_to: The data pipe to copy the alignment tensor data to. This defaults to the current data pipe. @type pipe_to: str """ @@ -129,6 +129,10 @@ elif pipe_to == None: pipe_to = pipes.cdp_name() + # The target tensor ID string. + if tensor_to == None: + tensor_to = tensor_from + # Test if the pipe_from and pipe_to data pipes exist. pipes.test(pipe_from) pipes.test(pipe_to) @@ -148,6 +152,10 @@ # Create the align_tensors dictionary if it doesn't yet exist. if not hasattr(dp_to, 'align_tensors'): dp_to.align_tensors = AlignTensorList() + + # Add the tensor if it doesn't already exist. + if tensor_to not in dp_to.align_tensors.names(): + tensor_obj = cdp.align_tensors.add_item(tensor_to) # Find the tensor index. index_from = get_tensor_index(tensor_from, pipe_from)