Skip to content

Commit f6c724a

Browse files
committed
refactor(axes): reword principal axes docstrings
1 parent 0743974 commit f6c724a

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

‎CodeEntropy/levels/axes.py‎

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,12 +1076,12 @@ def get_principal_axes_from_tensor(
10761076
degeneracy_rtol: float = 100 * np.finfo(np.float32).eps,
10771077
reference_vector: Sequence[float] = (1.0, 2.0, 3.0),
10781078
) -> tuple[np.ndarray, np.ndarray]:
1079-
"""Compute reproducible principal axes and moments from a MOI tensor.
1079+
"""Compute the principal axes and moments of a moment of inertia tensor.
10801080
1081-
``np.linalg.eigh`` fixes neither the sign of each eigenvector nor the basis
1082-
within a degenerate eigenspace, and both can differ between LAPACK builds.
1083-
The axes define the frame covariances are averaged in, so this changes the
1084-
entropy. Both are therefore fixed here:
1081+
The eigenvectors of a symmetric tensor are only defined up to a sign, and,
1082+
for equal moments, up to a rotation within the degenerate eigenspace. The
1083+
axes are returned in a canonical form, so that a given tensor always
1084+
produces the same axes. The convention is:
10851085
10861086
- Moments are sorted by descending absolute value.
10871087
- Within a degenerate eigenspace (moments equal to within
@@ -1091,9 +1091,6 @@ def get_principal_axes_from_tensor(
10911091
- The first two axes are signed to have a positive projection onto
10921092
``reference_vector``, and the third is their cross product.
10931093
1094-
The reference is defined in the lab frame, so the result is reproducible
1095-
but not rotation covariant.
1096-
10971094
Args:
10981095
moment_of_inertia_tensor: (3, 3) symmetric inertia tensor.
10991096
degeneracy_rtol: Relative tolerance, with respect to the largest
@@ -1134,7 +1131,7 @@ def get_principal_axes_from_tensor(
11341131
return principal_axes, principal_moments
11351132

11361133
def get_principal_axes_from_group(self, group) -> np.ndarray:
1137-
"""Return the reproducible principal axes (rows) of an atom group."""
1134+
"""Return the canonical principal axes (rows) of an atom group."""
11381135
principal_axes, _ = self.get_principal_axes_from_tensor(
11391136
group.atoms.moment_of_inertia()
11401137
)

0 commit comments

Comments
 (0)