Skip to content
Draft
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 pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "jabs-postprocess"
version = "0.5.2"
version = "0.5.3"
description = "A python library for JABS postprocessing utilities."
readme = "README.md"
license = "LicenseRef-PLATFORM-LICENSE-AGREEMENT-FOR-NON-COMMERCIAL-USE"
Expand Down
4 changes: 4 additions & 0 deletions src/jabs_postprocess/compare_gt.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,10 @@ def generate_output_paths(results_folder: Path):
def _expand_intervals_to_frames(df):
"""Expand behavior intervals into per-frame rows."""
expanded = df.copy()
# Ensure integer frame boundaries so range() receives ints even if upstream data was cast to float
for col in ["animal_idx", "start", "duration"]:
if col in expanded.columns:
expanded[col] = pd.to_numeric(expanded[col], errors="coerce").fillna(0).astype(int)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are "animal_idx" always integers? I think that is the case with all the system that we have, but just want to make sure.

Comment on lines +503 to +504

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering about the consequence of turning errors into 0: should it instead be considered a fatal error and trigger a fail-fast exception? Approving and leaving final call to you.

expanded["frame"] = expanded.apply(
lambda row: range(row["start"], row["start"] + row["duration"]), axis=1
)
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading