From 763bd7675375b2d43b6e8a15fbd99ef32c68a088 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sat, 16 Aug 2025 08:37:18 +0000 Subject: [PATCH] Checkpoint before follow-up message Co-authored-by: anmolsinghmsd --- movement/__init__.py | 2 +- movement/io/save_poses.py | 2 +- movement/utils/vector.py | 16 ++++++++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/movement/__init__.py b/movement/__init__.py index bf5d4a2d2..0b4fa0d69 100644 --- a/movement/__init__.py +++ b/movement/__init__.py @@ -6,7 +6,7 @@ __version__ = version("movement") except PackageNotFoundError: # package is not installed - pass + __version__ = "0.0.0" # set xarray global options import xarray as xr diff --git a/movement/io/save_poses.py b/movement/io/save_poses.py index 52a0a4a7f..019d3f36a 100644 --- a/movement/io/save_poses.py +++ b/movement/io/save_poses.py @@ -216,7 +216,7 @@ def to_dlc_file( filepath = f"{file.path.with_suffix('')}_{key}{file.path.suffix}" if isinstance(df, pd.DataFrame): _save_dlc_df(Path(filepath), df) - logger.info(f"Saved poses for individual {key} to {file.path}.") + logger.info(f"Saved poses for individual {key} to {filepath}.") else: # convert the dataset to a single dataframe for all individuals df_all = to_dlc_style_df(ds, split_individuals=False) diff --git a/movement/utils/vector.py b/movement/utils/vector.py index f633b1259..8d634603e 100644 --- a/movement/utils/vector.py +++ b/movement/utils/vector.py @@ -237,8 +237,20 @@ def compute_signed_angle_2d( v = v.squeeze() if v.ndim == 1: v_dims = ["space"] + v_coords = {"space": u.coords["space"]} elif v.ndim == 2: - v_dims = ["time", "space"] + # If a single time point is provided, treat as a 1D space vector + # so it can broadcast across the time dimension of ``u`` + if v.shape[0] == 1: + v = v.squeeze(0) + v_dims = ["space"] + v_coords = {"space": u.coords["space"]} + else: + v_dims = ["time", "space"] + v_coords = { + "time": u.coords["time"], + "space": u.coords["space"], + } else: raise log_error( ValueError, @@ -247,7 +259,7 @@ def compute_signed_angle_2d( v = xr.DataArray( v, dims=v_dims, - coords={d: u.coords[d] for d in v_dims}, + coords=v_coords, ) elif not isinstance(v, xr.DataArray): raise log_error(