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 cover common tasks. Each recipe can be copied into the console once the names it uses (for example temperatures, delays_s or some_scan_id) are defined or replaced with your own data.

How it works#

  • Everything is exposed through namespaces — device, 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, …) — use these methods before adding external libraries.
  • Common tools are already imported — np (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.