跳到正文
Skillpedia
分析与电子表格51k · #3507

nmrglue

它能做什么

这个工具用于处理原始的一维核磁共振(NMR)数据,生成更清晰的谱图、识别峰,并计算积分面积。它还能帮你检查和调整频率轴(ppm),应用滤波,并校正基线。

适用场景

  • ✓当你有原始的一维 NMR 数据,想把它转换成可用的谱图时。
  • ✓当你需要调整 NMR 谱图的相位和基线时。
  • ✓当你想从 NMR 谱图中获得准确的峰面积数值时。

技能链接

https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/nmrglue/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/nmrglue/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请使用这些设置(processing.json)处理这个一维 NMR 数据文件(fid.npz),并把结果保存为 '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

  1. 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.
  2. Copy assets/processing.json and replace its synthetic example values with the measured parameters and explicit processing choices. Its sign -i means a resonance at offset f = (ppm - carrier_ppm) * observation_mhz has time dependence exp(-2*pi*i*f*t). Select +i only for the opposite convention; the helper conjugates it before processing. Validate with a known reference peak.
  3. 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.5 is suitable for the supplied causal synthetic example; acquisition and prior preprocessing may require another value.
  4. Run the helper, inspect the real and imaginary spectra, and revise manual phase if needed. phase0_deg + phase1_deg * index / zero_fill_points is applied after FT; index zero is the high-ppm edge. There is no implicit pivot or automatic phase estimate.
  5. Only fit a linear baseline when explicitly supplied ppm regions are signal-free. Set baseline to linear and add baseline_regions_ppm containing at least two regions. Inspect residuals and broad peaks; fitting through signals biases integrals.
  6. 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)

…
常见问题

这个工具能识别化合物吗?

不能。这个工具不负责识别化合物,它只是处理原始数据,方便你分析和解读。

我可以用它处理二维或三维 NMR 数据吗?

不可以,这个工具只针对一维 NMR 数据。

'ppm' 和 'FID' 是什么意思?

PPM(百万分之一)是一种单位,用来描述 NMR 谱图中信号的位置。FID(自由感应衰减)是核磁共振仪器在处理前测得的原始信号。

详情

作者的原始描述

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.

repo: K-Dense-AI/scientific-agent-skills

热度

GitHub 星标
51k
排名
#3507
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能