talmolab / sleap

A deep learning framework for multi-animal pose tracking.
https://sleap.ai
Other
435 stars 97 forks source link

Add `Track` when add `Instance` #1408

Closed roomrys closed 1 year ago

roomrys commented 1 year ago

Description

Previously, the Labels.add_instance method would add the track associated with the instance to the cache, but not to the Labels object itself. I did not verify this, but I am sure this is handled in the call sequence when SLEAP adds tracks; however, it makes the SLEAP API a bit difficult to use (leading to KeyErrors in the LabelsDataCache dictionaries).

This PR adds the Track associated with an Instance to the Labels.tracks list when calling Labels.add_instance.

Types of changes

Does this address any currently open issues?

[list open issues here]

Outside contributors checklist

Thank you for contributing to SLEAP!

:heart:

codecov[bot] commented 1 year ago

Codecov Report

Merging #1408 (bcefd05) into develop (d173303) will increase coverage by 0.00%. The diff coverage is 100.00%.

@@           Coverage Diff            @@
##           develop    #1408   +/-   ##
========================================
  Coverage    72.74%   72.74%           
========================================
  Files          133      133           
  Lines        23723    23722    -1     
========================================
  Hits         17257    17257           
+ Misses        6466     6465    -1     
Files Changed Coverage Δ
sleap/io/dataset.py 83.66% <100.00%> (+0.08%) :arrow_up:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more