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.
DiffusionPeak
dataclass
#
One resolved component of a diffusion distribution.
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.
InversionResult
dataclass
#
Recovered P(D) for a single decay curve, on d_grid.
mean_d
property
#
Weight-averaged D (m^2/s) in log space, or NaN for an empty distribution.
DeviceMetadata
#
Device metadata information.
Annotation
dataclass
#
Axis
dataclass
#
Settings for one axis: title, range, scale, gridlines, and ticks.
type
class-attribute
instance-attribute
#
Figure
dataclass
#
A complete plot: one or more data series plus a Layout. Builder methods return self for chaining.
data
class-attribute
instance-attribute
#
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
#
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
#
Export the figure as a plain {"data": [...], "layout": {...}} dictionary.
Font
dataclass
#
Font styling for titles, axis labels, and annotation text.
Layout
dataclass
#
Line
dataclass
#
Line styling: color, width, and dash pattern.
dash
class-attribute
instance-attribute
#
Margin
dataclass
#
Plot margins in pixels: left, right, top, bottom.
Shape
dataclass
#
A shape drawn over the plot (line/rect/circle/path/triangle) to highlight a region or point.
type
class-attribute
instance-attribute
#
DeviceState
#
FittedLine
dataclass
#
One fitted line.
Attributes:
| Name | Type | Description |
|---|---|---|
frequency_hz |
float
|
Centre in Hz, in the frame the peaks are shown in. |
frequency_ppm |
float
|
Centre in ppm. |
height |
float
|
Height in the spectrum's units. |
width_hz |
float
|
Half width at half height in Hz. |
area |
float
|
Area under the line, intensity times Hz. |
area_se |
float
|
Standard error of the area, or 0 when it could not be estimated. |
shape_fraction |
float
|
Share of the line that is Lorentzian, between 0 and 1. |
line_class |
str
|
|
reason |
str
|
What the line matched when it is not a compound line; empty otherwise. |
fixed |
bool
|
Whether the line was held at the value given as its start. |
warnings |
tuple[str, ...]
|
Notes on the line's fit. |
FittedRegion
dataclass
#
The fit of one region of the spectrum.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
The region's name, empty when it has none. |
kind |
str
|
|
start_ppm |
float
|
Low end of the region in ppm. |
end_ppm |
float
|
High end of the region in ppm. |
lines |
tuple[FittedLine, ...]
|
The fitted lines; empty for a failed region or a spin-system fit. |
model |
str
|
Name of the line shape fitted. |
baseline_order |
int
|
Order of the polynomial baseline fitted with the lines. |
r_squared |
float
|
Share of the region's variance the fit explains. |
residual_rms |
float
|
Root mean square of the residual. |
noise_sigma |
float
|
Noise level the fit was judged against; 0 when none was measured. |
misfit |
bool
|
Whether the residual stands above the noise. |
warnings |
tuple[str, ...]
|
Notes on the region's fit. |
error |
str
|
Why the region could not be fitted; empty when it was. |
parameters |
tuple[LineFitParameter, ...]
|
Parameters of a spin-system fit; empty for a line fit. |
axis_ppm |
tuple[float, ...]
|
Chemical-shift axis of the region. |
data |
tuple[float, ...]
|
Spectrum values over the region. |
fitted |
tuple[float, ...]
|
Fitted curve over the region. |
residual |
tuple[float, ...]
|
Data minus fit over the region. |
baseline |
tuple[float, ...]
|
Fitted baseline over the region. |
fit |
LineFit | None
|
The fit as the application stores it; None for a failed region. |
LineFitResults
#
LineFitResults(scan: Scan, regions: list[FittedRegion])
The outcome of Scan.line_fit: one FittedRegion per region, and the means to keep them.
regions
property
#
regions: list[FittedRegion]
Every region asked for, in order; a region that could not be fitted says why in error.
accept
#
Keep the fits on the scan and make its peak list say what they found, as the line-fit panel's Accept does.
A fitted line on an existing line moves it; one with no line near it adds a hand-placed line. A stored fit of the same region is replaced.
Returns:
| Type | Description |
|---|---|
int
|
The number of peak edits written. |
Raises:
| Type | Description |
|---|---|
ValueError
|
When no region was fitted, or the scan is not the active scan. |
SecurityError
|
When the project is a review copy that does not accept changes. |
GeneratedReport
dataclass
#
GeneratedReport(
status: ReportStatus,
filename: str,
path: str,
report_id: str,
format: ReportFormatType,
warnings: tuple[str, ...],
missing: tuple[str, ...],
failure_report: bool,
error: str,
)
A report reporting.generate made.
Attributes:
| Name | Type | Description |
|---|---|---|
status |
ReportStatus
|
Whether the report is complete, incomplete, or about a failed run. |
filename |
str
|
The report's file name. |
path |
str
|
Where the report was archived with the project. |
report_id |
str
|
Id of the archive entry. |
format |
ReportFormatType
|
The file format. |
warnings |
tuple[str, ...]
|
What the engine warned about while filling the template. |
missing |
tuple[str, ...]
|
Placeholders that nothing resolved. |
failure_report |
bool
|
Whether this is the failure report that stands in for a report that could not be made. |
error |
str
|
Why the requested report could not be made, when |
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.
outputs
property
#
Each final step's id mapped to the value it produced, for inspection; the result is output.
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
#
One workspace page as a script sees it: its scans (proxies, data loaded lazily) and how it shows them.
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
#
Every edit ever made to this scan's peaks, disabled ones included.
find
#
Every peak the predicate accepts, e.g. s.peaks.find(lambda p: p.area > 3).
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,
f1_hz: float | None = None,
mirror: bool = False,
) -> str
Remove a peak for good; a re-detected line at the same position is removed again on replay.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reason
|
str
|
Why the peak is removed. |
required |
peak_id
|
str | None
|
The peak, by id. |
None
|
frequency_hz
|
float | None
|
The peak, by position on the direct axis, when no id is given. |
None
|
f1_hz
|
float | None
|
Position on the indirect axis of a 2D peak. |
None
|
mirror
|
bool
|
Also remove the partner across the diagonal of a COSY, TOCSY, NOESY or ROESY plane. Ignored for other experiments, as in the plane's context menu. |
False
|
Returns:
| Type | Description |
|---|---|
str
|
The id of the first edit made. |
Raises:
| Type | Description |
|---|---|
ValueError
|
When no peak is addressed, or |
PermissionError
|
When the profile or a review copy does not allow editing. |
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,
f1_hz: float | None = None,
integral: float | None = None,
pattern: str | None = None,
j_couplings: list[float] | None = None,
label: str | None = None,
peak_type: Peak2DType | None = None,
sign: int | None = None,
bond_distance: int | None = None,
mirror: bool = False,
) -> str
Override reported values of a peak; each value is its own edit, all in one undo entry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reason
|
str
|
Why the value is overridden. |
required |
peak_id
|
str | None
|
The peak, by id. |
None
|
frequency_hz
|
float | None
|
The peak, by position on the direct axis, when no id is given. |
None
|
f1_hz
|
float | None
|
Position on the indirect axis of a 2D peak. |
None
|
integral
|
float | None
|
Reported integral. |
None
|
pattern
|
str | None
|
Multiplet pattern. |
None
|
j_couplings
|
list[float] | None
|
Coupling constants in Hz. |
None
|
label
|
str | None
|
Free-text label. |
None
|
peak_type
|
Peak2DType | None
|
Class of a 2D cross peak. |
None
|
sign
|
int | None
|
|
None
|
bond_distance
|
int | None
|
Bonds between the coupled nuclei of an HMBC or H2BC cross peak. |
None
|
mirror
|
bool
|
Also set the values on the partner across the diagonal of a COSY, TOCSY, NOESY or ROESY plane. Ignored for other experiments, as in the plane's context menu. |
False
|
Returns:
| Type | Description |
|---|---|
str
|
The id of the first edit made. |
Raises:
| Type | Description |
|---|---|
ValueError
|
When no value is given, no peak is addressed, a 2D-only value is set on a 1D line, |
PermissionError
|
When the profile or a review copy does not allow editing. |
set_cluster
#
set_cluster(
group_id: int,
*,
reason: str,
pattern: str | None = None,
j_couplings: list[float] | None = None,
label: str | None = None,
) -> list[str]
Set the multiplicity pattern, couplings and label of a 2D cluster, as the plane's cluster editor does.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
group_id
|
int
|
The cluster, as |
required |
reason
|
str
|
Why the values are set. |
required |
pattern
|
str | None
|
Multiplet pattern; blank leaves it. |
None
|
j_couplings
|
list[float] | None
|
Coupling constants in Hz; |
None
|
label
|
str | None
|
Free-text label; |
None
|
Returns:
| Type | Description |
|---|---|
list[str]
|
The ids of the edits made, one per value set. |
Raises:
| Type | Description |
|---|---|
ValueError
|
When no value is given or no 2D peak belongs to the cluster. |
PermissionError
|
When the profile or a review copy does not allow editing. |
merge
#
merge(
frequencies_hz: list[float] | None = None,
*,
reason: str,
f1_hz: list[float] | None = None,
peak_ids: list[str] | None = None,
) -> str
Merge lines into one multiplet, or 2D cross peaks into one cluster.
Naming a subset of a cluster's peaks splits them off as a new cluster, as the plane does.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frequencies_hz
|
list[float] | None
|
Positions of the lines on the direct axis. |
None
|
reason
|
str
|
Why they are merged. |
required |
f1_hz
|
list[float] | None
|
Positions on the indirect axis, one per entry of |
None
|
peak_ids
|
list[str] | None
|
The peaks, by id, instead of positions. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
The id of the edit made. |
Raises:
| Type | Description |
|---|---|
ValueError
|
When no peak is named, an id names none, or |
PermissionError
|
When the profile or a review copy does not allow editing. |
split
#
Split the multiplet in [start_hz, end_hz] at the frequency boundary_hz; 1D only.
A 2D cluster is split by merge naming the peaks that form the new cluster.
set_tier
#
Override the automatic chemical-shift tier for the signal in this interval.
set_line_class
#
set_line_class(
frequency_hz: float,
*,
artifact_kind: int,
reason: str,
peak_id: str | None = None,
) -> str
Override the automatic class of the line at frequency_hz: an ArtifactKind (0 is compound).
set_integral_scale
#
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
#
Undo one edit by appending a compensating entry. Nothing is erased.
clear_edits
#
Withdraw every edit on this scan, as one undo entry; back to what the detector found on its own.
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.
experiment_type
property
#
experiment_type: ExperimentType
Experiment type in effect (COSY, T1_IR, …): the user's choice when set, else the detected one.
detected_experiment_type
property
#
detected_experiment_type: ExperimentType
Experiment type detected on import, whatever the user chose since.
signal
property
writable
#
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.
compatible_experiment_types
#
compatible_experiment_types() -> list[ExperimentType]
The experiment types this scan's axes allow it to be set to.
Returns:
| Type | Description |
|---|---|
list[ExperimentType]
|
The types, in catalogue order. |
set_experiment_type
#
set_experiment_type(kind: ExperimentType | None) -> None
Override the scan's experiment type, or remove the override, as the scan list's type menu does.
The change is audited and the scan's processing and plot follow it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kind
|
ExperimentType | None
|
The type to use; |
required |
Raises:
| Type | Description |
|---|---|
DataError
|
When the scan's axes rule |
SecurityError
|
When the profile is an operator, or the project is a review copy. |
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.
classify_lines
#
Class every picked line as compound, solvent or impurity.
Lines are matched against the sample's solvent and the tabulated impurities. Each line's
line_artifact_kind (an ArtifactKind), line_class_reason and line_class_source
are set; a class a person set with peaks.set_line_class is kept. The scan's own peaks are not changed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
impurity_hints
|
Sequence[str]
|
Names of impurities the sample is known to hold; they are accepted on weaker evidence. |
()
|
Returns:
| Type | Description |
|---|---|
list[PeakInfo]
|
The scan's 1D lines as the application shows them (the peak edits applied), classed. |
Raises:
| Type | Description |
|---|---|
ValueError
|
When the scan has no 1D spectrum. |
signal_crop
#
signal_crop(
exclude_ppm: Sequence[tuple[float, float]] = (),
) -> SignalCrop
The window of the spectrum that holds its signals, for 1D and 2D.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exclude_ppm
|
Sequence[tuple[float, float]]
|
Spans, in ppm, that hold no analyte signal (reference, solvent, water). |
()
|
Returns:
| Type | Description |
|---|---|
SignalCrop
|
The window of the direct axis, and of the indirect axis for a plane, in ppm; |
SignalCrop
|
signal stood out. |
Raises:
| Type | Description |
|---|---|
ValueError
|
When the scan has no spectrum. |
line_fit
#
line_fit(
regions: Literal["auto"]
| Sequence[tuple[float, float]] = "auto",
*,
shape: Literal[
"auto", "lorentzian", "gaussian", "pseudo_voigt"
] = "auto",
baseline_order: int = 1,
add_lines: bool = False,
range_ppm: tuple[float, float] | None = None,
exclude_ppm: Sequence[tuple[float, float]] = (),
) -> LineFitResults
Fit lines in regions of the spectrum, as the line-fit panel does; the scan must be the active scan.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
regions
|
Literal['auto'] | Sequence[tuple[float, float]]
|
|
'auto'
|
shape
|
Literal['auto', 'lorentzian', 'gaussian', 'pseudo_voigt']
|
Shape of the fitted lines; |
'auto'
|
baseline_order
|
int
|
Order of the polynomial baseline fitted with the lines. |
1
|
add_lines
|
bool
|
Whether the fit may add lines to the ones it starts from. |
False
|
range_ppm
|
tuple[float, float] | None
|
With |
None
|
exclude_ppm
|
Sequence[tuple[float, float]]
|
With |
()
|
Returns:
| Type | Description |
|---|---|
LineFitResults
|
Per-region results: lines (centre, height, width, area and its standard error, shape fraction, class and |
LineFitResults
|
reason), region quality and residual. Nothing is kept until |
Raises:
| Type | Description |
|---|---|
ValueError
|
When the scan is not the active scan, has no 1D spectrum, |
auto_line_fit_regions
#
auto_line_fit_regions(
range_ppm: tuple[float, float] | None = None,
) -> list[tuple[float, float]]
The regions an automatic line fit takes, without fitting them; the scan must be the active scan.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
range_ppm
|
tuple[float, float] | None
|
The span searched; the whole spectrum when omitted. |
None
|
Returns:
| Type | Description |
|---|---|
list[tuple[float, float]]
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
When the scan is not the active scan or has no 1D spectrum. |
stored_line_fits
#
stored_line_fits() -> list[FittedRegion]
The line fits and spin-system fits kept on the scan.
Returns:
| Type | Description |
|---|---|
list[FittedRegion]
|
One entry per stored fit, in the frame the peaks are shown in; empty when none is kept. |
region_area
#
region_area(
region: IntegrationRegion | tuple[float, float],
source: AreaSource | None = None,
) -> IntegrationRegionResult
The area of a region, from the trace integral or from the sum of the compound lines a line fit finds in it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
region
|
IntegrationRegion | tuple[float, float]
|
The region, or its |
required |
source
|
AreaSource | None
|
|
None
|
Returns:
| Type | Description |
|---|---|
IntegrationRegionResult
|
The region's result: area, the source it came from, its standard error for a line fit, and fit quality. |
Raises:
| Type | Description |
|---|---|
ValueError
|
When the scan has no spectrum. |
fit_spin_system
#
fit_spin_system(
seed: SeedSpinSystemResponse | FitSpinSystemResult,
range_ppm: tuple[float, float],
*,
linewidth_hz: float = 1.0,
baseline_order: int = 1,
lock_linewidth: bool = False,
max_seconds: float = 60.0,
) -> FitSpinSystemResult
Fit a spin system to a range of the spectrum; the scan must be the active scan.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
seed
|
SeedSpinSystemResponse | FitSpinSystemResult
|
The spin system to start from, from |
required |
range_ppm
|
tuple[float, float]
|
The span of the spectrum fitted. |
required |
linewidth_hz
|
float
|
Start value of the line width. |
1.0
|
baseline_order
|
int
|
Order of the polynomial baseline fitted with the system. |
1
|
lock_linewidth
|
bool
|
Hold the line width at its start value. |
False
|
max_seconds
|
float
|
Longest the fit runs; it returns the best parameters it had. |
60.0
|
Returns:
| Type | Description |
|---|---|
FitSpinSystemResult
|
The fitted shifts, couplings and line width, with the fit's quality and its curves. |
Raises:
| Type | Description |
|---|---|
ValueError
|
When the scan is not the active scan, has no 1D spectrum, or the fit could not be made. |
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
#
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.
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; |
Raises:
| Type | Description |
|---|---|
PipelineError
|
The pipeline has no output, several, or its output was not produced. |
apply
#
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 |
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 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. |
SeriesRegionFit
dataclass
#
The fit of one model to one region's trend.
Attributes:
| Name | Type | Description |
|---|---|---|
region_id |
str
|
The region, as it was named in the definition. |
x_label |
str
|
Name of the series variable. |
x_unit |
str
|
Unit of the series variable. |
x |
tuple[float, ...]
|
The variable at each point. |
values |
tuple[float, ...]
|
The region's measure at each point. |
sigmas |
tuple[float, ...]
|
Standard error of each value. |
fit |
SeriesFit
|
The fit: parameters with standard errors, starts and whether each start was automatic, derived values,
R², the fitter used and the fitted value at each point ( |
SignalCrop
dataclass
#
The window of a spectrum that holds its signals.
Attributes:
| Name | Type | Description |
|---|---|---|
found |
bool
|
Whether any signal stood out; when False both windows are None. |
direct |
tuple[float, float] | None
|
|
indirect |
tuple[float, float] | None
|
|
SmartFittingResult
dataclass
#
Result from SmartFittingAPI.fit with comprehensive metadata.
r_squared
instance-attribute
#
Coefficient of determination; None when the fit failed or the data is constant.
FunctionAnalysisResult
dataclass
#
BaseOp
#
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.
stored_metadata
class-attribute
instance-attribute
#
source
class-attribute
instance-attribute
#
applied_pipeline
class-attribute
instance-attribute
#
applied_pipeline: Postprocessing | None = None
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.
AnalysisScanRef
dataclass
#
Lightweight identity of a scan in the multi-scan analysis working set.
Holds only identifiers; the actual scan is resolved lazily from the repository.