From 7737470f260580994a762bc80005d32607c6675c Mon Sep 17 00:00:00 2001 From: Michael Winkler Date: Wed, 6 Nov 2024 18:10:28 +0100 Subject: [PATCH] excluding time series --- weldx/transformations/local_cs.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/weldx/transformations/local_cs.py b/weldx/transformations/local_cs.py index 0783e24ac..ae4dfb9e6 100644 --- a/weldx/transformations/local_cs.py +++ b/weldx/transformations/local_cs.py @@ -757,14 +757,20 @@ def as_homogeneous_matrix(self, translation_unit: UnitLike) -> np.ndarray: time_dim = 1 rotation = np.resize(self.orientation.data, (time_dim, 3, 3)) - translation = np.resize( - self.coordinates.data.to(translation_unit).m, (time_dim, 3) - ) - homogeneous_matrix = np.resize(np.identity(4), (time_dim, 4, 4)) - homogeneous_matrix[:, :3, :3] = rotation - homogeneous_matrix[:, :3, 3] = translation + coordinates = self.coordinates + if not isinstance(coordinates, TimeSeries): + translation = np.resize( + coordinates.data.to(translation_unit).m, (time_dim, 3) + ) + homogeneous_matrix = np.resize(np.identity(4), (time_dim, 4, 4)) + homogeneous_matrix[:, :3, :3] = rotation + homogeneous_matrix[:, :3, 3] = translation - return np.squeeze(homogeneous_matrix) + return np.squeeze(homogeneous_matrix) + else: + raise NotImplementedError( + "Cannot convert LCS with `TimeSeries` coordinates to homogeneous matrix" + ) def _interp_time_orientation(self, time: Time) -> xr.DataArray: """Interpolate the orientation in time."""