Author: bugman
Date: Wed Nov 19 18:57:53 2014
New Revision: 26637
URL: http://svn.gna.org/viewcvs/relax?rev=26637&view=rev
Log:
Added the angle_units and precision arguments to the align_tensor.matrix_angles
user function.
This allows either degrees or radians to be output, and the number of decimal
points 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=26637&r1=26636&r2=26637&view=diff
==============================================================================
--- trunk/pipe_control/align_tensor.py (original)
+++ trunk/pipe_control/align_tensor.py Wed Nov 19 18:57:53 2014
@@ -883,7 +883,7 @@
tensor_obj.set(param='align_id', value=align_id)
-def matrix_angles(basis_set='matrix', tensors=None):
+def matrix_angles(basis_set='matrix', tensors=None, angle_units='deg',
precision=1):
"""Function for calculating the inter-matrix angles between the alignment
tensors.
The basis set defines how the angles are calculated:
@@ -894,10 +894,14 @@
- "geometric 5D", the geometric 5D basis set {Szz, Sxxyy, Sxy, Sxz,
Syz}. This is also the Pales standard notation.
- @param basis_set: The basis set to use for calculating the inter-matrix
angles. It can be one of "matrix", "irreducible 5D", "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.
- @type tensors: None or list of str
+ @keyword basis_set: The basis set to use for calculating the
inter-matrix angles. It can be one of "matrix", "irreducible 5D", "unitary
5D", or "geometric 5D".
+ @type basis_set: str
+ @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 angle_units: The units for the angle parameters, either 'deg'
or 'rad'.
+ @type angle_units: 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.
@@ -1060,7 +1064,11 @@
cdp.align_tensors.angles[i, j] = theta
# Add to the table as degrees.
- table[i+1].append("%8.1f" % (cdp.align_tensors.angles[i,
j]*180.0/pi))
+ angle = cdp.align_tensors.angles[i, j]
+ if angle_units == 'deg':
+ angle = angle * 180.0 / pi
+ format = "%" + repr(7+precision) + "." + repr(precision) + "f"
+ table[i+1].append(format % angle)
# Write out the table.
write_data(out=sys.stdout, data=table)
Modified: trunk/user_functions/align_tensor.py
URL:
http://svn.gna.org/viewcvs/relax/trunk/user_functions/align_tensor.py?rev=26637&r1=26636&r2=26637&view=diff
==============================================================================
--- trunk/user_functions/align_tensor.py (original)
+++ trunk/user_functions/align_tensor.py Wed Nov 19 18:57:53 2014
@@ -320,6 +320,25 @@
wiz_read_only = True,
can_be_none = True
)
+uf.add_keyarg(
+ name = "angle_units",
+ default = "deg",
+ py_type = "str",
+ desc_short = "angle units",
+ desc = "The units for the angle parameters, either 'deg' or 'rad'.",
+ wiz_element_type = "combo",
+ wiz_combo_choices = ["Degrees", "Radian"],
+ wiz_combo_data = ["deg", "rad"]
+)
+uf.add_keyarg(
+ name = "precision",
+ default = 1,
+ py_type = "int",
+ min = 1,
+ max = 100,
+ desc_short = "printout precision",
+ desc = "The precision of the printed out angles. 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 calculate the inter-matrix angles between
all loaded alignment tensors for the current data pipe. For the vector basis
sets, the matrices are first converted to vector form and then then the
inter-vector angles rather than inter-matrix angles are calculated. The angles
are dependent upon the basis set - linear maps produce identical results
whereas non-linear maps result in different angles. The basis set can be one
of:")
_______________________________________________
relax (http://www.nmr-relax.com)
This is the relax-commits mailing list
[email protected]
To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits