GUI components

The GUI is a PySide6 application organised around a MainWindow that hosts the four persistent panels (data browser, plot, fit, Fourier) plus a log dock and a workspace selector for the time / individual-groups / frequency views. Non-modal dialog windows (Grouping, Detector Layout, Fit Wizard, Global Fit Wizard, Run Info, GLE setup) are launched from the main window. The end-user reference for the GUI lives in GUI usage; this API page lists the classes for developers who need to embed or extend the components, not for day-to-day use.

Main application

Application entry point for the Asymmetry GUI.

Launch with:

python -m asymmetry.gui.app
# or via the installed console script:
asymmetry-gui
asymmetry.gui.app.main()[source]

Main window

The MainWindow class is documented on its own page, Main window.

Panels

Data Browser

class asymmetry.gui.panels.data_browser.DataBrowserPanel(parent=None)[source]

Bases: QWidget

Logbook-style run table with grouping, sorting, filtering and co-add.

dataset_selected
selection_changed
group_selected
get_info_requested
grouping_requested
assign_profile_requested

(run_numbers, profile_name) — assign the runs to the named grouping profile (schema v17); MainWindow re-resolves and records the change.

extra_columns_changed
refit_coadded_requested
combine_status
datasets_changed
fit_group_requested
show_group_series_requested
ungroup_requested
remove_phases_requested
group_membership_changed
__init__(parent=None)[source]
batch_updates()[source]

Defer table rebuilds while adding or removing many datasets.

Inside the block, _rebuild_table, _sort_table and _resize_columns_to_content record that they were requested instead of running; the outermost exit replays each at most once. Callers must not read table rows inside the block (model state — _datasets, _display_order — is always current). Nesting is safe.

set_project_model(project_model)[source]

Bind the panel to the canonical group registry (D6).

MainWindow calls this whenever it (re)creates the project model — on construction and after a project load replaces the model — so the panel always reads and mutates the live data_groups. Collapse flags for ids no longer present are dropped; the group view is rebuilt from the (possibly freshly loaded) registry.

sync_groups_from_project_model()[source]

Rebuild the group view from the canonical registry (D6).

Ensures every group carried by a legacy browser_state.data_groups block (a pre-registry project, or a standalone panel restore) exists in the registry, then integrates the registry’s groups into the display order, re-derives multi-membership, and repaints. Idempotent — safe to call after a load rebinds a fresh model or after a browser-only restore.

A seed entry carrying parent_group_id (D1/D2) is re-materialised as a phase — ordinal, range, boundaries, colour and provenance included — so a standalone panel restore rebuilds the nested rows, not a flat group that happens to name a parent. A phase can legitimately hold a single run (the manual “Move to phase” override can leave one there), so it is admitted at one member where an ordinary group needs two.

all_datasets()[source]

Return the browser’s datasets in insertion order.

next_derived_run_number()[source]

Reserve a run number for a synthetic or degraded run.

Numbers start at 90001 and skip anything already loaded or reserved this session. Real ISIS run numbers can exceed this (modern runs are six digits), so a file loaded later could carry the same number — add_dataset keys entries by run number and would replace the derived run. Acceptable for session-scoped derived data; revisit if derived runs gain a persistent identity.

release_derived_run_number(number)[source]

Return a reserved derived run number that was never used.

Lets a dialog hand back the number it reserved when generation fails, so a failed Generate does not leave a permanent gap in the SIM series. A number already claimed by a loaded dataset is left untouched.

add_dataset(dataset)[source]
create_data_group(run_numbers, name=None, group_id=None, collapsed=False, kind='user', order_key='run')[source]

Create a group over run_numbers in the canonical registry (D6).

Multi-membership (D2): this adds a group; it never strips its runs from any group they already belong to. Requires at least two valid (loaded) runs. kind is "user" or "auto" (a machine-minted batch group, D3); order_key seeds the group’s member ordering. Returns the new group id, or None when fewer than two runs are valid or group_id already exists.

ungroup(group_id, *, orphan_series=True)[source]

Dissolve group_id entirely, returning its now-orphaned runs to top level.

Members still belonging to another group keep their rows; only members left with no group return to the ungrouped list (at the group’s former slot). orphan_series (D7) selects the disposition of any series the group owns: True freezes each to a standalone legacy analysis (group_id=None), False deletes them. The host prompts for this choice (see ungroup_requested); the browser passes it straight through and returns the removed batch_ids (empty when freezing) so the host can clean up their fit slots / panels.

remove_phases(parent_id, *, orphan_series=True)[source]

Dissolve every phase of parent_id, keeping the series group (D2).

The counterpart of applying a partition: the members all come back as plain members of the series, in the series’ own order. orphan_series matches ungroup() — True freezes each phase’s owned series to a standalone legacy analysis, False deletes them and returns their batch_ids. The host prompts for the choice (see remove_phases_requested).

add_runs_to_group(run_numbers, group_id)[source]

Add existing dataset runs into an existing group as a new membership (D2).

Multi-membership: a run already in another group keeps that membership and gains this one (rendered as a marked copy); it is never stolen. A run gaining its first membership leaves the ungrouped list.

Returns:

bool – True if at least one run was added.

remove_runs_from_group(run_numbers)[source]

Remove each run’s primary group membership (D2).

A run in several groups loses only its primary membership; the earliest remaining copy is promoted to primary. A run’s last membership removal returns it to the ungrouped list. Returns True when at least one membership was removed.

multi_period_run_numbers()[source]

Return run numbers of loaded datasets that carry more than one period.

resizeEvent(event)[source]

Keep the columns filling the panel as the dock is resized.

Deferred one event-loop turn: the table’s viewport geometry settles via the layout pass after this event, so an immediate fit would read the previous width.

changeEvent(event)[source]

Re-apply two-line row heights when fonts change.

The heights are explicit pixels computed from the table font at rebuild time; a font change (UI scale) would otherwise leave the comment line clipped until the next rebuild.

extra_columns()[source]

Return a copy of the current extra-column definitions (custom + metadata).

custom_label_fields()[source]

Return (label, "custom:<id>") pairs for the user’s custom columns.

These are the columns offered as the plot legend label and the parameter trend x-axis. Their per-run values live in dataset.metadata["custom_fields"] keyed by the same id, so consumers resolve them without reaching back into the browser.

custom_values_by_run()[source]

Map each known run number to its live custom-column values.

The source of truth for custom columns is dataset.metadata["custom_fields"] (keyed by column id). Exposing it per run lets trend consumers re-link existing batch results to a column that was added or populated after the fit completed (the ordering trap) without re-running the batch. A run with no custom values maps to an empty dict so consumers can clear stale snapshots, not just add.

Combined (co-added/subtracted) datasets are included here too: their dataset object lives in _datasets under the combined run number, same as any regular run, so a single pass over _datasets already covers them. _combined_datasets maps a combined run number to its list of source run numbers, not to a dataset, and must not be iterated as (run_number, dataset) pairs.

angle_x_field()[source]

Return (label, id) for the special Angle field, or None if absent.

The Angle field is promoted to a first-class trend x-axis rather than offered among the generic custom columns, so consumers route it separately.

add_extra_column(field_key)[source]

Add a metadata-backed dynamic column to the browser table.

add_custom_column(label)[source]

Create an empty, user-editable custom column and return its definition.

has_angle_column()[source]

Return True when the singleton special “Angle” field exists.

add_angle_column()[source]

Add the singleton special “Angle (°)” field (numeric degrees per run).

Returns the existing Angle field if one is already present, so the action is idempotent and never produces a duplicate.

rename_extra_column(column_id, new_label)[source]

Rename a column’s gui-facing label (its source_key is untouched).

remove_extra_column(field_key_or_id)[source]

