Skip to content

Data types#

Objects the APIs return or accept: fitting results, scan and graph objects, chart builders, and pulse operations. Protocol and library types that appear in their signatures are under Types.

ColumnQuality dataclass #

Invertibility verdict for one decay curve.

snr is peak intensity over the noise estimate; decay_fraction is the fraction of intensity lost across the b-range; residual_rms is the fit residual relative to the curve's own scale. reason is non-None exactly when invertible is False.

snr instance-attribute #

snr: float

decay_fraction instance-attribute #

decay_fraction: float

residual_rms class-attribute instance-attribute #

residual_rms: float = float('nan')

invertible class-attribute instance-attribute #

invertible: bool = True

reason class-attribute instance-attribute #

reason: str | None = None

DiffusionPeak dataclass #

One resolved component of a diffusion distribution.

d instance-attribute #

d: float

weight instance-attribute #

weight: float

width_decades instance-attribute #

width_decades: float

d_lo instance-attribute #

d_lo: float

d_hi instance-attribute #

d_hi: float

d_stderr class-attribute instance-attribute #

d_stderr: float = float('nan')

DosyMap dataclass #

A (diffusion, chemical shift) map ready for contour display.

intensities is [n_d, n_shift]; d_axis is the F1 axis in m^2/s (log-spaced, so plot it on a log scale); shifts is the direct axis in ppm. quality and results are indexed by the same column index as shifts.

d_axis instance-attribute #

d_axis: ndarray

shifts instance-attribute #

shifts: ndarray

intensities instance-attribute #

intensities: ndarray

results instance-attribute #

results: list[InversionResult | None]

quality instance-attribute #

quality: list[ColumnQuality | None]

peaks class-attribute instance-attribute #

peaks: list[tuple[float, DiffusionPeak]] = field(
    default_factory=list
)

temperature_k class-attribute instance-attribute #

temperature_k: float | None = None

viscosity_pa_s class-attribute instance-attribute #

viscosity_pa_s: float | None = None

temperature_source class-attribute instance-attribute #

temperature_source: str = 'unknown'

b_values class-attribute instance-attribute #

b_values: ndarray = field(
    default_factory=lambda: np.zeros(0)
)

measured class-attribute instance-attribute #

measured: ndarray = field(
    default_factory=lambda: np.zeros((0, 0))
)

radii #

radii() -> list[tuple[float, float, float]]

[(shift_ppm, D, r_h in m)] for every resolved peak, empty without T and viscosity.

InversionResult dataclass #

Recovered P(D) for a single decay curve, on d_grid.

d_grid instance-attribute #

d_grid: ndarray

distribution instance-attribute #

distribution: ndarray

method instance-attribute #

method: str

regularisation instance-attribute #

regularisation: float

quality instance-attribute #

quality: ColumnQuality

peaks class-attribute instance-attribute #

peaks: list[DiffusionPeak] = field(default_factory=list)

mean_d property #

mean_d: float

Weight-averaged D (m^2/s) in log space, or NaN for an empty distribution.

DeviceMetadata #

Device metadata information.

hardware_version class-attribute instance-attribute #

hardware_version: str | None = None

firmware_version class-attribute instance-attribute #

firmware_version: str | None = None

api_version class-attribute instance-attribute #

api_version: str | None = None

serial class-attribute instance-attribute #

serial: str | None = None

model_config class-attribute #

model_config: ConfigDict = ConfigDict(extra='allow')

Annotation dataclass #

A text annotation placed at a point on the plot, optionally with an arrow.

x class-attribute instance-attribute #

x: float | str | None = None

y class-attribute instance-attribute #

y: float | str | None = None

text class-attribute instance-attribute #

text: str | None = None

showarrow class-attribute instance-attribute #

showarrow: bool | None = None

textangle class-attribute instance-attribute #

textangle: float | None = None

xanchor class-attribute instance-attribute #

xanchor: (
    Literal["auto", "left", "center", "right"] | None
) = None

yanchor class-attribute instance-attribute #

yanchor: (
    Literal["auto", "top", "middle", "bottom"] | None
) = None

font class-attribute instance-attribute #

font: Font | dict[str, Any] | None = None

xref class-attribute instance-attribute #

xref: str | None = None

yref class-attribute instance-attribute #

yref: str | None = None

ax class-attribute instance-attribute #

ax: float | None = None

ay class-attribute instance-attribute #

ay: float | None = None

