Skip to content

Commit 7737470

Browse files
committed
excluding time series
1 parent 42e476e commit 7737470

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

weldx/transformations/local_cs.py

+13-7
Original file line numberDiff line numberDiff line change
@@ -757,14 +757,20 @@ def as_homogeneous_matrix(self, translation_unit: UnitLike) -> np.ndarray:
757757
time_dim = 1
758758

759759
rotation = np.resize(self.orientation.data, (time_dim, 3, 3))
760-
translation = np.resize(
761-
self.coordinates.data.to(translation_unit).m, (time_dim, 3)
762-
)
763-
homogeneous_matrix = np.resize(np.identity(4), (time_dim, 4, 4))
764-
homogeneous_matrix[:, :3, :3] = rotation
765-
homogeneous_matrix[:, :3, 3] = translation
760+
coordinates = self.coordinates
761+
if not isinstance(coordinates, TimeSeries):
762+
translation = np.resize(
763+
coordinates.data.to(translation_unit).m, (time_dim, 3)
764+
)
765+
homogeneous_matrix = np.resize(np.identity(4), (time_dim, 4, 4))
766+
homogeneous_matrix[:, :3, :3] = rotation
767+
homogeneous_matrix[:, :3, 3] = translation
766768

767-
return np.squeeze(homogeneous_matrix)
769+
return np.squeeze(homogeneous_matrix)
770+
else:
771+
raise NotImplementedError(
772+
"Cannot convert LCS with `TimeSeries` coordinates to homogeneous matrix"
773+
)
768774

769775
def _interp_time_orientation(self, time: Time) -> xr.DataArray:
770776
"""Interpolate the orientation in time."""

0 commit comments

Comments
 (0)