Skip to content

See your data#

viz.plot draws a signal or spectrum on the main plot. It accepts a tqt_nmr object, a plain list/array, or an (x, y) pair.

# Plot the current spectrum
viz.plot(state.spectrum, title="My spectrum")

# Overlay a reference curve without replacing the data
viz.annotate(reference_spectrum, title="Reference")

# Switch the y-axis to log scaling
viz.set_axes(y="log")

To read the peaks the app has picked, use state.peaks — each has a frequency, height, and linewidth:

for peak in state.peaks:
    print(f"{peak.frequency_hz:8.1f} Hz   height={peak.height:.3g}")

You can also detect peaks yourself on any spectrum with tqt_nmr's built-in find_peaks, then integrate them — no external libraries needed:

peaks = state.spectrum.find_peaks(min_height_ratio=0.05)
integrals = state.spectrum.integrate_peaks(peaks)
for result in integrals:
    print(f"{result.peak.frequency_hz:8.1f} Hz   area={result.area:.3g}")