arrowcolor class-attribute instance-attribute #

arrowcolor: str | None = None

arrowwidth class-attribute instance-attribute #

arrowwidth: float | None = None

bgcolor class-attribute instance-attribute #

bgcolor: str | None = None

extras class-attribute instance-attribute #

extras: dict[str, Any] = field(default_factory=dict)

Axis dataclass #

Settings for one axis: title, range, scale, gridlines, and ticks.

title class-attribute instance-attribute #

title: str | dict[str, Any] | None = None

range class-attribute instance-attribute #

range: list[float] | tuple[float, float] | None = None

autorange class-attribute instance-attribute #

autorange: bool | Literal['reversed'] | None = None

type class-attribute instance-attribute #

type: (
    Literal["linear", "log", "date", "category"] | None
) = None

showgrid class-attribute instance-attribute #

showgrid: bool | None = None

gridcolor class-attribute instance-attribute #

gridcolor: str | None = None

gridwidth class-attribute instance-attribute #

gridwidth: float | None = None

zeroline class-attribute instance-attribute #

zeroline: bool | None = None

zerolinecolor class-attribute instance-attribute #

zerolinecolor: str | None = None

zerolinewidth class-attribute instance-attribute #

zerolinewidth: float | None = None

tickformat class-attribute instance-attribute #

tickformat: str | None = None

showticklabels class-attribute instance-attribute #

showticklabels: bool | None = None

domain class-attribute instance-attribute #

domain: list[float] | tuple[float, float] | None = None

anchor class-attribute instance-attribute #

anchor: str | None = None

matches class-attribute instance-attribute #

matches: str | None = None

nticks class-attribute instance-attribute #

nticks: int | None = None

extras class-attribute instance-attribute #

extras: dict[str, Any] = field(default_factory=dict)

Figure dataclass #

A complete plot: one or more data series plus a Layout. Builder methods return self for chaining.

data class-attribute instance-attribute #

data: list[_Trace | dict[str, Any]] = field(
    default_factory=list
)

layout class-attribute instance-attribute #

layout: Layout = field(default_factory=Layout)

add #

add(*traces: _Trace | dict[str, Any]) -> Figure

Add one or more data series (Scatter, Bar, …) to the figure. Returns self for chaining.

add_shape #

add_shape(shape: Shape | dict[str, Any]) -> Figure

Draw a shape (line, box, circle, …) over the figure. Returns self for chaining.

add_annotation #

add_annotation(
    annotation: Annotation | dict[str, Any],
) -> Figure

Add a text label (optionally with an arrow) at a point on the figure. Returns self for chaining.

update_layout #

update_layout(**kwargs: Any) -> Figure

Set figure-wide options (title, xaxis, yaxis, …) by keyword. Returns self for chaining.

to_spec #

to_spec() -> dict[str, Any]

Export the figure as a plain {"data": [...], "layout": {...}} dictionary.

Font dataclass #

Font styling for titles, axis labels, and annotation text.

size class-attribute instance-attribute #

size: float | None = None

color class-attribute instance-attribute #

color: str | float | None = None

family class-attribute instance-attribute #

family: str | None = None

extras class-attribute instance-attribute #

extras: dict[str, Any] = field(default_factory=dict)

Layout dataclass #

The figure's overall look: title, axes, legend, margins, shapes, annotations.

title class-attribute instance-attribute #

title: str | dict[str, Any] | None = None

xaxis class-attribute instance-attribute #

xaxis: Axis | dict[str, Any] | None = None

yaxis class-attribute instance-attribute #

yaxis: Axis | dict[str, Any] | None = None

xaxis2 class-attribute instance-attribute #

xaxis2: Axis | dict[str, Any] | None = None

xaxis3 class-attribute instance-attribute #

xaxis3: Axis | dict[str, Any] | None = None

xaxis4 class-attribute instance-attribute #

xaxis4: Axis | dict[str, Any] | None = None

yaxis2 class-attribute instance-attribute #

yaxis2: Axis | dict[str, Any] | None = None

yaxis3 class-attribute instance-attribute #

yaxis3: Axis | dict[str, Any] | None = None

yaxis4 class-attribute instance-attribute #

yaxis4: Axis | dict[str, Any] | None = None

showlegend class-attribute instance-attribute #

showlegend: bool | None = None

legend class-attribute instance-attribute #

legend: dict[str, Any] | None = None

margin class-attribute instance-attribute #

