Scripting#
NucleI has a built-in Python console where you can drive the instrument, process spectra, fit models, and build figures — all against the data you already have open. These guides walk through the things you'll do most often. Each is a short, self-contained recipe; copy one into the console and adapt it.
How it works#
- Everything is exposed through a handful of namespaces —
device,ops,state,viz,charts,fitting,models,relax,scans,io,qc,reporting,math. Typehelp_apis()to list them. - Your current data lives in
state.signal(the FID) andstate.spectrum(the processed spectrum). Most tools read from there by default and write back to it, so plots stay in sync. - Spectra and signals are
tqt_nmrobjects with rich built-in methods (find_peaks,integrate_peaks,correct_baseline, …) — reach for those before pulling in outside libraries. - Common tools are already imported —
np(andnumpy),tqt_nmrwithSignal1D/Signal2D/Spectrum1D/Spectrum2D, andlogger. You don't need toimportthem.
# What's currently loaded?
print(state.spectrum)
print("peaks picked:", len(state.peaks))
# List everything you can call
help_apis()
Examples#
-
Plot signals and spectra, overlay references, and read peaks.
-
Build a pulse sequence and acquire on the instrument.
-
Fit built-in or custom models and overlay the result.
-
Extract relaxation rates and correlation times.
-
Analyse many scans at once and build cross-scan series.
-
Assemble and display your own plots.
-
Load, save, export, and feed results into reports.
-
Track instrument health with routine QC checks.
For the full list of every method and argument, see the Backend APIs reference and the TQT-NMR Library page.