Closed roomrys closed 5 months ago
The recent changes in the codebase primarily focus on enhancing the management of instance annotations within labeled frames. The key update is the introduction of the InstancesList
class, which encapsulates handling lists of instances, ensuring each instance's frame is set correctly. Additionally, the Instance
class modifications, including making the frame attribute private, and updates to LabeledFrame
, streamline instance-frame interactions.
Files | Change Summary |
---|---|
sleap/instance.py |
Modified Instance class to make frame attribute private; introduced InstancesList class to manage instance lists. |
tests/test_instance.py |
Added import statements, including from typing import List , and updated test functions for InstancesList functionality. |
sequenceDiagram
participant User
participant LabeledFrame
participant InstancesList
participant Instance
User->>LabeledFrame: Add Instance
LabeledFrame->>InstancesList: Add Instance to List
InstancesList->>Instance: Set Instance Frame
Instance-->>InstancesList: Instance Frame Set
InstancesList-->>LabeledFrame: Instance Added
LabeledFrame-->>User: Instance Added Successfully
In the world of frames and instance ties, A rabbit smiles, swift and wise. With lists of instances in tow, The code now takes a smoother flow. Tests are ready, the stage is set, For sleeker sleap, you can bet! 🐰✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Attention: Patch coverage is 96.77419%
with 2 lines
in your changes missing coverage. Please review.
Project coverage is 74.17%. Comparing base (
7ed1229
) to head (5b3ef99
). Report is 15 commits behind head on develop.
Files | Patch % | Lines |
---|---|---|
sleap/instance.py | 96.77% | 2 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Description
This PR proposes a custom data structure (sub-classed from
list
) to handle the back reference attributeInstance.frame
namely forLabeledFrame.instances
.This also solves the error we were getting of when trying to double click a
PredictedInstance
that was predicted on an already existingLabeledFrame
. During the merge process, thePredictedInstance.frame
is set toNone
, https://github.com/talmolab/sleap/blob/bbe124666781ef6f72931cfe17df5f1d5a96ba54/sleap/instance.py#L1703-L1704but then when extending the
LabeledFrame.instances
list, no care is taken to handle updating thePredictedInstance.frame
attribute. https://github.com/talmolab/sleap/blob/bbe124666781ef6f72931cfe17df5f1d5a96ba54/sleap/instance.py#L1733-L1734Hence, the error:
This issue is only noticeable after merging in:
1568
Types of changes
Does this address any currently open issues?
[list open issues here]
Outside contributors checklist
Thank you for contributing to SLEAP!
:heart:
Summary by CodeRabbit
New Features
InstancesList
class for managing lists of instances within a labeled frame.Bug Fixes
Tests
InstancesList
and updated relevant test functions to ensure robustness.Refactor
Instance
andLabeledFrame
classes to improve internal handling of instances.