Skip to content

state#

The app's current working data: signal, spectrum, scan, project, peaks.

Assigning to signal/spectrum replaces it and redraws the plot; use set_signal/set_spectrum with plot=False to skip the redraw.

current_scan #

current_scan() -> Scan | None

The scan currently loaded in the app, or None if none is active.

peaks #

peaks() -> list[PeakInfo] | list[PeakInfo2D]

The peaks picked on the current spectrum (1D or 2D; empty if none).

project #

project() -> Project

The open project (its settings, sample, processing graph, and scans).

sample #

sample() -> Sample | None

The sample attached to the open project, or None if unset.

signal #

signal() -> Signal1D | Signal2D

The current signal (FID), 1D or 2D. Assigning redraws the plot.

None when nothing is loaded.

signal_1d #

signal_1d() -> Signal1D | None

signal narrowed to the 1D variant.

None when nothing is loaded or the loaded signal is 2D.

signal_2d #

signal_2d() -> Signal2D | None

signal narrowed to the 2D variant.

None when nothing is loaded or the loaded signal is 1D.

spectrum #

spectrum() -> Spectrum1D | Spectrum2D

The current spectrum, 1D or 2D. Assigning redraws the plot.

None when nothing is loaded.

spectrum_1d #

spectrum_1d() -> Spectrum1D

spectrum narrowed to the 1D variant.

None when nothing is loaded or the loaded spectrum is 2D.

spectrum_2d #

spectrum_2d() -> Spectrum2D

spectrum narrowed to the 2D variant.

None when nothing is loaded or the loaded spectrum is 1D.

clear #

clear() -> None

Clear the current signal and spectrum and wipe all plots.

set_signal #

set_signal(
    value: Signal1D | Signal2D | None, plot: bool = True
) -> None

Replace the current signal, like state.signal =, but with plot to skip the redraw.

set_spectrum #

set_spectrum(
    value: Spectrum1D | Spectrum2D | None, plot: bool = True
) -> None

Replace the current spectrum, like state.spectrum =, but with plot to skip the redraw.