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

Write SLP files #55

Merged
merged 16 commits into from
Jul 25, 2023
Merged

Write SLP files #55

merged 16 commits into from
Jul 25, 2023

Conversation

talmo
Copy link
Contributor

@talmo talmo commented Jul 21, 2023

This PR implements functionality to save Labels to .slp files compatible with core SLEAP.

This implementation aims to create .slp files that are nearly* identical to those produced in SLEAP v1.3.1 and FORMAT_ID = 1.2 for compatibility.

Eventually, this library will replace all of the IO modules in core SLEAP and will implement more flexible serialization formats (with legacy support).

*Because we don't load all of the same metadata as stored in SLEAP legacy files, we can't save it with byte-level equivalence. This is mostly stuff that doesn't matter or isn't used. Currently this includes:

  • Internal order of nodes and edges in the underlying networkx graph (order in Skeleton.nodes and Skeleton.edges are preserved)
  • Node weights (not used in legacy SLEAP anyway)
  • Track.spawned_on attribute
  • Suggestions
  • Video backends not yet supported in sleap-io

Closes: #30

Note that this currently doesn't handle .pkg.slp files or saving embedded images just yet, but we'll handle that in the next PR.

@codecov
Copy link

codecov bot commented Jul 21, 2023

Codecov Report

Merging #55 (e6a7e06) into main (ae61fb9) will increase coverage by 0.34%.
The diff coverage is 97.76%.

@@            Coverage Diff             @@
##             main      #55      +/-   ##
==========================================
+ Coverage   94.43%   94.77%   +0.34%     
==========================================
  Files          12       12              
  Lines        1060     1187     +127     
==========================================
+ Hits         1001     1125     +124     
- Misses         59       62       +3     
Impacted Files Coverage Δ
sleap_io/__init__.py 100.00% <ø> (ø)
sleap_io/io/main.py 94.73% <50.00%> (-5.27%) ⬇️
sleap_io/io/slp.py 97.70% <98.14%> (+0.36%) ⬆️
sleap_io/io/utils.py 100.00% <100.00%> (ø)
sleap_io/io/video.py 83.55% <100.00%> (+0.37%) ⬆️
sleap_io/model/skeleton.py 100.00% <100.00%> (ø)

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

@talmo talmo marked this pull request as ready for review July 21, 2023 18:13
@talmo talmo requested a review from roomrys July 21, 2023 18:14
@talmo talmo merged commit df1cff4 into main Jul 25, 2023
9 checks passed
@talmo talmo deleted the talmo/write_slp branch July 25, 2023 08:46
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.

No way to save labels to *.slp file
1 participant