sleap.io.format.nix#

class sleap.io.format.nix.NixAdaptor[source]#

Adaptor class for export of tracking analysis results to the generic [NIX](g-node/nix) format. NIX defines a generic data model for scientific data that combines data and data annotations within the same container. The written files are hdf5 files that can be read with any hdf5 library but follow the entity definitions of the NIX data model. For reading nix-files with python install the nixio low-level library `pip install nixio` or use the high-level api [nixtrack](bendalab/nixtrack).

So far the adaptor exports the tracked positions for each node of each instance, the track and skeleton information along with the respective scores and the centroid. Additionally, the video information is exported as metadata. For more information on the mapping from sleap to nix see the docs on [nixtrack](bendalab/nixtrack) (work in progress). The adaptor uses a chunked writing approach which avoids numpy out of memory exceptions when exporting large datasets.

author: Jan Grewe (jan.grewe@g-node.org)

property all_exts: List[str]#

List of all file extensions supported by adaptor.

classmethod can_read_file(file: FileHandle) bool[source]#

Returns whether this adaptor can read this file.

can_write_filename(filename: str) bool[source]#

Returns whether this adaptor can write format of this filename.

property default_ext#

The default file extension, e.g., ‘json’ (without ‘.’).

classmethod does_read() bool[source]#

Returns whether this adaptor supports reading.

classmethod does_write() bool[source]#

Returns whether this adaptor supports writing.

property handles#

Returns the type of object that can be read/written.

The Dispatch class calls this method on all registered adaptors to determine which to use for reading/writing.

property name: str#

Human-reading name of the file format

classmethod read(file: FileHandle) object[source]#

Reads the file and returns the appropriate deserialized object.

classmethod write(filename: str, source_object: object, source_path: Optional[str] = None, video: Optional[Video] = None)[source]#

Writes the object to a file.