Remove an extra column by id or (for metadata columns) source key.

get_extra_columns()[source]

Return the metadata source keys currently shown (for inclusion tracking).

Custom columns have no metadata source and are intentionally excluded — this drives the Get Info “Include in Data Browser” checkboxes, which only concern NeXus/metadata fields. The from-log pseudo-keys are appended to mirror the fixed T/B columns’ include state.

set_use_temperature_from_log(enabled)[source]

Set the global temperature-from-log display option.

use_temperature_from_log()[source]

Return the global temperature-from-log display option.

set_dataset_temperature_from_log(run_number, enabled)[source]

Override temperature-from-log display for a single dataset.

dataset_uses_temperature_from_log(run_number)[source]

Return whether one dataset is configured to show log temperature.

set_use_field_from_log(enabled)[source]

Set the global field-from-log display option (B from the data log).

The analogue of set_use_temperature_from_log() (WiMDA’s Bfromaveinblog): show the mean of the magnetic-field log channel in the B column instead of the header scalar.

use_field_from_log()[source]

Return the global field-from-log display option.

set_dataset_field_from_log(run_number, enabled)[source]

Override field-from-log display for a single dataset.

dataset_uses_field_from_log(run_number)[source]

Return whether one dataset is configured to show log field.

displayed_coordinate(run_number)[source]

The field/temperature the browser currently displays for a run.

Honours the log toggles and per-dataset overrides — the same resolution as the fixed B/T columns (asymmetry.gui.panels.data_browser.DataBrowserPanel._field_for_display, asymmetry.gui.panels.data_browser.DataBrowserPanel._temperature_for_display) — so a batch trend and its CSV export plot each run at the abscissa the user sees in the table, not the parked header setpoint. When the browser shows a logged value it replaces the scalar; an axis with no recorded value is None (off that axis), never 0 — preserving the trend’s “missing coordinate” semantics rather than the columns’ missing-value marker.

custom_column_value(dataset, column_id)[source]

Return the stored per-run text for a custom column ("" if unset).

get_selected_group_ids()[source]
get_current_selection_key()[source]

Return the key for the current row, if any.

get_current_dataset()[source]

Return dataset on the current table row when that row is a run.

is_single_group_selected()[source]

Return True when the selection contains exactly one group header row.

get_group_name(group_id)[source]
get_group_id_for_run(run_number)[source]

Return run_number’s primary data-group id, if any (D2).

Compatibility accessor: under multi-group membership a run may belong to several groups; this returns only the primary (first) membership. Callers that need every membership use get_group_ids_for_run(). (Phase 3 reworks the fit-flow callers that still assume single membership.)

get_group_ids_for_run(run_number)[source]

Return every group id run_number belongs to, primary first (D2).

get_group_member_run_numbers(group_id)[source]

Return run numbers currently belonging to group_id.

get_all_group_ids()[source]

Return every current group id, from the canonical registry (D6).

get_dataset(run_number)[source]
set_grouping_profile_provider(provider)[source]

Inject a callable returning the project’s live grouping profiles.

The panel derives the per-run profile marker and the Assign-Grouping-Profile context menu from it; a provider (rather than a copied list) keeps the panel current when MainWindow rebuilds the profile list on Apply.

set_highlighted_runs(run_numbers)[source]

Tint run_numbers with the FitSeries membership indicator (red tint).

Pass an empty set or None to clear all highlights. The tint is purely decorative — it never alters the table’s selection state.

select_runs(run_numbers)[source]

Perform a true selection of run_numbers in the browser table.

This is a real selection (drives selection_changed, updates the fit panel, etc.), distinct from the decorative red tint applied by set_highlighted_runs(). Existing selection is replaced. Runs not currently visible in the table are silently skipped.

get_selected_datasets()[source]
get_all_datasets()[source]

Return all datasets currently present in the browser.

is_combined_dataset(run_number)[source]

Return True when run_number refers to a combined row.

get_combined_source_datasets(run_number)[source]

Return hidden source datasets for a combined row.

rebuild_combined_dataset(run_number)[source]

Recompute one combined dataset from its hidden source datasets.

render_logbook_tsv()[source]

Render the TSV logbook to a string, reading widget/grouping state.

Returns (content, exported_rows). The render reads the table model (columns, grouping, every dataset) so it must run on the GUI thread; the caller writes content to disk (off-thread where it matters). The export includes rows hidden by filters or collapsed groups.

export_logbook_tsv(path)[source]

Render and write the TSV logbook to path (synchronous helper).

render_logbook_rtf()[source]

Render the RTF logbook to a string, reading widget/grouping state.

Returns (content, exported_rows). Like render_logbook_tsv(), the render reads the table model and must run on the GUI thread; the caller writes the bytes. Includes rows hidden by filters/collapsed groups.

export_logbook_rtf(path)[source]

Render and write the RTF logbook to path (synchronous helper).

move_run_to_phase(run_number, phase_id, *, series_group_id)[source]

Move run_number into phase_id (None excludes it) within one series, then repaint.

series_group_id is the partitioned series the move belongs to: a run may sit in several data groups, so the phase it leaves is looked up in that series alone. The registry mutation is the core model’s (ProjectModel.move_run_to_phase re-orders both affected phases along the sweep axis and recomputes their ranges); the panel rebuilds and reports the edit so the host re-derives series staleness — a phase-bound global-fit series whose membership just changed no longer matches what was last fit. One report per affected phase, so a move between two phases marks both.

apply_degrade_statistics(run_number, factor, seed)[source]

Resample run_number’s histograms by factor; add the derived run.

Returns the new browser dataset, or None when the source has no detector histograms or the factor is invalid. The source run is never modified (WiMDA degraded in place; see docs/porting/simulate-mode/).

eventFilter(watched, event)[source]
sort_by_run_number_if_unordered()[source]

Apply an ascending run-number sort when rows aren’t already in run order.

Called after a multi-file load (F8): an OS file picker can hand files back in a scrambled order, so the browser’s insertion order need not be ascending by run — which makes a shift-range selection silently non-contiguous. This only nudges the default case: if the user has already chosen a sort column, or the rows are already ascending by run, it does nothing (and never reorders a run inside a data group). Returns True when it applied the sort.

shutdown_workers(timeout_ms=10000)[source]

Stop background combine work (call from the main window’s closeEvent).

The browser is a docked widget, so its own closeEvent never fires; the main window shuts it down alongside the other panel runners.

clear()[source]
add_combined_dataset(source_run_numbers, *, sign=1, operation=None, combined_run_number, metadata_overrides=None, source_expectations=None)[source]

Restore ordered sources atomically, raising CombineError for incompatible inputs.

restore_unavailable_combination(definition, reason)[source]

Keep an unreconstructable definition and its history without hiding sources.

get_state()[source]
restore_state(state)[source]
staticMetaObject = PySide6.QtCore.QMetaObject("DataBrowserPanel" inherits "QWidget": Methods:   #33 type=Signal, signature=dataset_selected(int), parameters=int   #34 type=Signal, signature=selection_changed()   #35 type=Signal, signature=group_selected(QString), parameters=QString   #36 type=Signal, signature=get_info_requested(int), parameters=int   #37 type=Signal, signature=grouping_requested(int), parameters=int   #38 type=Signal, signature=assign_profile_requested(PyObject,QString), parameters=PyObject, QString   #39 type=Signal, signature=extra_columns_changed()   #40 type=Signal, signature=refit_coadded_requested(PyObject), parameters=PyObject   #41 type=Signal, signature=combine_status(QString), parameters=QString   #42 type=Signal, signature=datasets_changed()   #43 type=Signal, signature=fit_group_requested(QString), parameters=QString   #44 type=Signal, signature=show_group_series_requested(QString), parameters=QString   #45 type=Signal, signature=ungroup_requested(QString), parameters=QString   #46 type=Signal, signature=remove_phases_requested(QString), parameters=QString   #47 type=Signal, signature=group_membership_changed() )

Plot panel

class asymmetry.gui.panels.plot_panel.PlotPanel(parent=None, *, domain='time')[source]

Bases: QWidget

Matplotlib canvas for time- and frequency-domain plots.

Notes

The bunch factor controls both the plotted representation and the dataset prepared for fitting in the GUI. The stored source dataset remains unchanged, and any rebinned fit dataset is produced as a temporary copy.

bunch_factor_changed
fit_range_changed
fit_range_guide_changed

A handle of the range guides moved while they were showing a window other than the project’s own (the Batch tab’s series window, D8). The project range is untouched; whoever set the guide owns the new window.

view_limits_changed
polarization_axis_changed
fit_target_projection_changed

Emitted with the projection label when a stacked subplot is clicked to become the single-fit target (multi-subplot / ALL view only).

overlay_toggled
waterfall_changed

Emitted when the waterfall toggle or manual-Δ field changes and the host should re-render the overlay (mirrors overlay_toggled).

time_view_changed
cursor_coords_changed
moments_window_changed

Spectral-moments overlay drags (frequency panel) — window in canonical MHz.

moments_cutoff_changed
moments_drag_finished

A moments-handle drag has ended (mouse released after an actual move): the signal for “recompute with full bootstrap uncertainty now”.

grouping_hint_requested

The user clicked the “Open Grouping…” link in the transverse-field grouping-hint bar (see set_grouping_hint()); the host opens the grouping dialog for the current run.

grouping_hint_dismissed

The user dismissed the grouping-hint bar (the ✕ button); the host records the dismissal so the nudge stays hidden for that run.

frame_changed

The projection chips switched frame — True for rotating, False for Lab.

__init__(parent=None, *, domain='time')[source]
set_grouping_hint(text)[source]

Show or hide the transverse-field grouping-nudge bar.

text may contain rich text with an <a href=…>Open Grouping…</a> link; a falsy value hides the bar. Idempotent and safe to call on a matplotlib-less panel (it simply no-ops).

fit_label(fit_id)[source]

The menu name for fit_id: as the host named it, else “Single fit” or the id.

set_fit_labels(labels)[source]

Record display names for fit ids, read back by fit_label().

Pushed by the host from FitSeries’ own name — never re-derived here — whenever it refreshes the representation’s series (recording, project restore, a rename). Does not draw.

set_frequency_axis_mode(mode)[source]

Set the frequency x-axis transform mode programmatically.

mode is one of "absolute", "shift", or "relative_ppm".

frequency_axis_mode()[source]

Return the current frequency x-axis transform mode.

is_frequency_axis_relative_to_reference()[source]

Return whether the frequency x axis is a reference-shifted axis.

True for both shift modes ("shift" and "relative_ppm"); the phase-estimation window logic narrows around the reference whenever the view is reference-shifted, so this stays a single predicate.

get_frequency_view_window_mhz(*, reference_dataset=None)[source]

Return the current frequency-view x window in canonical absolute MHz.

The window is inverted through the ACTIVE dataset’s resolved reference — the phase-estimation window this feeds is a per-active-run concept, so an explicit reference_dataset (when the caller knows the active run) overrides the stored active reference.

decimation_chip_text(ax=None)[source]

Return the decimation chip text on ax (None when not displayed).

active_domain()[source]

Return the fixed domain represented by this panel.

has_plot_content()[source]

Return True when the panel currently holds plotted datasets.

set_custom_label_fields(fields)[source]

Set the data-browser custom columns offered as legend-label options.

fields is a list of (display_label, "custom:<id>") pairs. The combo is rebuilt (selection preserved) and, if the active label field is a custom column whose label changed, the plot is redrawn so the legend tracks the rename.

set_custom_values_by_run(values_by_run)[source]

Set the run_number -> {column-id: value} custom-label fallback.

Datasets that do not carry custom_fields inline — averaged FFT spectra copy their metadata from a per-group source that has none — can still resolve a custom-column label from this host-provided map, keyed by run number. Redraws when a custom field is active so the change is reflected immediately (e.g. a value edited after the spectrum was drawn).

current_time_view_mode()[source]

Return current main time-domain plot mode.

set_time_view_modes(modes, current_mode=None)[source]

Update the explicit time-domain view selector.

set_current_time_view_mode(mode, *, emit_signal=False)[source]

Select the active time-domain view mode.

is_overlay_enabled()[source]

Return whether multi-selection overlays are currently enabled.

set_overlay_enabled(enabled, *, emit_signal=False)[source]

Set overlay mode from state restore or external UI events.

is_waterfall_enabled()[source]

Return whether waterfall stacking is currently enabled.

set_waterfall_enabled(enabled, *, emit_signal=False)[source]

Set waterfall mode from state restore or external UI events.

waterfall_offset()[source]

Return the manual waterfall Δ, or None when spacing is automatic.

set_waterfall_offset(offset, *, emit_signal=False)[source]

Set the manual waterfall Δ (None for auto), updating the field.

set_active_label_group(group_id)[source]

Switch legend label-field context between ungrouped and Data Group views.

set_counts_rebunch_provider(provider)[source]

Install the histogram-backed display reducer returning a resolved dataset.

The provider replays corrections and merges recorded output bins in every binning and period mode. Curve-only and rotated inputs are handled directly by the panel’s independent curve-bin operation.

get_analysis_dataset(dataset)[source]

Hand out toolbar observations with their actual count-bin membership.

update_frequency_reference(dataset)[source]

Public entry-point: sync the reference field from dataset metadata.

Call this whenever the active dataset changes so the Reference spinbox shows the correct value even before an FFT has been computed.

get_fit_dataset(dataset, fit_range=None)[source]

Return dataset restricted to a fit range.

fit_range is the window to crop to; without one the plot’s own (project-wide) fit range applies. A batch run passes its series’ recipe range (D8), which is the series’ own property and independent of what the plot is showing.

get_full_fit_context(dataset)[source]

Return dataset uncropped, alongside the active fit range.

The companion to get_fit_dataset() for a consumer that needs the whole record and the range separately rather than the crop: the fit wizard detects lines across the full record (a heavily damped line lives before most fit ranges start, a slow one needs the tail) while still reporting what the user’s range would do to them.

get_fit_range()[source]

Return the active fit range as (x_min, x_max).

get_view_limits()[source]

Return the currently displayed x/y limits from the toolbar fields.

set_view_limits(x_min, x_max, y_min, y_max)[source]

Hold both axes at the given window, as an explicit typed limit would.

reset_view_limits()[source]

Forget every held axis limit, so the next render frames afresh.

Project teardown only (close / new project): a blank canvas or a run switch never resets a held value.

get_bunch_factor()[source]

Return the currently configured plot-panel bunch factor.

decimation_enabled()[source]

Return whether display-only plot decimation is enabled.

set_decimation_enabled(enabled, *, redraw=True)[source]

Enable or disable display-only plot decimation.

set_bunch_factor(value, *, emit_signal=True)[source]

Set the plot-panel bunch factor and optionally emit the normal signal.

set_custom_x_axis_label(label)[source]

Pin (or clear) a custom x-axis label that survives replots.

A replot recomputes and overwrites the x-axis label, so a caller that wants a bespoke label — for example a Fourier annotation workflow labelling a hyperfine-coupling axis — pins it here. It is re-applied after every render (including the show-time replot) instead of being wiped. Pass None to restore the computed label.

add_persistent_frequency_marker(freq_mhz, label='')[source]

Pin a vertical frequency-line marker that survives replots.

freq_mhz is a canonical (absolute) frequency in MHz; it is display-unit converted at draw time so the marker tracks the active axis unit. The marker is recreated on every render, so — unlike a one-off axvline drawn straight onto the axis — it is not wiped by the show-time replot. Use for Fourier line labels (ν₁, ν₂, A_µ, γ_μ·B).

clear_persistent_frequency_markers()[source]

Remove every pinned frequency-line marker and redraw.

get_current_polarization_axis()[source]

Return current polarization selector key (P_* or ALL).

shown_fit_ids(run_number)[source]

Ordered fit ids drawn on run_number, active series first (D5).

Defaults to the active series when this run is one of its members (i.e. the panel holds a curve for it under that id), and to the run’s own single fit otherwise. set_shown_fits() overrides the default for one run; the override is transient view state, not project state.

set_shown_fits(run_number, fit_ids)[source]

Override which fits are drawn on run_number (transient view state).

Pass an empty list to draw none; the default is restored by clear_shown_fits().

clear_shown_fits(run_number)[source]

Drop run_number’s override so shown_fit_ids() defaults again.

set_active_fit_id(fit_id)[source]

Make fit_id the active series’ overlay, redrawing the current view.

The active fit is drawn in the fit colour on every run it covers; every other shown fit takes a trace colour and a legend entry.

active_fit_id()[source]

Return the active series’ fit id, or None.

has_fits_for_series(fit_id)[source]

Return True when any run holds a stored curve under fit_id.

clear_fits_for_series(fit_id)[source]

Drop every run’s curve, components and metadata stored under fit_id.

The overlay half of deleting a series (D6): other series’ overlays and the runs’ own single fits are untouched.

clear_run_fit(run_number, fit_id)[source]

Drop run_number’s curve, components and metadata under fit_id, on every axis.

The overlay half of opening another saved single fit or deleting one (single-fit plan D6): the run’s other fits are untouched.

stored_fit_ids(run_number)[source]

Fit ids this panel holds a curve for on run_number.

set_projections(projections, selected=None, *, memory_key=None)[source]

Show/update the projection chip bar, or hide it when unavailable.

projections is an ordered list of {"label", "tint"?} dicts; selected is the subset of labels to show as subplots (defaults to all). The bar (and any multi-projection behaviour) is suppressed when fewer than two projections exist. memory_key names the grouping the chip selection is remembered under (default: the projection set itself).

offers_rotating_frame()[source]

True while the displayed projections include the transverse pair P_x, P_y.

frame_rotating()[source]

True while the projection chips show the rotating frame.

set_frame_status(text)[source]

Show (or clear) the rotating frame’s last change on the title strip.

show_message(message)[source]

Replace the plot with a centred message (the rotating frame awaiting ν_RF).

rekey_projection_memory(rekey)[source]

Rename every remembered selection’s key (a grouping was renamed).

remembered_projection_selection(memory_key)[source]

The selection last shown under memory_key, or [].

selected_projection_labels()[source]

Return the projection labels currently selected.

The chip bar is the source of truth once populated; the stored copy is the fallback during project restore, before the bar has been rebuilt.

projection_tint(label)[source]

Return the frame/identity tint for a projection label, if any.

fit_target_projection()[source]

Return the projection whose subplot is the active single-fit target.

Only meaningful in the stacked multi-subplot view; None otherwise.

set_fit_target_projection(label, *, emit=True)[source]

Mark label’s subplot as the single-fit target and redraw its box.

The fit target is also the focus for the manual Y-limit controls, so a change re-mirrors the incoming subplot’s held limits into the Y fields.

plot_vector_subplots(datasets_by_axis)[source]

Render the selected projections as stacked subplots.

plot_grouped_time_domain_subplots(datasets)[source]

Render grouped time-domain traces as stacked subplots.

plot_maxent_reconstruction(datasets, *, combined=False)[source]

Overlay the MaxEnt time-domain reconstruction on the measured data.

Each dataset carries the observed signal in asymmetry and the forward-model reconstruction + weighted residual in metadata['maxent_model'] / ['maxent_residual']. Two layouts share the same data and χ²:

  • per-group (default): one main axis (data points + model line) above a residuals strip per group, stacked vertically;

  • combined (combined=True): every group’s data+model overlaid on a single colour-coded axis above one shared residuals strip.

The displayed χ² is the engine’s by construction (the residuals are (data − model)/σ), so both layouts report the same total.

set_fit_range(x_min, x_max)[source]

Set fit range limits and refresh visual handles.

set_fit_range_guide(x_min, x_max)[source]

Draw (and drag) the range guides over a window other than the project’s.

The Batch tab’s series window applies while that tab is visible. Either bound left None falls back to the project range, and two None bounds hand the guides back to the project range. The stored single-fit range never moves.

plot_datasets(datasets)[source]

Plot multiple datasets on the same axes with per-dataset colours.

Each dataset is assigned a colour from matplotlib’s default cycle (C0, C1, …). Any stored fit curve for a run is drawn in a matching style, with high-contrast overrides for period-mode datasets. Low-count (grey) points are still drawn at reduced opacity. The axes limits are initialised from the combined data extent on the first call, then held fixed on subsequent redraws.

Delegates to plot_dataset() when datasets has exactly one entry so that the single-dataset code path (limit initialisation, fit-range handling, etc.) is exercised unchanged.

set_diamagnetic_overlay(time_us, signal, *, run_number=None)[source]

Set (or clear) the diamagnetic-fit curve drawn on the time-domain view.

Passing None for the arrays clears it. The overlay is tagged with run_number and only drawn while that run is displayed, so it never lingers on an unrelated run; it is redrawn on the next plot_dataset() call for a time-domain panel.

plot_dataset(dataset)[source]

Plot a dataset, optionally rebinned according to the bunch factor.

The input dataset is stored unchanged as the current dataset. If the bunch factor is greater than 1, temporary rebinned arrays are created for plotting. The source dataset itself is never mutated.

current_frequency_dataset()[source]

Return the active frequency-domain dataset, or None.

active_spectrum_for_moments()[source]

W15 accessor: (x, amplitude, errors, x_unit) for the active spectrum.

x is the canonical absolute MHz axis (the unit-invariant the moments feature works in) and x_unit is "mhz"; the caller converts to its chosen field unit. Returns None when no spectrum is shown or the active spectrum is a correlation axis (a hyperfine coupling, not a field).

set_moments_overlay(*, window_mhz, cutoff_fraction, peak_amplitude, visible)[source]

Show/update the moment window + cutoff line on the spectrum plot.

window_mhz is the analysis window in canonical absolute MHz; the cutoff line is drawn at peak_amplitude · cutoff_fraction. Drawn only on the frequency panel.

clear_moments_overlay()[source]

Hide the moment window/cutoff overlay.

plot_fit(t_fit, y_fit, label='Fit', component_curves=None, fit_result=None, fit_function=None, run_number=None, fit_id='single')[source]

Overlay a fit curve on the current plot.

The fit curve will be retained even when bunching or limits change.

Parameters:
  • t_fit (array) – Time points for the fit curve.

  • y_fit (array) – Fitted asymmetry values.

  • label (str, optional) – Label for the fit curve in the legend.

  • fit_result (object, optional) – FitResult containing chi_squared, parameters, uncertainties, etc.

  • run_number (int, optional) – Run the fit was computed for. In a multi-run overlay stacked view _current_dataset points at the first projection’s last run, not the fitted (selected) run, so the caller passes the fitted run explicitly to keep the overlay key and the persisted single-fit slot on the same run. Defaults to inferring it from _current_dataset.

  • fit_id (str, optional) – Which fit this curve is: a FitSeries.batch_id or the default "single" (D5). A run keeps one curve per fit id, so a series overlay never displaces the run’s own single fit.

set_global_fits(fit_curves_dict, *, fit_id='single', fit_labels=None)[source]

Set fit curves from global fitting.

Parameters:
  • fit_curves_dict (dict) – Dictionary mapping run_number -> (t_fit, y_fit, label, component_curves), (t_fit, y_fit, label, component_curves, fit_result), or (t_fit, y_fit, label, component_curves, fit_result, fit_function), or (t_fit, y_fit, label, component_curves, fit_result, fit_function, axis_key).

  • fit_id (str, optional) – The fit these curves belong to: a FitSeries.batch_id for a recorded series, or "single" for the transient overlays (grouped previews, count fits) that are not series work.

  • fit_labels (dict, optional) – {fit_id: display name} for the toolbar’s Fits menu (set_fit_labels()) — the series’ own name, not the generic per-curve legend text a caller may pass as label.

clear(*, message=None)[source]

Clear the plot and reset stored data.

When message is given, draw it as a centred grey placeholder over the (axis-off) plot area — the empty-state pattern used by asymmetry.gui.panels.alc_panel.ALCScanView.clear(). The frequency panel passes a message to prompt the user to compute a spectrum (an FFT is computed on demand, never automatically); every other caller leaves message None and gets an unchanged blank plot.

A blank canvas never touches the held axis limits: browsing onto an uncomputed run is momentary, and the user’s window must survive to the next compute. Only project teardown forgets them, via reset_view_limits().

resizeEvent(event)[source]

Keep the canvas width aligned with the viewport during grouped scrolling.

clear_fit()[source]

Clear all fit curves and redraw the plot.

clear_fits_for_runs(run_numbers)[source]

Clear stored fit overlays for the provided run numbers.

get_current_plot_export_data(datasets=None)[source]

Capture displayed results and resolved display metadata for export.

export_plotted_data_as_text()[source]

Export the visible data and fit curves as plain text.

export_plots_to_gle()[source]

Export the visible curves as GLE with their plotted errors and bands.

export_current_plot()[source]

Export current main-plot view as GLE (with optional compiled output).

set_rrf_feature_enabled(enabled)[source]

Enable/disable the whole RRF surface (the Advanced toggle, app-level).

Forwards to the RRF controls (which appear/disappear under the usual view condition) and redraws so the display reverts to or from the rotating frame immediately.

rrf_has_active_parameters()[source]

True when the RRF controls carry an active frame (enabled + ν₀ > 0).

Independent of the feature toggle: used on project open to decide whether a stored RRF configuration should auto-enable the toggle so the user’s analysis is not silently hidden.

rrf_fit_frequency_mhz()[source]

Frame frequency ν₀ (MHz) when an RRF fit should be performed, else None.

The fit auto-couples to the plot’s RRF controls: a single composite fit runs in the rotating frame exactly when the RRF display is active (the feature is on, the controls are enabled with ν₀ > 0, and the FB-asymmetry time view is showing). The fit consumes raw data with this offset and reports lab-frame frequencies (δν + ν₀).

get_state()[source]

Return a serialisable snapshot of the plot panel state.

This captures the bunch factor, axis limits, the currently displayed run number, and any stored fit curves. Fit curve arrays are serialised as plain Python lists for JSON compatibility.

Returns:

dict – Plot state suitable for inclusion in a project file.

restore_state(state, dataset=None)[source]

Restore plot panel state from a saved dict.

Parameters:
  • state (dict) – Plot state as returned by get_state().

  • dataset (MuonDataset, optional) – Dataset to re-plot after restoring limits. If None no plot is drawn, but all other state (limits, bunch factor, fit curves) is still applied.

staticMetaObject = PySide6.QtCore.QMetaObject("PlotPanel" inherits "QWidget": Methods:   #33 type=Signal, signature=bunch_factor_changed(int), parameters=int   #34 type=Signal, signature=fit_range_changed(double,double), parameters=double, double   #35 type=Signal, signature=fit_range_guide_changed(double,double), parameters=double, double   #36 type=Signal, signature=view_limits_changed(double,double,double,double), parameters=double, double, double, double   #37 type=Signal, signature=polarization_axis_changed(QString), parameters=QString   #38 type=Signal, signature=fit_target_projection_changed(QString), parameters=QString   #39 type=Signal, signature=overlay_toggled(bool), parameters=bool   #40 type=Signal, signature=waterfall_changed()   #41 type=Signal, signature=time_view_changed(QString), parameters=QString   #42 type=Signal, signature=cursor_coords_changed(PyObject), parameters=PyObject   #43 type=Signal, signature=moments_window_changed(double,double), parameters=double, double   #44 type=Signal, signature=moments_cutoff_changed(double), parameters=double   #45 type=Signal, signature=moments_drag_finished()   #46 type=Signal, signature=grouping_hint_requested()   #47 type=Signal, signature=grouping_hint_dismissed()   #48 type=Signal, signature=frame_changed(bool), parameters=bool )

Fit panel

class asymmetry.gui.panels.fit_panel.FitPanel(parent=None)[source]

Bases: QWidget

Fit setup and results for single datasets and global multi-dataset fits.

fit_completed
preview_requested
members_changed
global_fit_started
global_fit_completed
grouped_fit_completed
apply_wizard_phases_requested
series_group_requested
add_single_fit_to_series_requested
saved_fit_open_requested
saved_fit_rename_requested
saved_fit_delete_requested
saved_fit_compare_requested
single_dataset_bound

A record was bound to the Single tab — the host draws its saved fits.

fit_range_edit_committed
series_open_requested
series_new_from_selection_requested
series_new_from_group_requested
series_rename_requested
series_delete_requested
batch_fit_range_changed
batch_seeding_mode_changed
trends_requested
tab_changed
field_direction_answered
__init__(parent=None)[source]
set_active_projection_label(projection, tint=None)[source]

Show/hide the ‘Fitting: <projection>’ echo for the bound projection.

tint colours the text to match the projection’s subplot frame.

set_batch_seeding_mode(mode)[source]

Forward the batch-series seeding mode to the Batch tab.

domain()[source]

Return the current fitting domain.

set_rrf_frequency_provider(provider)[source]

Forward the rotating-frame ν₀ provider to the single-fit tab.

set_domain(domain)[source]

Switch the fit panel between time- and frequency-domain workflows.

clear()[source]

Reset all fit-panel domain state.

set_dataset(dataset)[source]

Set the current dataset for single fitting tab.

D5 “refresh-unless-fitted”: three branches decide what the form shows.

  1. PROTECTED — the restore mediator (_single_fit_restore_provider) hands back a non-empty payload: a genuine recorded fit for this (run, representation, projection) slot, restored verbatim (provenance own_slot, no badge). This covers both a single fit and a batch/global write-back — the mediator reconstructs a payload from a batch member’s persisted FitSlot when it has no ui_state of its own (see MainWindow._single_fit_restore_payload), so protection here is driven purely by “did the mediator hand back content”, with no separate probe needed. Never auto-overwritten.

  2. An empty mediator payload: the mediator has a real opinion this exact slot was checked and confirmed unfit (a genuine projection, or the default slot once another projection has been fit). REFRESHABLE: once any fit exists in the session, refresh onto it (D5 — even a “domain default” is refreshable); otherwise blank to the domain default exactly as before (this slot was positively checked, so there is nothing to carry from a previous run either).

  3. No mediator opinion at all (None — a legacy/no-mediator run, or the default slot with no other projection info): REFRESHABLE via _refresh_single_fit_form, which prefers the session’s most recently fitted state, falling back to today’s pre-D5 behaviour (this run’s own cached form, or the previously active run’s displayed form) only once nothing has been fitted yet.

A dismissable badge (D2/F6) surfaces (B)/(C) whenever a source run is named — carry-forward itself is kept (useful for run series), but the panel must say so instead of silently presenting another run’s values as this run’s own.

set_single_fit_restore_provider(provider)[source]

Install the per-projection single-fit restore mediator (or clear it).

The main window passes a callable that maps the dataset being bound to the persisted single-fit form payload for the active (run, representation, projection) slot — or None to defer to the panel’s own run-keyed state (the default / legacy-project path).

set_full_fit_context_provider(provider)[source]

Install the uncropped-record accessor used by the fit wizard.

The main window passes a zero-argument callable returning (full_dataset, (t_min, t_max)) for the active run — the record before the plot’s fit-range crop, and the range that was cropped away. Forwarded straight to the single-fit tab, which is where the wizard is opened from.

get_single_form_state()[source]

Return the single-fit form payload (no per-run/domain wrapping).

This is exactly what restore_single_fit_ui() consumes, so it is the payload the main window stores as a slot’s ui_state.

A slot’s ui_state is written to the project file, so this is a persistence boundary: the cached wizard analysis is converted from its session handle to the compact JSON payload here (see wizard_cache). Session-only snapshots take SingleFitTab.get_state() directly instead, and pay nothing.

restore_single_fit_ui(payload)[source]

Restore (or blank) the single-fit form from a slot ui_state payload.

A populated dict restores the form verbatim; an empty dict (or None) blanks it — an unfit projection must never inherit another projection’s fit. The run-keyed blob is deliberately not touched: it stays the per-run store that global seeding reads, while the per-projection slot is the source of truth for the single-fit form.

set_datasets(datasets, unavailable=mappingproxy({}))[source]

Set the Batch tab’s member pool, dropping it to a draft over them (D7).

unavailable runs are listed beside the pool, disabled with the reason.

member_pool_runs()[source]

Every run the Batch tab’s member list shows (GlobalFitTab.member_pool_runs).

replace_member_datasets(datasets, unavailable)[source]

Re-read the Batch tab’s members (GlobalFitTab.replace_member_datasets).

single_dataset()[source]

The record the Single tab fits.

batch_datasets()[source]

Return the datasets configured for the batch/integral-scan.

set_bound_group(group_id, name=None)[source]

Bind the Batch tab to a data group (“Fit this group…”, D1).

apply_wizard_phase_assessments(recommendation, phases)[source]

Delegate the per-phase wizard apply to the Batch tab (D3).

clear_bound_group()[source]

Clear the Batch tab’s group binding (ad-hoc selection, D1).

bound_group_id()[source]

Return the id of the data group the Batch tab is bound to, or None.

set_frequency_missing_spectra_status(missing_run_numbers, cached_count)[source]

Show frequency-domain global fit status for selected uncached runs.

is_grouped_time_domain_mode()[source]

Return whether the global tab is in grouped time-domain mode.

set_fit_blocked(blocked, reason='')[source]

Apply fit-action blocking to both single and global tabs.

set_fit_range_display(x_min, x_max)[source]

Echo the plot’s (project-wide) fit range into the Single tab.

The Batch tab’s window is the open series’ own (D8), so the plot never rewrites a window the tab already has. A draft that has no window yet (the fields still blank) takes the project range the first time one exists, so it shows the window a run would actually use rather than an empty 0–0.

set_batch_fit_range(x_min, x_max)[source]

Write the Batch tab’s own window (a drag on the plot’s range guides).

batch_tab_visible()[source]

True when the Batch tab is the page the user is looking at.

batch_fit_range()[source]

The Batch tab’s window as (min, max), (None, None) when unset.

single_fit_formula_string()[source]

Return the active single-fit formula string, if available.

single_fit_model_and_seed()[source]

Return the active single-fit model and seed (for headless re-fits).

global_fit_formula_string()[source]

Return the active global-fit formula string, if available.

get_single_state_for_run(run_number)[source]

Return current single-fit state for one run, if available.

get_single_fit_wizard_cache_for_run(run_number)[source]
persist_single_fit_wizard_cache_for_run(run_number, recommendation, *, signature=None, log_text='')[source]
build_single_fit_payload_from_slot(model, template_parameters, result)[source]

Reconstruct a single-fit-tab restore payload from a persisted FitSlot.

Batch/global-member FitSlot``s are "pointer slots": they carry a genuine fitted ``model/result but never a ui_state (only the single-fit GUI path writes one). D5 protects any run with a recorded result, so MainWindow._single_fit_restore_payload calls this to synthesise a payload rather than treating such a run as unfit — most relevantly across a project reload, before this session’s register_global_fit_results cache exists. Returns None when there is nothing usable to build from.

register_global_fit_results(results_by_run)[source]

Persist per-run single-tab state using the latest successful global fit.

get_single_state()[source]

Return the single-fit tab’s state, per-run blob included.

Session-shaped: each block’s wizard_state is the in-memory handle (see wizard_cache), because this is also the domain-switch snapshot — a time→frequency→time round trip must keep the wizard cache without paying for a serialise/deserialise of every run’s recommendation. The project boundary is MainWindow.collect_project_state, which drops the wizard blocks from panel state entirely (they are persisted per fit slot instead, compactly, via get_single_form_state()).

get_domain_state(domain)[source]

Return serialisable fit state for one fitting domain.

restore_domain_state(domain, state)[source]

Restore serialisable fit state for one fitting domain.

The blob’s domain tag (written by get_domain_state()) must match the requested domain — a mismatch means a stale/mis-routed payload and is refused rather than silently applied to the wrong form (F21c).

restore_single_state(state)[source]

Restore single-fit tab state from a saved dict.

get_global_state()[source]

Return serialisable state of the global-fit tab.

batch_recipe()[source]

Return the Batch tab’s current setup as a FitSeries recipe (D2).

open_series_id()[source]

The series the Batch tab is editing, or None for a draft.

open_series(series, **context)[source]

Open a recorded series in the Batch tab (see GlobalFitTab.open_series).

open_draft(**context)[source]

Drop the Batch tab to a draft (see GlobalFitTab.open_draft).

duplicate_open_series()[source]

Copy the Batch tab’s open series into a draft beside it (D7).

note_series_recorded(series, *, display_name, replaced)[source]

Tell the Batch tab which series its completed run recorded (D3).

note_selection_differs(run_numbers)[source]

Raise the Batch tab’s “Selection differs” hint for run_numbers (D7).

set_series_catalogue_provider(provider)[source]

Install the callback the Batch tab’s series menus read (host-resolved).

saved_open_series_id()[source]

The open series id the last restored project state carried, if any.

get_grouped_state()[source]

Return the grouped-fit classification (physics roles + nuisance block).

single_fit_range_text()[source]

Active single-fit range as a provenance string (see SingleFitTab).

set_saved_fit_catalogue_provider(provider)[source]

Install the host callback that answers the bound run’s saved fits.

refresh_saved_fits()[source]

Re-read the bound run’s saved fits (after a rename, say).

note_single_fit_saved()[source]

The host saved the Single tab’s fit: New fit is spent.

single_fit_records_new()[source]

Whether the next single fit records beside the open one whatever it describes.

single_fit_window()[source]

The window the Single tab’s next fit uses, as a saved fit records it.

show_saved_single_fit(payload)[source]

Show a saved fit the host just opened on the bound run, verbatim.

batch_fit_range_text()[source]

Active batch/global/grouped fit range as a provenance string.

send_single_model_to_batch()[source]

Copy the single-fit tab’s model and current seeds into the Batch tab.

Returns True when a model was sent. The Single ⇄ Batch flow: build a model in Single, send it to seed a batch over the selected runs. The batch parameter seeds are taken from the single tab’s current table values (which reflect the latest fit once one has run), so the batch starts from the values the user just set rather than model defaults or stale preserved state (BUG B8c).

Arm the Batch tab’s Trends → hand-off (a batch has been recorded).

restore_global_state(state)[source]

Restore global-fit tab state from a saved dict.

get_ui_state()[source]

Return serialisable UI state for the fit panel container.

restore_ui_state(state)[source]

Restore serialisable UI state for the fit panel container.

shutdown_workers()[source]

Cancel running fits on both tabs and wait for their threads.

staticMetaObject = PySide6.QtCore.QMetaObject("FitPanel" inherits "QWidget": Methods:   #33 type=Signal, signature=fit_completed(PyObject,PyObject,PyObject), parameters=PyObject, PyObject, PyObject   #34 type=Signal, signature=preview_requested(PyObject,PyObject,PyObject), parameters=PyObject, PyObject, PyObject   #35 type=Signal, signature=members_changed()   #36 type=Signal, signature=global_fit_started()   #37 type=Signal, signature=global_fit_completed(PyObject,PyObject), parameters=PyObject, PyObject   #38 type=Signal, signature=grouped_fit_completed(PyObject,PyObject), parameters=PyObject, PyObject   #39 type=Signal, signature=apply_wizard_phases_requested(PyObject,int), parameters=PyObject, int   #40 type=Signal, signature=series_group_requested(PyObject), parameters=PyObject   #41 type=Signal, signature=add_single_fit_to_series_requested()   #42 type=Signal, signature=saved_fit_open_requested(QString), parameters=QString   #43 type=Signal, signature=saved_fit_rename_requested(QString,QString), parameters=QString, QString   #44 type=Signal, signature=saved_fit_delete_requested(QString), parameters=QString   #45 type=Signal, signature=saved_fit_compare_requested()   #46 type=Signal, signature=single_dataset_bound()   #47 type=Signal, signature=fit_range_edit_committed(double,double), parameters=double, double   #48 type=Signal, signature=series_open_requested(QString), parameters=QString   #49 type=Signal, signature=series_new_from_selection_requested()   #50 type=Signal, signature=series_new_from_group_requested(QString), parameters=QString   #51 type=Signal, signature=series_rename_requested(QString,QString), parameters=QString, QString   #52 type=Signal, signature=series_delete_requested(QString), parameters=QString   #53 type=Signal, signature=batch_fit_range_changed(double,double), parameters=double, double   #54 type=Signal, signature=batch_seeding_mode_changed(QString), parameters=QString   #55 type=Signal, signature=trends_requested()   #56 type=Signal, signature=tab_changed(int), parameters=int   #57 type=Signal, signature=field_direction_answered(PyObject,PyObject), parameters=PyObject, PyObject )

Fourier panel

class asymmetry.gui.panels.fourier_panel.FourierPanel(parent=None, *, settings=None)[source]

Bases: QWidget

Controls for frequency-domain analysis.

settings_changed

Emitted (debounced) whenever a control feeding get_state() changes, except the spectral-moments widget (it does not affect the computed spectrum). Suppressed during programmatic restores — see _suppress_settings_signal_scope.

__init__(parent=None, *, settings=None)[source]
set_phase_fit_summary(metadata)[source]

Show conditional group estimates from the representation’s result metadata.

set_compute_scope(count)[source]

Reflect the compute target count in the primary button’s label.

exclusion_ranges()[source]

Return the editable (centre, half-width) exclusion ranges.

set_background_hint(text)[source]

Show the inherited grouping-background state above the FFT button (F3).

set_fft_status(message, *, success=False)[source]

Set the footer status line for a computed-spectrum outcome.

set_stale(reason)[source]

Show or hide the “spectrum out of date” banner.

is_stale()[source]

Return whether the stale-spectrum banner is currently shown.

set_overlay_mismatch(mismatched)[source]

Show or hide the “overlay mixes settings” banner.

is_overlay_mismatched()[source]

Return whether the overlay-mismatch banner is currently shown.

group_phase_table()[source]

Return the per-group phase table as {group_id: phase_deg}.

group_enabled_table()[source]

Return the per-group inclusion table as {group_id: enabled}.

selected_group_ids()[source]

Return the ordered list of detector groups enabled for grouped FFTs.

set_group_definitions(group_names, phase_table=None, enabled_table=None)[source]

Populate the editable group-phase table for the active run.

set_group_phases(phase_table, *, auto_filled=False)[source]

Update existing group-phase rows without rebuilding the table.

set_apodisation_suggestion(window, time_constant_us)[source]

Fill a matched-apodisation suggestion into the filter controls.

set_group_enabled(enabled_table)[source]

Update existing group-inclusion rows without rebuilding the table.

group_auto_filled_ids()[source]

Return group IDs whose phase cells were last auto-estimated.

group_phase_state()[source]

Return the current group-phase UI state for one dataset/run.

restore_group_phase_state(state, group_names)[source]

Restore per-run group-phase state into the table.

clear_average_summary()[source]

Clear the averaged-spectrum summary text.

set_average_summary(*, mean_error, peak_signal_to_noise, group_count)[source]

Show a short summary for an averaged grouped FFT spectrum.

get_state()[source]

Return a serialisable snapshot of the Fourier panel settings.

property moments_widget[source]

The spectral-moments control hosted in the advanced stack.

restore_state(state)[source]

Restore Fourier panel settings from a saved dict.

staticMetaObject = PySide6.QtCore.QMetaObject("FourierPanel" inherits "QWidget": Methods:   #33 type=Signal, signature=settings_changed() )

Log panel

class asymmetry.gui.panels.log_panel.LogPanel(parent=None)[source]

Bases: QWidget

Scrollable log with per-category tag colouring.

Capped to the most recent asymmetry.gui.panels.log_panel._MAX_LOG_BLOCKS entries via QTextDocument.setMaximumBlockCount so a long-running session’s log cannot grow the widget (and the app’s memory footprint) without bound.

entry_count_changed

Emitted with the running entry count (feeds the dock header’s badge).

__init__(parent=None)[source]
log(message, *, tag='')[source]

Append a timestamped entry, optionally categorised by tag.

entry_count()[source]

Return the number of entries logged since the last clear.

clear()[source]

Clear all log entries.

to_plain_text()[source]
staticMetaObject = PySide6.QtCore.QMetaObject("LogPanel" inherits "QWidget": Methods:   #33 type=Signal, signature=entry_count_changed(int), parameters=int )

Dialogs

Grouping dialog

class asymmetry.gui.windows.grouping_dialog.GroupingDialog(datasets, *, profiles=None, overridden_run_numbers=None, assigned_profiles=None, selected_run_number=None, selected_run_numbers=None, parent=None)[source]

Bases: TimingControls, QDialog

Profile editor for detector grouping.

The dialog edits an in-memory draft grouping profile (a GroupingProfile). Each run of a fingerprint (instrument, histogram_count) follows its assigned profile — several profiles can be in concurrent use (schema v17, e.g. one per sample), with one flagged the fingerprint’s default for newly loaded runs. The scope panel moves runs between profiles (“Assign to ▸”); per-run divergence is an explicit “release from profile” exception, with the assignment kept as the base profile Reattach returns the run to. Applying the edited profile reaches only the runs following it. Nothing touches the project or runs until Apply.

The scope panel is the selector: the run selected there is the one the form previews and edits, and the editing target follows that run’s status. An inheriting run edits the profile draft (through a flat run.grouping payload — see asymmetry.gui.windows.grouping.profile_bridge); an overridden run edits that run’s own override draft, seeded once from its stored payload and kept in self._override_drafts. Selecting never prompts — each target keeps its draft — and Apply commits everything dirty: the profile to every inheriting run plus each edited override to its own run. The only guard is closing the window with uncommitted changes.

Parameters:
  • datasets – Datasets available in the active project. Datasets without raw histograms are ignored.

  • profiles – The project’s existing grouping profiles. When omitted (or empty for the current fingerprint), the draft is synthesized from the current/reference run’s payload as "Default (<instrument>)".

  • assigned_profiles – Optional {run_number: profile_name} map of each run’s recorded profile assignment (schema v17). Runs without an entry — or whose entry no longer names a profile of their fingerprint — are treated as following the fingerprint’s default profile.

  • selected_run_number – Optional run number used as the initially selected run.

  • selected_run_numbers – Optional run numbers; only the first choice steers the initial selected run / fingerprint. No longer a broadcast selection.

  • parent – Parent Qt widget.

__init__(datasets, *, profiles=None, overridden_run_numbers=None, assigned_profiles=None, selected_run_number=None, selected_run_numbers=None, parent=None)[source]

Create a grouping profile editor for project datasets.

t0_apply_warnings

Verdict messages recorded at Apply (D9) — warnings, never a block.

preferred_window_size()[source]

The window’s default size before the available-screen clamp.

Measured once at the end of construction (_measure_preferred_window_size) and cached: a shown window’s minimum size hint settles a pixel or two wider than the pre-show value, and callers that resize to this size must read back exactly what they set.

reject()[source]

Reject with an unsaved-draft guard (Cancel / Esc).

closeEvent(event)[source]

Close with an unsaved-draft guard (window ✕).

done(result)[source]

Tear the preview + background-configure runners down on dismissal.

staticMetaObject = PySide6.QtCore.QMetaObject("GroupingDialog" inherits "QDialog": Methods:   #41 type=Slot, signature=_on_calibration_ready(PyObject), parameters=PyObject )
get_grouping_result()[source]

Return the applied grouping payload for inheriting runs.

The dialog is a profile editor: on Apply the draft is saved as the active profile and resolved onto every inheriting run of the instrument. The returned dict is the flat grouping payload the main window’s _apply_grouping_settings_to_dataset consumes, with run_numbers set to the inheriting runs. Per-run override edits are carried separately in get_profile_result().

Returns:

dict or None – Grouping payload plus run_numbers (inheriting runs). None when no run histograms are available.

get_profile_result()[source]

Return the profile-editor result for the main window to reconcile.

Returns:

dict or None – {"profile": GroupingProfile, "inheriting": set[int], "released": set[int], "newly_released": set[int], "newly_reattached": set[int], "preview_run_number": int, "override_edits": {run_number: payload}} — the saved draft profile, the scope reconciliation, and every dirty per-run override payload to apply to its run alone. None when no run is available.

property draft_profile[source]

The current draft profile (a copy synced from the form).

Detector layout dialog

class asymmetry.gui.windows.detector_layout_dialog.DetectorLayoutDialog(instrument, groups, group_names=None, initial_preset_name=None, forward_group=1, backward_group=2, excluded_detectors=None, projections=None, field_direction=None, n_histograms=None, parent=None)[source]

Bases: QDialog

Visual detector grouping editor.

Parameters:
  • instrument – Pre-selected instrument layout. Users can override this via the instrument combo inside the dialog.

  • groups – Current group definitions mapping group ID (1-based) to list of 1-based detector IDs.

  • group_names – Optional mapping from group ID to human-readable group name.

  • forward_group – Group ID currently designated as the forward group.

  • backward_group – Group ID currently designated as the backward group.

  • field_direction – Applied-field geometry of the run ("Transverse" / "Longitudinal" / "Zero field" / None). When the run is transverse-field but the current preset is not the recommended transverse one, the dialog shows a non-blocking hint and pre-selects the recommended preset in the combo (the user still clicks Apply Grouping).

  • n_histograms – Detector count of the run, for the “Generic (N detectors)” choice offered beside the known instruments. Defaults to instrument’s count.

  • parent – Parent Qt widget.

__init__(instrument, groups, group_names=None, initial_preset_name=None, forward_group=1, backward_group=2, excluded_detectors=None, projections=None, field_direction=None, n_histograms=None, parent=None)[source]
showEvent(event)[source]
eventFilter(watched, event)[source]

Highlight a group’s detectors in the schematic while its row is hovered.

get_result()[source]

Return the editing result as a plain dictionary.

Returns:

dict – Keys:

"groups"

Mapping from group ID (int, 1-based) to list of 1-based detector IDs. Only non-empty groups are included.

"group_names"

Mapping from group ID (int, 1-based) to name string.

"forward_group"

Group ID of the designated forward group.

"backward_group"

Group ID of the designated backward group.

"instrument"

Instrument name (str).

staticMetaObject = PySide6.QtCore.QMetaObject("DetectorLayoutDialog" inherits "QDialog": )

Widgets

Detector schematic

class asymmetry.gui.widgets.detector_schematic.DetectorSchematicWidget(instrument, parent=None)[source]

Bases: QWidget

Interactive matplotlib-backed detector schematic.

Parameters:
  • instrument – Instrument layout to render.

  • parent – Parent Qt widget.

  • Signals

  • ——-

  • detector_toggled(int, bool) – Emitted when the user clicks a detector segment. Arguments are the 1-based detector_id and True if the detector is now included in the active group, False if it has been removed.

detector_toggled
detector_exclusion_toggled

Emitted in exclude mode — (1-based detector id, now_excluded).

__init__(instrument, parent=None)[source]
set_active_group(group_id)[source]

Change which group is currently active (receives click toggles).

Parameters:

group_id – 1-based group identifier.

set_group_detectors(group_id, detector_ids)[source]

Set detector membership for one group and refresh the display.

Parameters:
  • group_id – 1-based group identifier.

  • detector_ids – Set of 1-based detector IDs belonging to the group.

set_all_groups(groups, active_group)[source]

Replace all group assignments and set the active group.

Parameters:
  • groups – Mapping from group ID (1-based) to list of 1-based detector IDs.

  • active_group – Group ID that should be considered active.

set_excluded_detectors(detector_ids)[source]

Mark detectors (1-based ids) as excluded and refresh the display.

set_exclude_mode(enabled)[source]

Toggle click-to-exclude mode (clicks edit the exclusion set).

get_excluded_detectors()[source]

Return the current exclusion set (1-based ids).

set_group_names(group_names)[source]

Set the gid -> display-name mapping used to label hover tooltips.

Purely cosmetic (tooltip text only); does not affect group membership or colour. The layout dialog calls this whenever its name-edit fields change so hovering shows “Forward” rather than “Group 1”.

set_group_highlight(group_id)[source]

Temporarily emphasise group_id’s detectors (edge highlight).

Used by the layout dialog to highlight a group’s detectors in the schematic when the user hovers that group’s row. Pass None to clear the highlight.

get_filled_detectors()[source]

Return the set of detectors currently in the active group.

set_instrument(instrument)[source]

Replace the displayed instrument layout.

Parameters:

instrument – New instrument layout to render.

sizeHint()[source]
staticMetaObject = PySide6.QtCore.QMetaObject("DetectorSchematicWidget" inherits "QWidget": Methods:   #33 type=Signal, signature=detector_toggled(int,bool), parameters=int, bool   #34 type=Signal, signature=detector_exclusion_toggled(int,bool), parameters=int, bool )

Alc panel

ALCScanView.clear(message='Build a scan to see the ALC curve')[source]

Show an empty-state placeholder with message.

The scan is gone, so its analysis goes with it: the region/peak tables and the results read-out are emptied (otherwise stale rows, markers, and draggable handles would persist onto the next, unrelated scan).

Timing section

class asymmetry.gui.windows.grouping.timing_section.TimingControls[source]

Grouping dialog timing presentation; acquisition and selection resolve in core.