Add option to export to CSV via `sleap-convert` and API
It would be convenient to be able to export predictions stored in .SLP files to .CSV (see linked discussion).
Enhancement plan
- Add
csvas an option for the--formatflag in thesleap-convertCLI here:
https://github.com/talmolab/sleap/blob/2d24296c2149402c7ee07601e4d0272fdd308441/sleap/io/convert.py#L67-L75
- If csv format is requested, use
csv=Truein thesleap-convertCLI entrypoint function:
https://github.com/talmolab/sleap/blob/2d24296c2149402c7ee07601e4d0272fdd308441/sleap/io/convert.py#L165-L172
- The CSV writing is already handled through the IO format backends, so we can just route it through by adding
csvas an option in the actual analysis exporting writer:
https://github.com/talmolab/sleap/blob/2d24296c2149402c7ee07601e4d0272fdd308441/sleap/io/convert.py#L177-L181
Discussed in https://github.com/talmolab/sleap/discussions/1629
Originally posted by talmo December 7, 2023 In #1438, we added a feature to export tracks to CSV format from the GUI.
It would be great to be able to do that via the sleap-export CLI and the Labels.export() API.
For sleap-export, we just need to add CSV as a target format and pass in csv=True in the export call here.
For Labels.export(), we probably want to extend what's going on here.
We should also be sure to support the new functionality being added in #1624.
Relevant: #1627