margin: Margin | dict[str, Any] | None = None

shapes class-attribute instance-attribute #

shapes: list[Shape | dict[str, Any]] = field(
    default_factory=list
)

annotations class-attribute instance-attribute #

annotations: list[Annotation | dict[str, Any]] = field(
    default_factory=list
)

paper_bgcolor class-attribute instance-attribute #

paper_bgcolor: str | None = None

plot_bgcolor class-attribute instance-attribute #

plot_bgcolor: str | None = None

height class-attribute instance-attribute #

height: float | None = None

width class-attribute instance-attribute #

width: float | None = None

font class-attribute instance-attribute #

font: Font | dict[str, Any] | None = None

hovermode class-attribute instance-attribute #

hovermode: (
    Literal[
        "x", "y", "closest", "x unified", "y unified", False
    ]
    | None
) = None

extras class-attribute instance-attribute #

extras: dict[str, Any] = field(default_factory=dict)

Line dataclass #

Line styling: color, width, and dash pattern.

color class-attribute instance-attribute #

color: str | None = None

width class-attribute instance-attribute #

width: float | None = None

dash class-attribute instance-attribute #

dash: (
    Literal[
        "solid",
        "dot",
        "dash",
        "longdash",
        "dashdot",
        "longdashdot",
    ]
    | None
) = None

extras class-attribute instance-attribute #

extras: dict[str, Any] = field(default_factory=dict)

Margin dataclass #

Plot margins in pixels: left, right, top, bottom.

l class-attribute instance-attribute #

l: float | None = None

r class-attribute instance-attribute #

r: float | None = None

t class-attribute instance-attribute #

t: float | None = None

b class-attribute instance-attribute #

b: float | None = None

extras class-attribute instance-attribute #

extras: dict[str, Any] = field(default_factory=dict)

Shape dataclass #

A shape drawn over the plot (line/rect/circle/path/triangle) to highlight a region or point.

type class-attribute instance-attribute #

type: (
    Literal["line", "rect", "circle", "path", "triangle"]
    | None
) = None

x0 class-attribute instance-attribute #

x0: float | str | None = None

x1 class-attribute instance-attribute #

x1: float | str | None = None

y0 class-attribute instance-attribute #

y0: float | str | None = None

y1 class-attribute instance-attribute #

y1: float | str | None = None

path class-attribute instance-attribute #

path: str | None = None

xref class-attribute instance-attribute #

xref: str | None = None

yref class-attribute instance-attribute #

yref: str | None = None

line class-attribute instance-attribute #

line: Line | dict[str, Any] | None = None

fillcolor class-attribute instance-attribute #

fillcolor: str | None = None

opacity class-attribute instance-attribute #

opacity: float | None = None

layer class-attribute instance-attribute #

layer: Literal['above', 'below'] | None = None

tipX class-attribute instance-attribute #

tipX: float | None = None

tipY class-attribute instance-attribute #

tipY: float | None = None

dx class-attribute instance-attribute #

dx: float | None = None

dy class-attribute instance-attribute #

dy: float | None = None

lengthPx class-attribute instance-attribute #

lengthPx: float | None = None

widthPx class-attribute instance-attribute #

widthPx: float | None = None

label class-attribute instance-attribute #

label: str | None = None

labelColor class-attribute instance-attribute #

labelColor: str | None = None

labelFontSize class-attribute instance-attribute #

labelFontSize: float | None = None

extras class-attribute instance-attribute #

extras: dict[str, Any] = field(default_factory=dict)

DeviceState #

connected instance-attribute #

connected: bool

vendor instance-attribute #

vendor: str

metadata instance-attribute #

metadata: DeviceMetadata

GraphResult #

GraphResult(
    results: dict[str, object],
    nodes: list[PostprocessingNode],
    output_id: str,
)

Read-only results of running a processing pipeline over one scan; output is its pipeline output's value.

output property #

output: SignalNd | SpectrumNd

The pipeline output's value: the run's result.

outputs property #

outputs: dict[str, object]

Each final step's id mapped to the value it produced, for inspection; the result is output.

signal property #

signal: SignalNd | None

The pipeline output when it is a signal, else None.

spectrum property #

spectrum: SpectrumNd | None

The pipeline output when it is a spectrum, else None.

GraphSpec module-attribute #

GraphSpec = (
    str
    | rpc.Postprocessing
    | list[rpc.postprocessing.PostprocessingNode]
)

Page dataclass #

