Closed roomrys closed 7 months ago
The recent updates across multiple files in the SLEAP project focus on refining the codebase by enhancing representation methods, streamlining data handling processes, and improving integration tests. Changes include the removal of redundant code, simplification of data structures, and addition of new test fixtures to ensure robustness in multi-view session handling.
File Path | Change Summary |
---|---|
.../cameras.py , .../labels_json.py |
Enhanced __repr__ methods, streamlined instance and session handling, removed unused logging. |
.../dataset.py |
Simplified data indexing in to_dict , updated return type in load_file . |
.../hdf5.py |
Reorganized imports, modified data deserialization for better session and frame group handling. |
.../fixtures/datasets.py |
Added new fixture for testing minimal session frame groups. |
.../test_cameras.py |
New integration test for session, frame group, and instance group handling; updated representation tests. |
🐇✨ In the code's garden, fresh changes bloom, Refining the flow, giving bugs less room. A rabbit hops through, with a code-filled cheer, Celebrating the updates, so crisp and clear. Hop, hop, hooray, for the code so bright, Under the moon's soft, silvery light. 🌟🐰
sleap/io/cameras.py (7)
79-79: f-string without any placeholders --- 80-80: f-string without any placeholders --- 81-81: f-string without any placeholders --- 448-448: Undefined name `Skeleton` --- 601-601: Undefined name `Skeleton` --- 828-828: Do not use bare `except` --- 1002-1002: Undefined name `Labels`sleap/io/dataset.py (16)
55-55: Redefinition of unused `Callable` from line 45 --- 61-61: `h5py` imported but unused --- 69-69: Do not use bare `except` --- 70-70: `typing._ForwardRef` imported but unused --- 365-365: Do not assign a `lambda` expression, use a `def` --- 367-370: Do not assign a `lambda` expression, use a `def` --- 372-375: Do not assign a `lambda` expression, use a `def` --- 934-934: Do not compare types, use `isinstance()` --- 1454-1454: Do not compare types, use `isinstance()` --- 2359-2359: Undefined name `glob` --- 2454-2454: Avoid equality comparisons to `False`; use `if not ret:` for false checks --- 2542-2542: Avoid equality comparisons to `False`; use `if not ret:` for false checks --- 2557-2557: Undefined name `sleap` --- 2647-2647: Do not compare types, use `isinstance()` --- 2650-2650: Local variable `e` is assigned to but never used --- 2652-2652: f-string without any placeholderssleap/io/format/labels_json.py (6)
154-154: Local variable `ex` is assigned to but never used --- 224-224: Local variable `ex` is assigned to but never used --- 379-379: Do not compare types, use `isinstance()` --- 404-404: Do not use bare `except` --- 408-408: Do not use bare `except` --- 428-428: Local variable `new_skel` is assigned to but never usedtests/fixtures/datasets.py (1)
1-1: `os` imported but unused
tests/fixtures/datasets.py (1)
`291-296`: The new fixture `multiview_min_session_frame_groups` is correctly implemented and follows the established pattern for loading label files.tests/io/test_cameras.py (3)
`322-358`: Verify the logic for adding instances to frame and instance groups. Ensure that the logic correctly handles the scenarios where no labeled frames are found (line 346) and properly adds instances to the correct groups (line 352-357). --- `359-366`: Check the assertions for correctness. Confirm that the assertions (lines 359-366) accurately test the expected outcomes of the operations performed in the test, such as the correct number of frame groups and instance groups, and the expected number of instances in each group. --- `368-394`: Review the save and load functionality of labels. Ensure that the labels are correctly saved to and loaded from a temporary file (lines 368-394), and that the integrity of the data is maintained throughout this process.
Attention: Patch coverage is 88.23529%
with 4 lines
in your changes are missing coverage. Please review.
Project coverage is 73.49%. Comparing base (
b1d2372
) to head (37ed92a
).
Files | Patch % | Lines |
---|---|---|
sleap/io/format/hdf5.py | 85.71% | 4 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Note: the mac test is failing because of the rollout of macos-14 (M1) to replace macos-latest. Previously, we were using a non-GPU mac runner, but the m1 runner is breaking some of our tests (from trying to switch to CPU only during runtime). A PR was already merged into develop to fix this in d4ad3.
Description
This PR adds a
Labels
fixture calledmultiview_min_session_frame_groups
which builds off ofmultiview_min_session_user_labels
to includeFrameGroup
s in theRecordingSession
where all user-labeledInstance
s are now in anInstanceGroup
.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
Bug Fixes
to_dict
method for better performance and reliability.Refactor
Tests