state#
The app's current working data: signal, spectrum, scan, project, peaks.
Read these to get whatever is currently loaded, and assign to signal /
spectrum to replace it — assigning also redraws the plot automatically.
To change the data without redrawing, use set_signal /
set_spectrum with plot=False.
Example
current_scan
#
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
#
The open project (its settings, sample, processing graph, and scans).
signal
#
The current signal (FID), 1D or 2D. Assigning redraws the plot.
None when nothing is loaded.
spectrum
#
spectrum() -> Spectrum1D | Spectrum2D | None
The current spectrum, 1D or 2D. Assigning redraws the plot.
None when nothing is loaded.
set_signal
#
Replace the current signal, optionally without redrawing.
Same as assigning state.signal, but lets you skip the plot update —
useful in tight loops where you only want to redraw once at the end.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Signal1D | Signal2D | None
|
The signal to set (1D or 2D), or |
required |
plot
|
bool
|
Whether to redraw the plot afterwards. |
True
|
set_spectrum
#
set_spectrum(
value: Spectrum1D | Spectrum2D | None, plot: bool = True
) -> None
Replace the current spectrum, optionally without redrawing.
Same as assigning state.spectrum, but lets you skip the plot update —
useful in tight loops where you only want to redraw once at the end.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Spectrum1D | Spectrum2D | None
|
The spectrum to set (1D or 2D), or |
required |
plot
|
bool
|
Whether to redraw the plot afterwards. |
True
|