Skip to content

add jabs-cli command for converting jabs pose file to nwb pose file - #306

Merged
gbeane merged 12 commits into
mainfrom
feature/jabs-pose-to-nwb-command
Mar 10, 2026
Merged

add jabs-cli command for converting jabs pose file to nwb pose file#306
gbeane merged 12 commits into
mainfrom
feature/jabs-pose-to-nwb-command

Conversation

@gbeane

@gbeane gbeane commented Mar 4, 2026

Copy link
Copy Markdown
Collaborator

Add jabs-cli convert-to-nwb command

Summary

  • Adds a new convert-to-nwb subcommand to jabs-cli for converting JABS pose estimation files (any version, v2-v8) to NWB format
  • Implements the conversion logic in a new src/jabs/scripts/cli/convert_to_nwb.py module, separate from the Click command wiring in cli.py
  • leverages new PoseData->nwb adapter from jabs.io
  • Adds per-file ruff ignores (D301, D412) for cli.py to allow Click's \b docstring escape convention for help text formatting

Usage

Convert to a single NWB file (all identities)

jabs-cli convert-to-nwb session_pose_est_v6.h5 session.nwb

Write one NWB file per identity

jabs-cli convert-to-nwb session_pose_est_v6.h5 session.nwb --per-identity

Override the NWB session description

jabs-cli convert-to-nwb session_pose_est_v6.h5 session.nwb --session-description "My experiment"

Notes

  • ndx-pose recomends one nwb file per subject. This is specified using the --per-identity option. We also support a non-standard format for including all mice in one nwb file. TODO: investigate ndx-multisubject instead (likely implemented as a follow up pull request).
  • Pose format version is auto-detected from the filename (e.g. _pose_est_v6.h5) via the existing open_pose_file factory — no need to specify the version manually
  • FPS, scale (cm_per_pixel), static objects, and external identity names are all read directly from the pose file; no manual overrides are needed or exposed
  • Optional attributes not present in older formats (static_objects, external_identities, cm_per_pixel) are handled with safe fallbacks so all versions convert cleanly

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a convert-to-nwb subcommand to the jabs-cli tool that converts JABS pose estimation HDF5 files (v2–v8) into NWB format. It separates the conversion logic into convert_to_nwb.py and wires it into the CLI via cli.py, and adds a ruff.toml per-file ignore entry to accommodate Click's \b docstring escape convention.

Changes:

  • Adds src/jabs/scripts/cli/convert_to_nwb.py with pose_to_pose_data and run_conversion helpers for converting PoseEstimation objects to PoseData and writing NWB files.
  • Registers the new convert-to-nwb Click command in cli.py, wiring up input_path, output, --per-identity, and --session-description parameters.
  • Updates ruff.toml with per-file linting ignores (D301, D412) for cli.py to allow Click's \b help-text formatting.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
src/jabs/scripts/cli/convert_to_nwb.py Core conversion logic: builds PoseData from any PoseEstimation object and calls jabs.io.save
src/jabs/scripts/cli/cli.py New convert-to-nwb Click command wired to run_conversion
ruff.toml Per-file ruff ignores to allow Click \b docstring formatting in cli.py

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/jabs/scripts/cli/cli.py Outdated
Comment thread src/jabs/scripts/cli/convert_to_nwb.py Outdated
Comment thread src/jabs/scripts/cli/convert_to_nwb.py
Comment thread src/jabs/scripts/cli/convert_to_nwb.py
Comment thread src/jabs/scripts/cli/cli.py Outdated
Comment thread src/jabs/scripts/cli/convert_to_nwb.py

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/jabs-io/src/jabs/io/internal/pose/nwb.py
Comment thread src/jabs/scripts/cli/cli.py Outdated
Comment thread src/jabs/scripts/cli/convert_to_nwb.py

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/jabs/scripts/cli/convert_to_nwb.py
Comment thread packages/jabs-io/src/jabs/io/internal/pose/nwb.py

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 15 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/jabs-core/src/jabs/core/types/pose.py
@gbeane
gbeane merged commit 982cc14 into main Mar 10, 2026
5 checks passed
@gbeane
gbeane deleted the feature/jabs-pose-to-nwb-command branch March 10, 2026 18:50
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.

5 participants