Author: bugman Date: Wed Nov 19 19:04:35 2014 New Revision: 26639 URL: http://svn.gna.org/viewcvs/relax?rev=26639&view=rev Log: Added the precision argument to the align_tensor.matrix_angles user function. This allows the number of decimal points for the singular values and condition number to be specified. Modified: trunk/pipe_control/align_tensor.py trunk/user_functions/align_tensor.py Modified: trunk/pipe_control/align_tensor.py URL: http://svn.gna.org/viewcvs/relax/trunk/pipe_control/align_tensor.py?rev=26639&r1=26638&r2=26639&view=diff ============================================================================== --- trunk/pipe_control/align_tensor.py (original) +++ trunk/pipe_control/align_tensor.py Wed Nov 19 19:04:35 2014 @@ -1675,7 +1675,7 @@ raise RelaxNoTensorError('alignment', tensor) -def svd(basis_set='irreducible 5D', tensors=None): +def svd(basis_set='irreducible 5D', tensors=None, precision=1): """Calculate the singular values of all the loaded tensors. The basis set can be set to one of: @@ -1747,10 +1747,12 @@ The SVD values and condition number are dependant upon the basis set chosen. - @param basis_set: The basis set to use for the SVD. This can be one of "irreducible 5D", "unitary 9D", "unitary 5D" or "geometric 5D". + @keyword basis_set: The basis set to use for the SVD. This can be one of "irreducible 5D", "unitary 9D", "unitary 5D" or "geometric 5D". @type basis_set: str - @param tensors: The list of alignment tensor IDs to calculate inter-matrix angles between. If None, all tensors will be used. + @keyword tensors: The list of alignment tensor IDs to calculate inter-matrix angles between. If None, all tensors will be used. @type tensors: None or list of str + @keyword precision: The precision of the printed out angles. The number corresponds to the number of figures to print after the decimal point. + @type precision: int """ # Argument check. @@ -1843,5 +1845,7 @@ sys.stdout.write("SVD for the geometric 5D vectors {Szz, Sxx-yy, Sxy, Sxz, Syz}.\n") sys.stdout.write("\nSingular values:\n") for val in s: - sys.stdout.write(" %.4e\n" % val) - sys.stdout.write("\nCondition number: %.2f\n" % cdp.align_tensors.cond_num) + format = " %." + repr(precision) + "e\n" + sys.stdout.write(format % val) + format = "\nCondition number: %." + repr(precision) + "f\n" + sys.stdout.write(format % cdp.align_tensors.cond_num) Modified: trunk/user_functions/align_tensor.py URL: http://svn.gna.org/viewcvs/relax/trunk/user_functions/align_tensor.py?rev=26639&r1=26638&r2=26639&view=diff ============================================================================== --- trunk/user_functions/align_tensor.py (original) +++ trunk/user_functions/align_tensor.py Wed Nov 19 19:04:35 2014 @@ -479,6 +479,15 @@ wiz_read_only = True, can_be_none = True ) +uf.add_keyarg( + name = "precision", + default = 4, + py_type = "int", + min = 1, + max = 100, + desc_short = "printout precision", + desc = "The precision of the printed out singular values and condition numbers. The number corresponds to the number of figures to print after the decimal point." +) # Description. uf.desc.append(Desc_container()) uf.desc[-1].add_paragraph("This will perform a singular value decomposition for all alignment tensors and calculate the condition number. The singular values and condition number are dependent on the basis set - linear maps produce identical results whereas non-linear maps result in different values. The basis set can be one of:")