nwb-conversion
できること
このツールは、神経科学の実験データを、NWBと呼ばれる標準的なフォーマットに変換します。特に顕微鏡画像と移動データについて、時刻などの重要な情報が正しく保存されるようにします。
使う場面
- ✓顕微鏡画像(TIFF)と行動の位置データ(CSV)を変換したいとき。
- ✓画像と移動データの時刻を同期させる必要があるとき。
- ✓共有や今後の分析に向けて、実験データを整理・検証したいとき。
スキルのリンク
https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/nwb-conversion/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“TIFFの画像ファイルとCSVの位置データを、NWB形式に変換してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
このツールは、NeuroConvとPyNWBというプログラムを使って、画像ファイルと行動データを読み込みます。2種類のデータの時刻を揃え、内容に問題がないかを確認したうえで、NWB形式で保存します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Validated NWB conversion
Supported streams
The executable workflow covers two explicit input streams in one session:
| Input | NWB representation | Tested constraints |
|---|---|---|
| Two-photon grayscale multi-page TIFF + frame timestamps CSV | Acquisition TwoPhotonSeries named Imaging through NeuroConv |
One channel, one plane, one 2D image per page, fixed shape and dtype |
Calibrated position CSV (time_s,x,y) |
Behavior Position / SpatialSeries through PyNWB |
Coordinates in m, cm or mm; converted to meters without temporal resampling |
Other acquisition readers require their own format-specific tests. In particular, this helper does not decode SpikeGLX, Open Ephys, multichannel TIFF, volumetric TIFF, compressed video, or pixel-to-world calibration. Do not rename an arbitrary numeric table to a supported stream.
Install the tested environment
uv venv --python 3.12 nwb-env
uv pip install --python nwb-env/bin/python 'neuroconv[tiff]==0.10.2' pynwb==4.2.0 \
nwbinspector==0.7.2 roiextractors==0.10.0 tifffile==2026.9.20 \
zarr==2.18.7 hdmf-zarr==0.11.3
Keep both Zarr pins even for an HDF5-only conversion: NeuroConv 0.10.2 imports its backend
configuration modules at startup, and the tested unconstrained Zarr 3.4.0 installation failed on
zarr.codec_registry. The pinned environment ran the real conversion, PyNWB validation and
Inspector successfully on macOS ARM64. The dependency resolver supplies NumPy and HDF5 support.
These are compatibility pins, not claims that Zarr 2 and hdmf-zarr 0.11.3 are the latest releases.
Current interface checks and the tested dependency exception are recorded in
references/upstream-review.md.
Workflow
- Inventory the actual inputs and acquisition metadata. Identify image plane/channel, optical settings, subject/session identifiers, timezone, behavior coordinate system, units and the timestamp clock for every stream. Preserve originals. Do not replace missing metadata with plausible defaults from a sample config.
- Copy assets/session-template.json beside the raw data and replace the explicitly synthetic values. Paths resolve from that JSON file. Read references/input-contract.md for the exact CSV and metadata contract and the pulse-pair variant. TIFF pixels are retained as acquired; a raw arbitrary-unit intensity does not become a photon count merely by changing its unit label.
- Establish the common timebase from acquisition evidence. Frame timestamps must already be reference-clock seconds since the timezone-aware session start. For position, provide either a documented shared clock or matched synchronization pulses. The helper fits one affine clock transform, checks its residual against a specified tolerance, and refuses extrapolation beyond the pulse range. It never estimates synchronization from coincident-looking neural/behavioral signals. Clock resets or nonlinear drift require an explicitly validated piecewise mapping.
- Execute the converter. Inputs must have finite, strictly increasing timestamps and matching image/timestamp counts. Explicitly declare one channel and one plane; known TIFF channel/plane metadata must agree. Grayscale pages alone cannot exclude undocumented interleaving. The acquisition samples stay intact; only coordinate units and, when evidenced, behavior timestamps are transformed.
- Read the
.validation.jsonalongside the NWB file. Schema compliance, Inspector findings and data equality answer different questions. The script exits with an error for schema failures and flags critical Inspector findings for review in the report. Review all findings in context; successful validation cannot establish that anatomical labels, pulse pairing or calibration supplied by the user are correct. - Deliver the NWB, validation JSON, original conversion config and an explanation of remaining metadata gaps or Inspector findings. No upload or archive submission is part of this workflow.
Execute
Run the following from the skill directory, with paths to the actual analysis files:
nwb-env/bin/python scripts/convert_session.py /path/to/session.json --output /path/to/session.nwb
nwb-env must point to the environment created above; the absolute example input paths are
…
よくある質問
どのデータ形式に対応していますか?
グレースケールの2光子顕微鏡画像(1ページのTIFF)とそのフレームのタイムスタンプ、そしてタイムスタンプ付きのCSV形式の行動位置データに対応しています。
他のファイル形式も変換できますか?
いいえ、このツールは上記のTIFFとCSVの形式専用です。SpikeGLX、Open Ephys、動画などの形式には対応していません。
時刻が一致しない場合はどうなりますか?
ツールは時刻を揃えようとし、そのずれが許容範囲内かどうかを確認します。大きな問題がある場合や情報が不足している場合は、処理が失敗するか、手動での修正が必要という警告が出ることがあります。
詳細
作者による元の説明
Converts neuroscience acquisition data to Neurodata Without Borders files with NeuroConv and PyNWB, preserves metadata and timebases, checks evidence-based clock alignment, and produces schema validation, NWB Inspector findings and round-trip checks. Use for NWB conversion and synchronization of planar single-channel two-photon TIFF imaging plus timestamped behavioral position CSV; this skill does
人気
- GitHubのスター
- 51k
- ランキング
- #3508
- ライセンス
- MIT
- 更新日
- 2026/10/15
コメント
- …
このリポジトリの他のスキル
13c-metabolic-flux
51k炭素13同位体トレーシングのデータを使って代謝フラックスを推定します。細胞の代謝や生化学経路の分析に役立ちます。
adaptyv
51kAdaptyv APIを使ってタンパク質の特性評価実験を設計します。コストの見積もり、配列の提出、ラボの結果の監視を支援します。
aeon
51k時系列データに対して機械学習のタスクを実行します。逐次データの分類、予測、異常検知、パターンの発見に役立ちます。
alphagenome
51k遺伝的変異に対して、事前に計算されたゲノム上の効果を検索します。スコアと説明を提供し、変異がゲノムに与える影響を理解するのに役立ちます。
似ているスキル
discrawl
394k保存済みのローカルなDiscordメッセージのアーカイブを検索して要約し、その新しさを確認し、ダイレクトメッセージを読めるようエージェントを支援します。
clickhouse-io
280kエージェントがClickHouseデータベースのクエリとスキーマを最適化できるようにします。高性能な分析処理向けのベストプラクティスを適用します。分析クエリが遅すぎるときに使います。
scientific-db-pubmed-database
280kエージェントが生物医学分野の科学論文を検索するのに役立ちます。特定の医療情報が必要な研究に便利です。