Page(
    title: str,
    layout: str,
    view: str,
    normalize: bool,
    scans: list[Scan],
)

One workspace page as a script sees it: its scans (proxies, data loaded lazily) and how it shows them.

title instance-attribute #

title: str

layout instance-attribute #

layout: str

view instance-attribute #

view: str

normalize instance-attribute #

normalize: bool

scans instance-attribute #

scans: list[Scan]

Peak module-attribute #

Peak = rpc.PeakInfo | rpc.PeakInfo2D

PeakEditBatch #

PeakEditBatch(peaks: PeakSet)

One gesture's worth of peak edits; everything added inside the with block becomes one undo entry.

batch_id instance-attribute #

batch_id = new_edit_id()

add #

add(edit: PeakEdit) -> None

Queue one edit for the end of the block.

PeakSet #

PeakSet(
    scan: Scan,
    peaks: list[PeakInfo] | list[PeakInfo2D],
    *,
    spectrum: Spectrum1D | Spectrum2D | None = None,
    project: str | None = None,
)

The scan's peaks, plus edit-log operations on them; every edit method requires a reason.

log property #

log: list[PeakEdit]

Every edit ever made to this scan's peaks, disabled ones included.

find #

find(predicate: Callable[[Peak], bool]) -> list[Peak]

Every peak the predicate accepts, e.g. s.peaks.find(lambda p: p.area > 3).

by_id #

by_id(peak_id: str) -> Peak | None

The peak with this peak_id, or None.

batch #

batch() -> PeakEditBatch

Context manager grouping several edits into one undo entry.

add_peak #

add_peak(
    frequency_hz: float,
    *,
    reason: str,
    f1_hz: float | None = None,
    height: float = 0.0,
    area: float = 0.0,
) -> str

Place a peak the detector did not find. Returns the new edit's id.

delete_peak #

delete_peak(
    *,
    reason: str,
    peak_id: str | None = None,
    frequency_hz: float | None = None,
) -> str

Remove a peak for good; a re-detected line at the same position is removed again on replay.

move_peak #

move_peak(
    to_hz: float,
    *,
    reason: str,
    peak_id: str | None = None,
    frequency_hz: float | None = None,
) -> str

Reposition a peak.

set_field #

set_field(
    *,
    reason: str,
    peak_id: str | None = None,
    frequency_hz: float | None = None,
    integral: float | None = None,
    pattern: str | None = None,
    j_couplings: list[float] | None = None,
    label: str | None = None,
) -> str

Override one of a peak's reported values.

merge #

merge(frequencies_hz: list[float], *, reason: str) -> str

Merge the lines at these positions into one multiplet.

split #

split(
    start_hz: float,
    end_hz: float,
    boundary_hz: float,
    *,
    reason: str,
) -> str

Split the multiplet in [start_hz, end_hz] at the frequency boundary_hz.

set_tier #

set_tier(
    start_hz: float,
    end_hz: float,
    *,
    tier: int,
    reason: str,
) -> str

Override the automatic chemical-shift tier for the signal in this interval.

set_integral_scale #

set_integral_scale(
    start_hz: float,
    end_hz: float,
    *,
    value: float,
    reason: str,
) -> str

Make the signal or region in this interval read value; every other integral keeps its ratio to it.

annotate #

annotate(
    text: str,
    *,
    reason: str,
    peak_id: str | None = None,
    frequency_hz: float | None = None,
) -> str

Attach free text to a peak.

revert #

revert(edit_id: str, *, reason: str | None = None) -> None

Undo one edit by appending a compensating entry. Nothing is erased.

clear_edits #

clear_edits(*, reason: str) -> None

Withdraw every edit on this scan, as one undo entry; back to what the detector found on its own.

replay #

replay() -> list

Re-run the log over freshly detected peaks; one outcome per edit (applied/reanchored/ambiguous/orphaned).

Scan #

Scan(
    ref: AnalysisScanRef,
    scan: Scan | None = None,
    *,
    view: LoadedScan | None = None,
)

One stored scan; data loads lazily. Assigning signal/spectrum/peaks is in-memory until save.

id property #

id: str

Scan id (UUID).

project property #

project: str

Name of the project this scan belongs to.

label property #

label: str | None

User/UI-assigned label for this scan within the working set.

group property #

group: str | None

Group/folder path of the scan, if any.

name property #

name: str

Display name (falls back to the scan id).

timestamp property #

timestamp: object

