nmrglue
できること
このツールは、1次元の核磁気共鳴(NMR)の生データを処理して、より見やすいスペクトルを作成したり、ピークを特定したり、積分面積を計算したりします。周波数軸(ppm)の確認や調整、フィルターの適用、ベースラインの補正にも役立ちます。
使う場面
- ✓1次元NMRの生データがあり、使えるスペクトルに変換したいとき。
- ✓NMRスペクトルの位相やベースラインを調整したいとき。
- ✓NMRスペクトルから正確なピーク面積の値を得たいとき。
スキルのリンク
https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/nmrglue/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“この1次元NMRデータファイル(fid.npz)を、設定ファイル(processing.json)の条件で処理して、結果を「my_spectrum」として保存してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
このツールは、NMRの生データと、パラメータを記載した設定ファイルを読み込みます。フーリエ変換などの数学的な変換を適用し、スペクトルの品質を高めるための調整を行ったうえで、ピークや面積などの情報を取り出します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
nmrglue: calibrated 1D FID processing
When to use
Use for a uniformly sampled complex 1D FID whose acquisition parameters and complex frequency convention are available. The helper produces a descending ppm spectrum, positive peak candidates, signed region integrals, and a reproducible processing report. It does not identify compounds or assign resonances.
The executable accepts a NumPy .npz containing exactly one complex fid array or a
canonical 1D complex time-domain NMRPipe file. NMRPipe reading is tested with a synthetic
write/read round trip, known-spectrum recovery, and a small upstream NMRPipe-generated
binary fixture. Experimental Bruker, Varian, and JEOL
imports are not verified by this suite. For those formats, first inspect the relevant
nmrglue reader and acquisition metadata. Opening a converted file does not validate the
original acquisition decoding.
Read references/acquisition-and-validation.md
for conversion boundaries, axis calibration, and quantitative limits.
Workflow
- Preserve the raw FID. Establish spectral width in Hz, positive observation frequency in MHz, carrier in ppm, observed nucleus, and the sign convention from the acquisition or a known reference. Determine whether digital-filter/group-delay removal has already occurred. Do not infer these from array length or typical instrument defaults.
- Copy assets/processing.json and replace its synthetic example
values with the measured parameters and explicit processing choices. Its sign
-imeans a resonance at offsetf = (ppm - carrier_ppm) * observation_mhzhas time dependenceexp(-2*pi*i*f*t). Select+ionly for the opposite convention; the helper conjugates it before processing. Validate with a known reference peak. - Choose nonnegative exponential line broadening (Hz), an even zero-filled size at
least as large as the acquired FID, first-point scaling, and phase angles.
Zero filling improves interpolation, not acquired spectral resolution.
First-point scaling
0.5is suitable for the supplied causal synthetic example; acquisition and prior preprocessing may require another value. - Run the helper, inspect the real and imaginary spectra, and revise manual phase if
needed.
phase0_deg + phase1_deg * index / zero_fill_pointsis applied after FT; index zero is the high-ppm edge. There is no implicit pivot or automatic phase estimate. - Only fit a linear baseline when explicitly supplied ppm regions are signal-free.
Set
baselinetolinearand addbaseline_regions_ppmcontaining at least two regions. Inspect residuals and broad peaks; fitting through signals biases integrals. - Compare peak positions with references, inspect peak candidates for artifacts, and integrate specified regions. Report overlapped peaks as overlapped. Preserve negative areas as diagnostic evidence of phase/baseline problems instead of taking absolute values.
Execute
Tested with Python 3.12, nmrglue 0.12, NumPy 2.5.3, and SciPy 1.18.1:
uv run --no-project --python 3.12 --with nmrglue==0.12 --with numpy==2.5.3 --with scipy==1.18.1 \
python skills/nmrglue/scripts/process_1d.py fid.npz processing.json nmr-result
Paths assume the collection root. Adjust them when installed elsewhere. The output directory must be new, so repeated processing keeps previous results reviewable.
For an existing 1D NMRPipe FID, add --input-format nmrpipe and supply its path in place
of fid.npz. The helper requires the canonical FDF2 direct dimension, complex quadrature,
a time-domain flag, and agreement between header and JSON spectral width, observation
frequency, and carrier. JSON settings remain explicit; a mismatch fails instead of silently
recalibrating. FDF2TDSIZE must equal the stored complex-point count, and FDF2CENTER /
FDF2ORIG must describe a canonical centered axis. Previously zero-filled, truncated,
or recentered files need a separate acquisition-aware workflow. The nucleus/complex sign
and previous digital-filter corrections still need acquisition evidence. A time-domain
flag alone does not establish an unprocessed FID.
This executable synthetic example matches the supplied settings, generates resonances at 3 and 7 ppm in a 1:2 amplitude ratio, and does not represent an experimental sample:
import numpy as np
t = np.arange(8192) / 4000.0
fid = sum(a * np.exp(-np.pi * 2.0 * t)
…
よくある質問
このツールで化合物を特定できますか?
いいえ、化合物の特定はできません。このツールは生データを処理し、分析や解釈ができる状態にするためのものです。
2次元や3次元のNMRデータにも使えますか?
いいえ、このツールは1次元NMRデータ専用です。
「ppm」と「FID」とは何ですか?
ppm(百万分率)は、NMRスペクトル上でシグナルの位置を表す単位です。FID(自由誘導減衰)は、処理前にNMR装置が測定した生の信号のことです。
詳細
作者による元の説明
Processes calibrated one-dimensional complex NMR free-induction decays with nmrglue into phased spectra, peak candidates, and signed integration regions. Use for raw 1D NMR processing, ppm-axis verification, apodization, Fourier transformation, manual phasing, baseline correction, or reproducible spectral integration.
人気
- GitHubのスター
- 51k
- ランキング
- #3507
- ライセンス
- MIT
- 更新日
- 2026/10/15
コメント
- …
このリポジトリの他のスキル
13c-metabolic-flux
51k炭素13同位体トレーシングのデータを使って代謝フラックスを推定します。細胞の代謝や生化学経路の分析に役立ちます。
adaptyv
51kAdaptyv APIを使ってタンパク質の特性評価実験を設計します。コストの見積もり、配列の提出、ラボの結果の監視を支援します。
aeon
51k時系列データに対して機械学習のタスクを実行します。逐次データの分類、予測、異常検知、パターンの発見に役立ちます。
alphagenome
51k遺伝的変異に対して、事前に計算されたゲノム上の効果を検索します。スコアと説明を提供し、変異がゲノムに与える影響を理解するのに役立ちます。
似ているスキル
gitcrawl
394k保存されたGitHubのイシューとプルリクエストのアーカイブを検索し、重複をまとめ、GitHub上の現在の状態を確認するようエージェントを支援します。
slacrawl
394kローカルのSlackアーカイブ内のメッセージを検索して件数を数え、アーカイブの新しさを確認し、必要に応じて更新するようエージェントを支援します。
goplaces
394kGoogle Placesを使って、場所を検索し、詳細や口コミを取得し、場所の名前を解決するようエージェントを支援します。スクリプト用にJSON出力もできます。