PySequencer
Introduction
The Midas Script Language (MSL) sequencer has been used since many years now, but its syntax is limited. For more demanding tasks requiring complex calculations, a Python-based sequencer has been developed in 2025. The idea is very similar to the MSL sequencer and the user interface is exactly the same, but instead of MSL commands the PySequencer accepts python programs. The interaction with the midas system is done via a special "seq" object. Following example illustrates a simple script asking for a number of runs and then starting/stopping these runs, each lasting 60 seconds:
# This is PySequencer test file def define_params(seq): seq.register_param("runs", "Number of runs", 3) def sequence(seq): runs = seq.get_param("runs") for r in seq.range(runs): seq.start_run() seq.wait_seconds(60) seq.stop_run()
The parameters are optional and can be committed. If defined, a dialog box opens at the run of the sequence and queries all parameters.
Installation
Before the PySequencer can be used, python must be installed and enabled for midas. See Python Installation for details.
Next, the PySequencer menu must be enabled in the ODB with /Experiment/Menu/PySequencer = 1. Now one can click on the "PySequencer" menu item and use the GUI in a similar way than the MSL sequencer. Syntax highlighting happens according to python, and all python variables are shown at the right side of the page for debugging purposes. If the PySequencer is not running, the GUI asks to start python3 $MIDASSYS/python/midas/sequencer.py -D. If this command failed, the user should try to execute it manually to see if there are any errors.
seq Object Reference
- seq.get_param(name) retrieves a parameter name from the sequence start
- seq.start_run starts a run
- seq.stop_run stops a run
- seq.wait_seconds(n) waits for n seconds
- ...
Limitations
Currently numpy cannot be used.