Acquisition timestamp.

experiment_type property #

experiment_type: object

Detected experiment type (COSY, T1_IR, …).

sample property #

sample: object | None

Sample snapshot taken at acquisition time, if any.

metadata property #

metadata: object | None

Acquisition metadata (pulse program, gains, …).

is_loaded property #

is_loaded: bool

Whether the full scan is currently materialized in memory.

signal property writable #

signal: Signal1D | Signal2D | None

Accumulated signal (FID) as a Signal1D/Signal2D.

spectrum property writable #

spectrum: Spectrum1D | Spectrum2D | None

Accumulated spectrum as a Spectrum1D/Spectrum2D, on a ppm axis wherever it is referenced.

peaks property writable #

peaks: PeakSet

Picked peaks (a PeakSet) from the most recent perform_analysis call; not auto-detected on access.

integration_regions property #

integration_regions: list[IntegrationRegion]

Integration regions defined on the scan.

raw property #

raw: Scan

The underlying stored scan record; prefer signal/spectrum/peaks/metadata where possible.

perform_analysis #

perform_analysis(
    *,
    settings: PeakDetectionSettings | None = None,
    adaptive: bool | None = None,
    min_distance_hz: float | None = None,
    min_height_ratio: float | None = None,
    prominence: float | None = None,
    integration_width_hz: float | None = None,
    normalize_to_peak: int | None = None,
    multiplet_search_width_hz: float | None = None,
) -> list[PeakInfo]

Detect peaks and integrate them on this scan's spectrum; empty list for non-1D. Unset args use globals.

stored_analysis #

stored_analysis() -> ScanPlotAnalysis

Peaks (manual lines and edits applied), multiplets and integration-region results, as the app shows them.

Uses the global detection settings and this scan's current data; empty for non-1D. Nothing is saved or published, and peaks is not changed.

save #

save(
    *,
    signed: bool = False,
    password: str | None = None,
    comment: str = "",
) -> None

Write modifications back to this scan's own file on disk; never touches the current/active scan.

After apply or reprocess the scan is written with the pipeline's execution record, its snapshot and the input it read.

reload #

reload() -> Scan

Drop the cached data so the next access re-reads from disk.

preprocess #

preprocess(
    *,
    settings: PreprocessingSettings | None = None,
    phase_correction: PhaseCorrectionSettings | None = None,
    baseline_correction: BaselineCorrectionSettings
    | None = None,
    apodization: ApodizationSettings | None = None,
    zero_fill: ZeroFillSettings | None = None,
    fft: FftSettings | None = None,
    reference_correction: ReferenceCorrectionSettings
    | None = None,
    group_delay: GroupDelaySettings | None = None,
    solvent_suppression: SolventSuppressionSettings
    | None = None,
    linear_prediction: LinearPredictionSettings
    | None = None,
    reference_deconvolution: ReferenceDeconvolutionSettings
    | None = None,
) -> Scan

Apply preprocessing to this scan's 1D signal; no-op for non-1D. Unset stages use globals. Returns self.

Raises:

Type Description
PreprocessingError

If a stage cannot be applied as configured.

ProcessingParameterError

If a stage parameter is out of range.

analyze #

analyze(*, with_preprocessing: bool | None = None) -> Scan

Run the app's automatic processing (optionally preprocess, then peak detection). Returns self.

process #

process(graph: GraphSpec | None = None) -> GraphResult

Run a processing pipeline over this scan, without touching scans.current or this scan's data.

The pipeline reads what pipelines read for the scan: its data, or for a scan a pipeline produced, the input that pipeline read.

Parameters:

Name Type Description Default
graph GraphSpec | None

The project's pipeline (None), a saved pipeline's name, a pipeline, or a node list. It must hold exactly one pipeline output.

None

Returns:

Type Description
GraphResult

The run's results; output is the pipeline output's value.

Raises:

Type Description
PipelineError

The pipeline has no output, several, or its output was not produced.

apply #

apply(graph: GraphSpec | None = None) -> Scan

Run a processing pipeline over this scan and keep its output as this scan's data. Returns self.

A signal output brings the spectrum computed from it; a spectrum output keeps the signal it was processed from. save then writes it over this scan, save_as_new beside it, either with the execution record.

Parameters:

Name Type Description Default
graph GraphSpec | None

As for process.

None

Returns:

Type Description
Scan

This scan.

Raises:

Type Description
PipelineError

The pipeline cannot run, or its output is no signal or spectrum.

