Core scan features¶
Pausing, resuming, & early termination¶
By default, a scan will always yield to a higher priority experiment that has been submitted to the ARTIQ master.
Scans always complete the current scan point before checking with the scheduler if they need to pause via
self.scheduler.check_pause()
. If self.scheduler.check_pause()
indicates that the scan needs to
yield to another experiment, the scan state is saved and the scan yields to the higher priority experiment.
After the higher priority experiment experiment completes, the scan will automatically resume at the scan point
following the scan point that was completed before yielding.
To disable pausing, resuming, and early termination and not incure the performance hit of
self.scheduler.check_pause()
set the enable_pausing
attribute of the scan to False
class MyScan(Scan1D, EnvExperiment):
enable_pausing = False
...
Note
Not all callbacks are executed when a scan resumes after yielding. See the Callbacks section for which callbacks will execute when the scan resumes.
Note
Models should only be registered in either the build()
or prepare()
methods since these methods
will not be executed when the scan resumes. If a model is registered in another method, such as the
prepare_scan()
method, it will be re-registered when the scan resumes causing it to be registered twice.
Passes¶
Multiple scan passes can be performed by setting the npasses
gui argument. The current_scan.stats.mean
dataset will reflect the current mean values across all passses so far.
Broadcast, Persist, and Save¶
By default, scan models do not broadcast or persist data to their own namespace to minimize the amount of data shown in
the dashboard. If mirror
is set to False
, there is no way of viewing the data except for using the
artiq_browser
. By setting the model’s broadcast
and persist
attributes to True
, its
datasets will then be visible under the model’s namespace in the ‘Datasets’ panel of the dashboard.
Current Scan Namespace¶
Scan’s automatically mirror all dataset’s generated by the scan to the current_scan
namespace. The scan will write
data to the following locations:
current_scan.stats
This locations contains raw data and calculated statistical data from the scan. See the datasets section for more information.
current_scan.fits
This location contains the line of best fit and all fitted parameters. See the datasets section for more information.
current_scan.plots
This locaiton contains all data needed to produce plots. See the datasets section for more information.
Storing data in the current_scan
namespace can be disabled by setting the model’s mirror
attribute to
False
:
self.model.mirror = False
Monitoring Histograms¶
Scan models automatically generate a histogram of data collected at each scan point. When the model’s datasets are
mutated, the histogram is calculated by the model and saved to the current_hist
namespace. This allows a
measurement’s distribution to be viewed at each scan point as a scan runs. To view these histograms,
create the current histogram applet. Monitor histograms can be disabled by setting
self.enable_histograms = False
in the scan model.
Profiling¶
Scan’s can be profiled to find bottlenecks in the code. This will only display execution times of code that runs on the host and not on the core device. It may be useful for finding bottlenecks in code running on the host side (such as performing fits, etc). To enable profiling set
self.enable_profiling = True
in the scan.