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 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
13 changes: 13 additions & 0 deletions src/jabs_postprocess/compare_gt.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,19 @@ 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
# (e.g., when concatenating empty int DataFrames with dict-based DataFrames, pandas upcasts to float)
for col in ["animal_idx", "start", "duration"]:
if col in expanded.columns:
# Check for NaN values which indicate data quality issues
if expanded[col].isna().any():
raise ValueError(
f"Column '{col}' contains NaN values. "
f"Expected valid numeric values for frame interval calculation."
)
# Convert to int, allowing for float values that can be safely cast
# (e.g., 5.0 -> 5, but 5.5 would truncate to 5)
expanded[col] = expanded[col].astype(int)
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.