reprocess #

reprocess() -> Scan

Run the pipeline that produced this scan's data again, on the input it stores. Returns self.

Nothing is written until save, which records the new run.

Returns:

Type Description
Scan

This scan.

Raises:

Type Description
PipelineError

No pipeline produced this scan's data, or it cannot run.

save_as_new #

save_as_new(
    *, name: str | None = None, pipeline_name: str = ""
) -> str

Save this scan's data as a new scan derived from it, beside it; this scan's file is not touched.

Sample, group, experiment and acquisition metadata are carried over; after apply the new scan holds the execution record.

Parameters:

Name Type Description Default
name str | None

The new scan's name; this scan's name and the pipeline's when None.

None
pipeline_name str

The pipeline's name for the default name; the applied pipeline's when "".

''

Returns:

Type Description
str

The new scan's id.

SmartFittingResult dataclass #

Result from SmartFittingAPI.fit with comprehensive metadata.

success instance-attribute #

success: bool

parameters instance-attribute #

parameters: tuple[float, ...]

loss instance-attribute #

loss: float

message instance-attribute #

message: str

execution_time instance-attribute #

execution_time: float

model_name instance-attribute #

model_name: str

n_iterations instance-attribute #

n_iterations: int

initial_guess instance-attribute #

initial_guess: tuple[float, ...]

r_squared instance-attribute #

r_squared: float | None

Coefficient of determination; None when the fit failed or the data is constant.

algorithm_used instance-attribute #

algorithm_used: str

model_info instance-attribute #

model_info: FunctionAnalysisResult

data_info instance-attribute #

data_info: DataAnalysisInfo

auto_selected instance-attribute #

auto_selected: bool

FunctionAnalysisResult dataclass #

function_name class-attribute instance-attribute #

function_name: str = 'unknown'

parameter_count class-attribute instance-attribute #

parameter_count: int = 0

function_type class-attribute instance-attribute #

function_type: str = 'unknown'

confidence class-attribute instance-attribute #

confidence: float = 0.0

recommended_algorithm class-attribute instance-attribute #

recommended_algorithm: str = 'scipy'

algorithm_confidence class-attribute instance-attribute #

algorithm_confidence: float = 0.0

characteristics class-attribute instance-attribute #

characteristics: dict[str, Any] = field(
    default_factory=dict
)

analysis_methods class-attribute instance-attribute #

analysis_methods: list[str] = field(default_factory=list)

recommendation_reason class-attribute instance-attribute #

recommendation_reason: str = ''

signature class-attribute instance-attribute #

signature: SignatureInfo = field(
    default_factory=SignatureInfo
)

source_analysis class-attribute instance-attribute #

source_analysis: SourceAnalysis | None = None

name_analysis class-attribute instance-attribute #

name_analysis: NameAnalysis = field(
    default_factory=NameAnalysis
)

numerical_analysis class-attribute instance-attribute #

numerical_analysis: NumericalAnalysis | None = None

BaseOp #

Base class for all operations.

op_id class-attribute #

op_id: str

display_name class-attribute instance-attribute #

display_name: str | None = None

category class-attribute instance-attribute #

category: str | None = None

model_config class-attribute instance-attribute #

model_config = ConfigDict(arbitrary_types_allowed=True)

get_visualization #

get_visualization() -> dict[str, Any] | None

Get visualization data for this operation, or None.

get_duration_ns #

get_duration_ns() -> float

Get operation duration in nanoseconds.

to_struct #

to_struct() -> Struct

Serialize this operation to a protobuf Struct.

from_struct classmethod #

from_struct(struct: Struct) -> BaseOp

Deserialize an operation from a protobuf Struct.

PulseOp #

phase instance-attribute #

duration instance-attribute #

duration: Duration

op_id class-attribute #

op_id: str

display_name class-attribute instance-attribute #

display_name: str | None = None

category class-attribute instance-attribute #

category: str | None = None

model_config class-attribute instance-attribute #

model_config = ConfigDict(arbitrary_types_allowed=True)

get_duration_ns #

get_duration_ns() -> float

get_visualization #

get_visualization() -> dict[str, Any]

to_struct #

to_struct() -> Struct

Serialize this operation to a protobuf Struct.

from_struct classmethod #

from_struct(struct: Struct) -> BaseOp

Deserialize an operation from a protobuf Struct.

RecordOp #

duration instance-attribute #

duration: Duration

