Closed roomrys closed 1 month ago
The changes encompass the introduction of a new SkeletonDecoder
class for improved decoding of skeleton data, including nodes and edges, while replacing previous decoding methods. The DockWidget
class in the GUI has been updated to utilize this new decoder for handling preview images. Additionally, a new JSON file representing a fly's skeletal structure has been added, along with corresponding test fixtures and modifications to existing tests to validate the new functionality.
Files | Change Summary |
---|---|
sleap/gui/widgets/docks.py |
Updated DockWidget to use SkeletonDecoder.decode_preview_image for decoding preview images. |
sleap/skeleton.py |
Introduced SkeletonDecoder class, which replaces jsonpickle.decode with custom methods for decoding skeleton data, including nodes, edges, and preview images. |
sleap/util.py |
Removed unused imports and the decode_preview_image function, streamlining the codebase. |
tests/data/skeleton/fly_skeleton_legs_pystate_dict.json |
Added a JSON file defining a directed multigraph for a fly's skeletal structure, including nodes and links. |
tests/fixtures/skeletons.py |
Added new fixture fly_legs_skeleton_dict_json for testing, providing a path to the new JSON file. |
tests/test_skeleton.py |
Modified tests to use SkeletonDecoder , added tests for decoding preview images and validating the SkeletonDecoder functionality. |
tests/test_util.py |
Removed the test_decode_preview_image function, which was redundant following the refactor. |
Objective | Addressed | Explanation |
---|---|---|
Validate new decoding mechanism | ✅ | |
Ensure proper handling of preview images | ✅ |
MultiView Stack
In the garden where the data flows,
A rabbit hops where the skeleton grows.
With a decoder bright, it shows the way,
To images and nodes, we cheer and play!
Hopping high, our code's a delight,
With every change, we take flight! 🐇✨
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 98.07692%
with 2 lines
in your changes missing coverage. Please review.
Project coverage is 75.40%. Comparing base (
7ed1229
) to head (6a4647d
). Report is 52 commits behind head on develop.
Files with missing lines | Patch % | Lines |
---|---|---|
sleap/skeleton.py | 98.01% | 2 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Description
It has become apparent that it will be safer for us to handle (de)serialization of our data structures internally rather than relying on external libraries such as
cattr
andjsonpickle
to do this for us. Without constraining these (de)serialization dependencies (which may also cause other upgrade/dependency constraints elsewhere), we cannot expect that the format of (de)serialization will be backwards compatible within (even the same!) version of SLEAP (albeit installed at different times).Keeping with the theme above, this PR is the first of many that starts migrating (de)serialization to internal SLEAP code. In this PR, we add a function to replace
jsonpickle.decode
which is intended to be used onjsonpickle.encode
dSkeleton
s.Types of changes
Does this address any currently open issues?
1841
1918
1934
Outside contributors checklist
Thank you for contributing to SLEAP!
:heart:
Summary by CodeRabbit
New Features
SkeletonDecoder
class for enhanced decoding of skeleton data and preview images.Bug Fixes
Tests
SkeletonDecoder
and decoding preview images to ensure functionality.