guide_halting_running_experiment - vnegnev/marcos_extras GitHub Wiki
Last updated: 29/09/2022
Sometimes when you are running a long scan or series of scans as a single MaRCoS experiment, you may wish to interrupt the experiment’s execution before it is finished. This is possible, but isn’t yet (29/09/2022) automated.
- Interrupt and exit the GUI or Python script you are using to run MaRCoS.
- Exit the MaRCoS server on the SDRLab by hitting Ctrl-C in your SSH terminal or similar.
Make sure that no instances of the server are running (eg by calling
ps -A|grep marcos
to check); if other instances are running, close them usingkillall marcos_server
.WARNING: Your RF and/or gradient sequence may still continue running at this stage; this is fine. If it is long, it may halt at an unknown point in the RF or gradient output. If extended operation with the gradients or RF on max output might harm your amplifiers, turn them off as a precaution.
- Rerun the MaRCoS server.
- Create a simple MaRCoS experiment that has just a few pulses.
Make sure that in the constructor of your
Experiment
object, you set bothhalt_and_reset
andflush_old_rx
toTrue
. (Note: these shouldn’t be left toTrue
in production code, since there may be side effects regarding the initialisation routines, and/or unexpected warnings due to no RX data). - Run this MaRCoS experiment. Once it completes on the hardware, the STEMlab will be ready to accept new sequences again.
The current version of the MaRCoS server is designed to execute all its instructions in one batch.
It monitors the spare capacity of the marga FPGA firmware’s sequence BRAM, and keeps the BRAM filled while there is more of the sequence to run.
This means that if the MaRCoS server is simply closed, the remaining instructions in the BRAM will still be run by the marga firmware; this may take a long time.
To overcome this, the firmware can be explicitly halted by the server before starting a new sequence; this is what the halt_and_reset
flag of the Experiment class does; once a short sequence is run with this flag enabled, the marga firmware interrupts its earlier sequence, completes the short one requested, and goes idle ready for new sequences.
The flush_old_rx
flag causes the server to throw away any old RX data that may have been acquired by the halted sequence (before it was halted).
If for some reason the user still wants to view the old data, this flag can be left False
.
A future version of the MaRCoS server-client architecture will feature intermittent communication between the host and STEMLab during long sequences, to allow the user to alter or interrupt running sequences more easily.