К основному содержанию
скилл CX Codex

nmrglue — скилл для Claude Code: обработка NMR-спектров

Скилл nmrglue для Claude Code обрабатывает одномерные NMR-сигналы в фазированные спектры, пики и интегралы регионов. Калибрует и воспроизводимо обрабатывает сырые FID на Python 3.12+, NumPy и SciPy.

MIT 465 установок ★ 58 036 обновлён 2026-10-19

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add K-Dense-AI/scientific-agent-skills --skill nmrglue -a claude-code
Открыть на GitHub

Что делает nmrglue

Скилл берёт одномерный комплексный FID (свободную индукцию) в формате NumPy .npz или NMRPipe и преобразует его в descending ppm спектр с фазировкой, кандидатами пиков и подписанными интегралами регионов. Поддерживает аподизацию, нулевое заполнение, ручную фазировку и линейную коррекцию baseline — но только для сигнал-свободных регионов.

Входные параметры (спектральная ширина, частота наблюдения, carrier ppm, знак конвенции) берутся из JSON конфига, а не из дефолтных значений инструмента. Требуется Python 3.12+, nmrglue 0.12, NumPy 2.5.3+ и SciPy 1.18.1+. NMRPipe импорт проверен на синтетических и тестовых файлах; Bruker, Varian и JEOL форматы требуют ручной валидации метаданных.

Вывод — spectrum.csv (sppm, real signal, phased imaginary, baseline) и report.json (версии пакетов, все параметры, пики и интегралы). Интегралы рассчитаны трапециевидным методом вдоль ppm оси; для количественной NMR нужны дополнительные данные о relaxation delay и pulse angle.

Какие задачи решает

  • преобразовать сырой FID в фазированный спектр с калибровкой по ppm
  • найти положение пиков и интегралы выбранных регионов
  • применить аподизацию и коррекцию baseline к одномерным NMR данным
  • проверить и воспроизвести спектральную обработку через JSON параметры
  • импортировать и обработать NMRPipe файлы

Примеры запросов агенту

  • Обработай FID из fid.npz с параметрами processing.json и сохрани результат в nmr-result
  • Прочитай NMRPipe файл experiment.fid с конфигом settings.json и дай интегралы для двух регионов
  • Примени exponential line broadening 2 Hz к спектру и фазируй manual phase0 45 градусов

Как установить nmrglue

1Через Skills CLI (Vercel)

npx skills add K-Dense-AI/scientific-agent-skills --skill nmrglue -a claude-code

2Вручную: положить файлы

~/.claude/skills/nmrglue/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/nmrglue/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о nmrglue

Как установить nmrglue в Claude Code?

Запусти npx skills add K-Dense-AI/scientific-agent-skills --skill nmrglue -a claude-code, затем открой ~/.claude/skills/nmrglue/SKILL.md.

Что делает nmrglue?

Преобразует сырые одномерные NMR данные (FID) в спектры с фазировкой, находит пики и интегрирует выбранные регионы. Требует явной калибровки параметров через JSON конфиг.

Какие форматы входа поддерживаются?

NumPy .npz с одним комплексным массивом fid и NMRPipe FDF2 файлы. Bruker, Varian и JEOL требуют ручной проверки метаданных перед обработкой.

Исходный текст

SKILL.md · MIT
---
name: nmrglue
description: 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.
license: MIT
compatibility: Requires Python 3.12+, nmrglue, NumPy 2+, and SciPy. Installation needs network access; processing is local and needs no credentials.
metadata:
  version: "1.1"
  skill-author: K-Dense Inc.
  tested-package-version: "0.12"
  last-reviewed: "2026-10-01"
---

# 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](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](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:

```bash
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:

```python
import numpy as np

t = np.arange(8192) / 4000.0
fid = sum(a * np.exp(-np.pi * 2.0 * t)
          * np.exp(-2j * np.pi * (ppm - 5.0) * 400.0 * t)
          for ppm, a in [(3.0, 1.0), (7.0, 2.0)])