op_id class-attribute #

op_id: str

display_name class-attribute instance-attribute #

display_name: str | None = None

category class-attribute instance-attribute #

category: str | None = None

model_config class-attribute instance-attribute #

model_config = ConfigDict(arbitrary_types_allowed=True)

get_duration_ns #

get_duration_ns() -> float

get_visualization #

get_visualization() -> dict[str, Any]

to_struct #

to_struct() -> Struct

Serialize this operation to a protobuf Struct.

from_struct classmethod #

from_struct(struct: Struct) -> BaseOp

Deserialize an operation from a protobuf Struct.

SilenceOp #

duration instance-attribute #

duration: Duration

op_id class-attribute #

op_id: str

display_name class-attribute instance-attribute #

display_name: str | None = None

category class-attribute instance-attribute #

category: str | None = None

model_config class-attribute instance-attribute #

model_config = ConfigDict(arbitrary_types_allowed=True)

get_duration_ns #

get_duration_ns() -> float

get_visualization #

get_visualization() -> dict[str, Any]

to_struct #

to_struct() -> Struct

Serialize this operation to a protobuf Struct.

from_struct classmethod #

from_struct(struct: Struct) -> BaseOp

Deserialize an operation from a protobuf Struct.

LoadedScan dataclass #

LoadedScan(
    scan: Scan,
    project: str,
    signal: Signal | None = None,
    spectrum: Spectrum | None = None,
    preprocessed: bool = False,
    stored_metadata: tuple[dict[str, str], ...] = (),
    placeholder: bool = False,
    source: tuple[Signal | None, Spectrum | None]
    | None = None,
    applied_pipeline: Postprocessing | None = None,
)

A scan as the session holds it: the record (never its arrays), where it is stored, and the data shown.

project is "" for a scan that exists only in memory. stored_metadata is the metadata of the stored signal and spectrum traces, kept because processing may not carry it over. placeholder is True for a record taken from the project file whose scan has not been read yet: it may be light and stale, so it must never be written to the scan. source is what processing pipelines read for the scan: the signal and spectrum it showed before a pipeline output was applied over them, or the input a stored pipeline output was produced from; None when that is the data shown. A pipeline therefore never processes its own output. applied_pipeline is the pipeline whose output an apply shows; saving the scan records it in place of the record's own.

scan instance-attribute #

scan: Scan

project instance-attribute #

project: str

signal class-attribute instance-attribute #

signal: Signal | None = None

spectrum class-attribute instance-attribute #

spectrum: Spectrum | None = None

preprocessed class-attribute instance-attribute #

preprocessed: bool = False

stored_metadata class-attribute instance-attribute #

stored_metadata: tuple[dict[str, str], ...] = field(
    default=()
)

placeholder class-attribute instance-attribute #

placeholder: bool = False

source class-attribute instance-attribute #

source: tuple[Signal | None, Spectrum | None] | None = None

applied_pipeline class-attribute instance-attribute #

applied_pipeline: Postprocessing | None = None

is_2d property #

is_2d: bool

input_signal property #

input_signal: Signal | None

The signal pipeline inputs read: the source one, never an applied output.

input_spectrum property #

input_spectrum: Spectrum | None

The spectrum pipeline inputs read: the source one, never an applied output.

with_arrays #

with_arrays() -> Scan

The record with the shown signal and spectrum written into it, for saving the data as a scan.

Shown pipeline output keeps the input it was produced from and the pipeline's snapshot.

from_stored classmethod #

from_stored(scan: Scan, project: str) -> LoadedScan

scan with the data it stores, unprocessed, and the input a pipeline produced it from.

scan itself is not changed.

unsaved classmethod #

unsaved(
    signal: Signal | None, spectrum: Spectrum | None
) -> LoadedScan

A new in-memory scan, under a record of its own, showing signal and spectrum.

Signal #

Signal = Signal1D | Signal2D

Spectrum #

Spectrum = Spectrum1D | Spectrum2D

AnalysisScanRef dataclass #

AnalysisScanRef(
    project: str,
    scan_id: str,
    label: str | None = None,
    group: str | None = None,
)

Lightweight identity of a scan in the multi-scan analysis working set.

Holds only identifiers; the actual scan is resolved lazily from the repository.

project instance-attribute #

project: str

scan_id instance-attribute #

scan_id: str

label class-attribute instance-attribute #

label: str | None = None

group class-attribute instance-attribute #

group: str | None = None