Skip to content

Commit

Permalink
📝 Streamline operations.py type hints to rely on typing only
Browse files Browse the repository at this point in the history
  • Loading branch information
Baharis committed Jan 21, 2025
1 parent ce974d0 commit 3d003ab
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions hikari/symmetry/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,8 @@ def from_pair(cls, matrix: np.ndarray, vector: np.ndarray) -> 'Operation':
and 3-length translation vector. Alias for standard creation method.
:param matrix: 3x3 point transformation matrix
:type matrix: np.ndarray
:param vector: 3-length translation vector
:type vector: np.ndarray
:return: Symmetry operation generated based on matrix - vector pair
:rtype: Operation
"""
return cls(matrix, vector)

Expand Down Expand Up @@ -156,10 +153,7 @@ def tl(self, value: np.ndarray) -> None:

@property
def matrix(self) -> np.ndarray:
"""
:return: Augmented 4 x 4 transformation matrix with float-type values
:rtype: np.ndarray
"""
"""Augmented 4 x 4 transformation matrix with float-type values"""
matrix = np.eye(4, dtype=float)
matrix[0:3, 0:3] = self.tf
matrix[0:3, 3] = self.tl
Expand Down Expand Up @@ -348,11 +342,8 @@ def into(self, direction: np.ndarray, hexagonal: bool = False) -> 'Operation':
Will most likely not work for unimplemented rhombohedral unit cells.
:param direction: Target orientation for element of symmetry operation
:type direction: np.ndarray
:param hexagonal: True if operation is defined in hexagonal coordinates
:type hexagonal: bool
:return: New symmetry operation whose orientation is "direction"
:rtype: Operation
"""
rebase = np.array(((1, -1/2, 0), (0, np.sqrt(3)/2, 0), (0, 0, 1))) \
if hexagonal else np.eye(3)
Expand Down Expand Up @@ -393,9 +384,7 @@ def transform(self, other: np.ndarray) -> np.ndarray:
Transform a column containing rows of coordinate points
:param other: A vertical numpy array of coordinate triplets kept in rows
:type other: np.ndarray
:return: Same-shaped array of coordinate triplets transformed by self
:rtype: np.ndarray
"""
if other.shape[1] == 3:
return (self.tf @ other.T).T + self.tl
Expand Down

0 comments on commit 3d003ab

Please sign in to comment.