Skip to content

Conversation

@bergsalex
Copy link
Contributor

Fix for report from @michberger :

TypeError: 'float' object cannot be interpreted as an integer.

When GT annotations are missing, we synthesize “not-behavior” bouts covering the whole video. Concatenating those dummy rows onto an empty GT table makes pandas upcast numeric fields to float. Later,
_expand_intervals_to_frames passed those floats to range, raising TypeError: 'float' object cannot be interpreted as an integer. The failure happened before any metrics/plots were produced.

@bergsalex bergsalex self-assigned this Dec 6, 2025
@bergsalex bergsalex added the bug Something isn't working label Dec 6, 2025
Copy link
Contributor

@ptuan5 ptuan5 left a comment

Choose a reason for hiding this comment

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

Only one concern

# 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
if col in expanded.columns:
expanded[col] = pd.to_numeric(expanded[col], errors="coerce").fillna(0).astype(int)

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants