Skip to content

Commit d38438d

Browse files
committed
Coerce frame interval columns to int before exploding
1 parent 287aa60 commit d38438d

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "jabs-postprocess"
3-
version = "0.5.2"
3+
version = "0.5.3"
44
description = "A python library for JABS postprocessing utilities."
55
readme = "README.md"
66
license = "LicenseRef-PLATFORM-LICENSE-AGREEMENT-FOR-NON-COMMERCIAL-USE"

src/jabs_postprocess/compare_gt.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,10 @@ def generate_output_paths(results_folder: Path):
498498
def _expand_intervals_to_frames(df):
499499
"""Expand behavior intervals into per-frame rows."""
500500
expanded = df.copy()
501+
# Ensure integer frame boundaries so range() receives ints even if upstream data was cast to float
502+
for col in ["animal_idx", "start", "duration"]:
503+
if col in expanded.columns:
504+
expanded[col] = pd.to_numeric(expanded[col], errors="coerce").fillna(0).astype(int)
501505
expanded["frame"] = expanded.apply(
502506
lambda row: range(row["start"], row["start"] + row["duration"]), axis=1
503507
)

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)