JABS IO (jabs-io)
This package handles all serialization/deserialization logic.
Overview
jabs-io decouples the JABS data representation from specific file formats or legacy
versions. It provides a unified way to interact with pose estimation data, behavioral
features, and annotations.
API
The package provides a high level API that's intended to cover most use-cases.
from jabs.io import save, load
from jabs.core.types.keypoints import FrameKeypoints
data_instance = load('frames.json', FrameKeypoints)
save(data_instance, 'frames.parquet')
Installation extras
jabs-io ships optional extras for format-specific backends:
| Extra | Installs | Enables |
|---|---|---|
nwb |
pynwb, ndx-pose |
NWB pose file read/write |
parquet |
pyarrow |
Parquet feature cache I/O |
HDF5 is not an extra: h5py is a required dependency, since pose files, prediction
files and the default feature cache are all HDF5. pyarrow is a direct dependency of
jabs-behavior-classifier, so the parquet backend is available automatically when
jabs-io is installed as part of the full JABS application. The nwb extra must
always be installed explicitly:
pip install "jabs-behavior-classifier[nwb]"
When using jabs-io as a standalone library:
pip install "jabs-io[nwb,parquet]"
Development
Data models are defined as dataclasses in jabs-core: jabs.core.types. Some backends
will be able to implicitly handle most dataclasses, but if the dataclass is
complicated, or if there is special handling required of the type for a backend, then a
type specific adapter should be defined.
All adapters must inherit from jabs.io.base.Adapter.
For convenience, backend specific subclasses are provided that handle shared functionality for specific file backends.
from jabs.io.base import (
JSONAdapter,
ParquetAdapter,
# TODO: HDF5Adapter,
)
To register your adapter for use, use the register adapter decorator.
from jabs.core.enums import StorageFormat
from jabs.io.base import JSONAdapter
from jabs.io.registry import register_adapter
@register_adapter(StorageFormat.JSON)
class DataclassJSONAdapter(JSONAdapter):
...
Future Work
- NWB: segmentation data roundtrip —
PoseData.segmentation_datais not currently stored by the NWB adapter. If possible, we might want to consider writing it as an additionalTimeSeriesin the behavior processing module (similar tojabs_identity_mask) so it survives a write/read roundtrip.
Metadata
Release files for jabs-io 0.47.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| jabs_io-0.47.0.tar.gz | 38.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jabs_io-0.47.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 89.9 kB
Release files / jabs_io-0.47.0.tar.gz
| Download URL | jabs_io-0.47.0.tar.gz |
|---|---|
| Size | 38.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7ce52ed951954d3feaac30116c0d7b0bdab527ec0011d513bdd26c3e1d0605dc
|
|
BLAKE2b-256 checksum How to use checksums |
5b11a3bf6ddc3d8a3f306655376ed5591e1cfe5652d17d79f114c9c6a717f5a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / jabs_io-0.47.0-py3-none-any.whl
| Download URL | jabs_io-0.47.0-py3-none-any.whl |
|---|---|
| Size | 51.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a347d36abb389bb2039225ea1647eba7a2d05ca1bec9d701445cb3b3ca1c1749
|
|
BLAKE2b-256 checksum How to use checksums |
a1093a02b27bbf1ff7b1b4368d94819f21ba804b55465429436892f6d41170c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|