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
| Component | Description |
|---|---|
CodeEditor | Simple code editor: line numbers, Python highlighting, automatic indentation and completion |
PythonHighlighter | Lightweight Python syntax highlighter |
LineNumberArea | Line-number margin widget on the left of the editor |
ExperimentParser | Parses an experiment: buildExperiment / simulateExperiment return the command stack |
ExperimentSequencer | Draws a sequence as a step plot of each output channel against time |
CodeEditorParser | Composite main window: Save / Simulate / Clear toolbar + dock layout |
Key methods
| Method | Description |
|---|---|
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.