Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shifted instances: make sure ref_instances is not empty #1029

Merged
merged 2 commits into from
Nov 8, 2022

Conversation

getzze
Copy link
Contributor

@getzze getzze commented Nov 4, 2022

Description

Correction of another bug introduced by save_shifted_instances=True. Hopefully the last one...
I had corrected it locally but forgot to include it in the last correction PR #1001.

Loading frames from self.shifted_instances, ref_instances changes and can become an empty list.
But the test for ref_instances being non-empty was before these lines, therefore the following lines crash because ref_instances is unexpectedly an empty list.
There are two changes to correct this bug:

  • put the code for loading from self.shifted_instances above the len(ref_instances) > 0 test (this is not really needed but it makes the code easier to read).
  • ref_instances (and ref_img) is modified only if it is not empty.

Types of changes

  • Bugfix

@codecov
Copy link

codecov bot commented Nov 4, 2022

Codecov Report

Merging #1029 (bc25a5f) into develop (f54e6fc) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff            @@
##           develop    #1029   +/-   ##
========================================
  Coverage    66.74%   66.74%           
========================================
  Files          127      127           
  Lines        21526    21527    +1     
========================================
+ Hits         14367    14368    +1     
  Misses        7159     7159           
Impacted Files Coverage Δ
sleap/nn/tracking.py 72.81% <100.00%> (+0.05%) ⬆️

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

Copy link
Collaborator

@roomrys roomrys left a comment

Choose a reason for hiding this comment

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

lgtm

@roomrys roomrys merged commit 72a4ae2 into talmolab:develop Nov 8, 2022
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.

2 participants