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

Fix multi-skeleton loading #79

Merged
merged 3 commits into from
Apr 14, 2024
Merged

Fix multi-skeleton loading #79

merged 3 commits into from
Apr 14, 2024

Conversation

talmo
Copy link
Contributor

@talmo talmo commented Apr 14, 2024

Fix multi-skeleton loading (#71)

Summary by CodeRabbit

  • Refactor

    • Improved the naming in skeleton node creation to enhance clarity and ensure correct node ordering.
  • Tests

    • Added tests for loading multiple skeletons from a single file to verify the accuracy of skeleton data handling.

Copy link
Contributor

coderabbitai bot commented Apr 14, 2024

Walkthrough

The recent updates focus on enhancing the read_skeletons function in sleap_io by refining variable naming for clarity and ensuring correct node order. Additionally, a new test ensures the robust handling of multiple skeletons, verifying node names, edge indices, and node configurations.

Changes

Files Change Summary
sleap_io/io/slp.py Renamed node_names to sorted_node_names in read_skeletons to ensure correct node ordering.
tests/io/test_slp.py Added test_load_multi_skeleton to verify loading of multiple skeletons from a single file.

Possibly related issues

Poem

🐇 Oh hoppy day, for code we refine,
🌟 With names so clear, in lines they align.
Each node and edge, now checked with care,
Tests run with glee, no error to spare.
🎉 Celebrate the code, so spry and neat,
In SLEAP we trust, our tasks complete!


Recent Review Details

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 304a9d8 and e760cbd.
Files selected for processing (2)
  • sleap_io/io/slp.py (1 hunks)
  • tests/io/test_slp.py (1 hunks)
Additional comments not posted (2)
tests/io/test_slp.py (1)

191-216: The new test test_load_multi_skeleton correctly sets up two skeletons, writes them to a file, and asserts their properties after loading. This test is crucial for verifying the functionality of loading multiple skeletons.

sleap_io/io/slp.py (1)

210-214: The renaming of node_names to sorted_node_names in the read_skeletons function is a critical change to ensure that nodes are created in the correct order. This change aligns with the PR's objective to fix multi-skeleton loading issues.


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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Apr 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.79%. Comparing base (304a9d8) to head (e760cbd).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #79   +/-   ##
=======================================
  Coverage   94.79%   94.79%           
=======================================
  Files          13       13           
  Lines        1498     1498           
=======================================
  Hits         1420     1420           
  Misses         78       78           

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

@talmo talmo linked an issue Apr 14, 2024 that may be closed by this pull request
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Actionable comments outside the diff hunks (13)
tests/io/test_slp.py (10)

Line range hint 4-4: Consider removing the unused import sleap_io.Video.

- from sleap_io import (
-     Video,
+ from sleap_io import (

Line range hint 6-6: Consider removing the unused import sleap_io.Edge.

-     Edge,

Line range hint 9-9: Consider removing the unused import sleap_io.LabeledFrame.

-     LabeledFrame,

Line range hint 10-10: Consider removing the unused import sleap_io.Track.

-     Track,

Line range hint 11-11: Consider removing the unused import sleap_io.Point.

-     Point,

Line range hint 12-12: Consider removing the unused import sleap_io.PredictedPoint.

-     PredictedPoint,

Line range hint 24-24: Consider removing the unused import sleap_io.io.slp.serialize_skeletons.

-     serialize_skeletons,

Line range hint 28-28: The import sleap_io.io.slp.read_instances is redefined and unused. Consider removing it.

-     read_instances,

Line range hint 52-52: Use isinstance() for type checking instead of direct type comparison.

-    assert type(labels) == Labels
+    assert isinstance(labels, Labels)

Line range hint 183-183: Use isinstance() for type checking instead of direct type comparison.

-    assert type(provenance) == dict
+    assert isinstance(provenance, dict)
sleap_io/io/slp.py (3)

Line range hint 26-26: Consider removing the unused import sleap_io.io.utils.write_hdf5_dataset.

-     write_hdf5_dataset,

Line range hint 27-27: Consider removing the unused import sleap_io.io.utils.write_hdf5_group.

-     write_hdf5_group,

Line range hint 28-28: Consider removing the unused import sleap_io.io.utils.write_hdf5_attrs.

-     write_hdf5_attrs,

@talmo talmo merged commit 12b15fa into main Apr 14, 2024
9 checks passed
@talmo talmo deleted the talmo/fix-multiskel-loading branch April 14, 2024 04:00
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.

Loading file with multiple skeletons destroys node name list
1 participant