Skip to content

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 namespacesdevice, ops, state, viz, charts, fitting, models, relax, scans, io, qc, reporting, math. Type help_apis() to list them.
  • Your current data lives in state.signal (the FID) and state.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_nmr objects with rich built-in methods (find_peaks, integrate_peaks, correct_baseline, …) — reach for those before pulling in outside libraries.
  • Common tools are already importednp (and numpy), tqt_nmr with Signal1D / Signal2D / Spectrum1D / Spectrum2D, and logger. You don't need to import them.
# What's currently loaded?
print(state.spectrum)
print("peaks picked:", len(state.peaks))

# List everything you can call
help_apis()

Examples#

For the full list of every method and argument, see the Backend APIs reference and the TQT-NMR Library page.