sleap icon indicating copy to clipboard operation
sleap copied to clipboard

Add option to export to CSV via `sleap-convert` and API

Open eberrigan opened this issue 1 year ago • 0 comments

It would be convenient to be able to export predictions stored in .SLP files to .CSV (see linked discussion).

Enhancement plan

  1. Add csv as an option for the --format flag in the sleap-convert CLI here:

https://github.com/talmolab/sleap/blob/2d24296c2149402c7ee07601e4d0272fdd308441/sleap/io/convert.py#L67-L75

  1. If csv format is requested, use csv=True in the sleap-convert CLI entrypoint function:

https://github.com/talmolab/sleap/blob/2d24296c2149402c7ee07601e4d0272fdd308441/sleap/io/convert.py#L165-L172

  1. The CSV writing is already handled through the IO format backends, so we can just route it through by adding csv as 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

eberrigan avatar Mar 17 '24 02:03 eberrigan