np.savez("fid.npz", fid=fid)
```

Run it with `assets/processing.json` as the settings argument. The repository suite
executes this signal and the CLI, checks both peak locations within 0.001 ppm, checks
integral ratio and analytic area, and checks phase and baseline recovery. The NMRPipe
round-trip test writes this FID using `ng.pipe.create_dic`/`ng.pipe.write`, reads it through
the CLI, and verifies the recovered peaks and integral ratio. Processed frequency-domain
files and conflicting calibration metadata are rejected.

The 2,176-byte upstream fixture checks complex sample order and header calibration using
a file generated by NMRPipe's `simTimeND` / `SET` tools. Those native tools were not run
in this review; this is fixture compatibility, not a live NMRPipe processing comparison.

## Deliverables and interpretation

- `spectrum.csv`: descending ppm, real signal after baseline correction, phased imaginary
  signal, and the fitted real baseline. Plot NMR with the high-ppm end on the left.
- `report.json`: input/settings SHA-256, package versions, all settings, acquired duration,
  zero-filled digital spacing, positive peak candidates, and signed region areas.

Integrals use endpoint interpolation and trapezoidal integration along increasing ppm;
area units are arbitrary signal times ppm, independent of display direction. Regions
outside the sampled ppm axis fail rather than being silently clipped. Peak prominence
is a fraction of the largest positive real intensity; it is not a noise-derived detection
limit. Strong solvent signals can obscure weak candidates at the default threshold.

For quantitative NMR, additionally establish relaxation delay, pulse angle, saturation,
receiver behavior, internal/external reference amount, and integration uncertainty.
The helper does not calculate concentrations or correct unequal relaxation. Preserve
these limits with the result rather than converting arbitrary areas to molecule counts.

## Upstream contracts

- [Processing functions](https://nmrglue.readthedocs.io/en/latest/reference/proc_base.html):
  exponential apodization, zero filling, FFT, and phase operations.
- [File and axis utilities](https://nmrglue.readthedocs.io/en/latest/reference/fileiobase.html):
  unit conversion uses spectral width in Hz, observation frequency in MHz, carrier in Hz.
- [NMRPipe reader/writer](https://nmrglue.readthedocs.io/en/latest/reference/pipe.html):
  the validated ingestion path is a synthetic canonical 1D time-domain round trip.
- [nmrglue project](https://github.com/jjhelmus/nmrglue): upstream source and format readers.

The hosted `latest` documentation identified itself as 0.9-dev when checked; the actual
0.12 package APIs and numerical behavior were tested. Its `proc_base.fft` uses the
negative-exponent NumPy FFT followed by `fftshift`; NMRPipe's FT convention corresponds
to `fft_positive`, so do not substitute it without revisiting the FID sign and phase.
See the [v0.12 processing source](https://github.com/jjhelmus/nmrglue/blob/v0.12/nmrglue/process/proc_base.py).
Multidimensional processing, nonuniform sampling, automated assignment, and experimental vendor imports remain outside
this helper's validated scope.

© K-Dense-AI · MIT · K-Dense-AI/scientific-agent-skills

Похожие скиллы

Все скиллы по теме «Наука и исследования» →
scipy-best-practices Mindrally Скилл scipy-best-practices для Claude Code задаёт агенту правила научных вычислений на SciPy: оптимизация, линейная алгебра, статистика, сигналы. Покрывает Python-код, который считает числа. CX Codex +1 1 100установок scientific-toolkit-skill zLanqing Скилл scientific-toolkit-skill для Claude Code добавляет агенту рабочие процессы научных вычислений: MATLAB/Octave, научный Python, обработку сигналов, симуляции, статистику и графики. Включается для задач с таким кодом. CX Codex +1 896установок numpy tondevrel Объясняет работу NumPy с массивами, матрицами и числовыми вычислениями в Python. Используется в алгоритмах, симуляциях и научных задачах. CX Codex +1 124установок pubchem-database google-deepmind Скилл pubchem-database для работы с базой PubChem: ищет соединения по имени, CID или SMILES и вытаскивает свойства, безопасность и биоактивность. CX Codex +1 2 400установок tooluniverse-organic-chemistry mims-harvard Скилл tooluniverse-organic-chemistry для Claude Code разбирает задачи органической химии: предсказывает продукты реакций, механизмы и спектры с первых принципов. CX Codex +1 284установок pyqt6-eeg-processing-cursorrules-prompt-file PatrickJS Правило pyqt6-eeg-processing-cursorrules-prompt-file настраивает Cursor на разработку десктопных приложений на PyQt6 для обработки и визуализации сигналов ЭЭГ. Помогает разделять тяжёлые вычисления и интерфейс. CX Codex +1 ★ 41 178звёзд репо

Из того же набора176

Весь набор →
alphagenome Запрашивает оценки мутаций из AlphaGenome Atlas и запускает модель DeepMind для анализа регуляторных вариантов ДНК в сборке GRCh38. CX Codex +1 690установок flowkit Скилл flowkit для анализа проточной цитометрии в Python: рассчитывает гейты, применяет компенсацию флуоресценции и читает воркспейсы FlowJo 10. CX Codex +1 467установок pybamm Скилл запускает модели литий-ионных батарей в PyBaMM, сравнивает расчёт с измерениями и проверяет численную погрешность. CX Codex +1 467установок cantera Рассчитывает гомогенные реакторы в Cantera и определяет задержку воспламенения с проверкой баланса энергии. Моделирует кинетику горения идеального газа. CX Codex +1 465установок tellurium Скилл запускает симуляцию кинетических моделей биохимических реакций из SBML или Antimony через Tellurium и экспортирует COMBINE-архивы. CX Codex +1 465установок mageck Скилл mageck считает риды из FASTQ и матрицы гайдов, проверяет библиотеки, запускает QC реплик и выдаёт рейтинг генов с FDR для пулированных CRISPR-скринов. CX Codex +1 465установок qiime2-amplicon Скилл qiime2-amplicon для Claude Code обрабатывает парные 16S-риды в QIIME 2, создавая ASV-таблицы и таксономию с историей преобразований. CX Codex +1 465установок cellprofiler Запускает CellProfiler для подсчёта ядер и измерения флуоресценции. Анализирует 2D TIFF-снимки. CX Codex +1 464установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой