Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion movement/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion movement/io/save_poses.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 14 additions & 2 deletions movement/utils/vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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(
Expand Down