Skip to content

Returning previous and updated tracklet IDs from assign_tracklet_ids.#180

Merged
JoOkuma merged 10 commits intoroyerlab:mainfrom
yfukai:return_tracklet_id_mapping2
Oct 24, 2025
Merged

Returning previous and updated tracklet IDs from assign_tracklet_ids.#180
JoOkuma merged 10 commits intoroyerlab:mainfrom
yfukai:return_tracklet_id_mapping2

Conversation

@yfukai
Copy link
Copy Markdown
Contributor

@yfukai yfukai commented Oct 23, 2025

In order to undo the action of assigning tracklet IDs, it would be useful to have a list of the updated IDs. This PR intends to have the function assign_tracklet_ids return the updated IDs. Since computing the updates has a computational cost, I made it optional, but input is welcome!

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Oct 23, 2025

Codecov Report

❌ Patch coverage is 94.73684% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 88.04%. Comparing base (06d104e) to head (334d944).

Files with missing lines Patch % Lines
src/tracksdata/graph/_rustworkx_graph.py 94.73% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #180   +/-   ##
=======================================
  Coverage   88.03%   88.04%           
=======================================
  Files          50       50           
  Lines        3444     3454   +10     
  Branches      596      600    +4     
=======================================
+ Hits         3032     3041    +9     
  Misses        248      248           
- Partials      164      165    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@yfukai yfukai marked this pull request as ready for review October 23, 2025 02:20
Copy link
Copy Markdown
Member

@JoOkuma JoOkuma left a comment

Choose a reason for hiding this comment

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

Hey @yfukai, great PR.
I left some minor comments.

# Update the value with the reused IDs
id_update_df = id_update_df.with_columns(pl.Series(output_key + "_new", tracklet_ids))
else:
tracklet_ids = [int(tid) for tid in tracklet_ids] # type: ignore
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would this work?

Suggested change
tracklet_ids = [int(tid) for tid in tracklet_ids] # type: ignore
tracklet_ids = tracklet_ids.tolist() # type: ignore

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion! I changed this to tolist, and also moved it before the if blocks as I was missing the case with if previous_id_df is None. (Adds a slight overhead, but I believe it makes the code simpler).

Comment thread src/tracksdata/graph/_base_graph.py
Comment thread src/tracksdata/graph/_test/test_graph_backends.py Outdated
Comment thread src/tracksdata/graph/_test/test_graph_backends.py Outdated
@JoOkuma
Copy link
Copy Markdown
Member

JoOkuma commented Oct 24, 2025

LGTM! thanks @yfukai
I need to investigate how to address the numpy scalar issue with SQLAlchemy. I think it allows a preprocessor, and the item() would be called there and invisible to the user.

@JoOkuma JoOkuma merged commit 8996616 into royerlab:main Oct 24, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants