Sequence editor

Experiment code editing and sequence simulation: syntax highlighting, parsing and output-channel timing visualisation.

Overview

quatm/GUI/editors/editor_sequencer.py provides the edit and simulate tool (formerly Combi / “open simulation window”): the CodeEditorParser composite main window combines the CodeEditor on the left with the sequence visualisation on the right: after editing an experiment script you can simulate a run with a single click, drawing the timing of each output channel as a step plot, which makes experiment sequences easier to debug.

Components

ComponentDescription
CodeEditorSimple code editor: line numbers, Python highlighting, automatic indentation and completion
PythonHighlighterLightweight Python syntax highlighter
LineNumberAreaLine-number margin widget on the left of the editor
ExperimentParserParses an experiment: buildExperiment / simulateExperiment return the command stack
ExperimentSequencerDraws a sequence as a step plot of each output channel against time
CodeEditorParserComposite main window: Save / Simulate / Clear toolbar + dock layout

Key methods

MethodDescription
saveFile (CodeEditor)Saves the current text to a file (returns True on success)
simulateExperiment (CodeEditorParser)Simulates the current version of the experiment and hands the command stack to the sequence visualisation
buildExperiment / simulateExperiment (ExperimentParser)Builds / simulates the experiment and returns the command stack
plotSequence (ExperimentSequencer)Draws the sequence dictionary as a per-channel timing step plot

Usage

from quatm.GUI.editors.editor_sequencer import CodeEditorParser

win = CodeEditorParser(parent=parent, filename="experiments/my_experiment.py")

Note: parameter scans (nD scans, randomisation, etc.) are edited through the Edit button of the experiment window (SequenceEditor, see Experiment window); the scan definition is stored in the experiment property tree and shared with the remote-control platform.