Murine Shift Work session data IO: file codec, namespace utilities, and session readers.
Provides a lean, installable library for reading and writing MSW session data without
requiring the full murineshiftwork acquisition stack. Install it in analysis
environments where you only need to load sessions, not run them.
- Session readers - load MSW session data (JSONL, PKL, YAML) into structured
MswSessionmodels - Namespace utilities - build and parse MSW session paths from the canonical
subject__datetime__taskspec - IO codec - save and load trial data with numpy/tuple encoding
- Standalone - no dependency on the
murineshiftworkacquisition stack
pip install msw-iofrom murineshiftwork.readers import load_session
session = load_session("/data/mouse_01/session__20260514_143022_123456__gonogo")
print(session.subject, session.task, session.n_trials)Load an entire acquisition (all sessions in a container directory):
from murineshiftwork.readers import load_acquisition
sessions = load_acquisition("/data/mouse_01/session__20260514_143022_123456__session_gonogo")
for s in sessions:
print(s.basename, s.is_complete)Generate session paths for a new recording:
from murineshiftwork.namespace import generate_session_paths
paths = generate_session_paths("mouse_01", "gonogo", "/data", printout=False)
print(paths["session_folder"])msw-io-migrate (or msw data migrate with msw-core installed) renames data in
older namespace shapes to the current one, in place. It is a dry run unless
--apply is given:
msw-io-migrate /data --audit
msw-io-migrate /data --level all --report migrate_dry_run.json
msw-io-migrate /data --level all --apply --report migrate_applied.json
msw-io-migrate /data --auditSee the namespace migration page.
msw data validate PATH... checks session containers and acquisitions (or a
tree holding them); exit status 0 when all are valid, 1 on any issue.
Full documentation including API reference: https://murineshiftwork.github.io/msw-io