Configuration¶
Some manual configuration is necessary to record data or to run
special bluesky
plans with daq support.
You can get the current configuration from Daq.config
.
Shown here is the default config:
In [1]: daq.config
Out[1]:
{'events': None,
'duration': None,
'use_l3t': False,
'record': None,
'controls': None,
'begin_sleep': 0}
You can also print this information nicely using Daq.config_info
.
You can configure the daq through Daq.configure
, which configures
the daq right away, or Daq.preconfig
, which schedules a configuration
to be done when it is next needed. This distinction is sometimes important
because we cannot do a full configure during an open run, for example.
As an aside, Daq.configure
has a long return value, which may make
Daq.preconfig
the preferred method for interactive sessions.
In general, there are two kinds of configuration arguments:
those that are shared with Daq.begin
, and those that are not.
Arguments that are shared between the two methods act as defaults.
For example, calling daq.configure(duration=3)
will set the
no-arguments behavior of daq.begin()
to run the daq for 3 seconds.
- Daq.configure(events=<object object>, duration=<object object>, record=<object object>, use_l3t=<object object>, controls=<object object>, begin_sleep=<object object>)
Changes the daq’s configuration for the next run.
All arguments omitted from the method call will default to the last configured value in the python session.
This is the method that directly interfaces with the daq. If you simply want to get a configuration ready for later, use
preconfig
.- Parameters:
events (
int
, optional) – If provided, the daq will run for this many events before stopping, unless we override inbegin
. If not provided, we’ll use theduration
argument instead. Defaults to its last configured value, orNone
on the first configure.duration (
int
, optional) – If provided, the daq will run for this many seconds before stopping, unless we override inbegin
. If not provided, andevents
was also not provided, an empty call likebegin()
will run indefinitely. You can also achieve this behavior by passing events=None and/or duration=None, Defaults to its last configured value, orNone
on the first configure.record (
bool
, optional) – IfTrue
, we’ll record the data. IfFalse
, we’ll run without recording. IfNone
, we’ll use the option selected in the DAQ GUI. Defaults to the its last configured value, orNone
on the first configure.use_l3t (
bool
, optional) – IfTrue
, anevents
argument to begin will be reinterpreted to only count events that pass the level 3 trigger. Defaults to its last configured value, orFalse
on the first configure.controls (
dict{name: device}
orlist[device...]
, optional) – If provided, values from these will make it into the DAQ data stream as variables. We will checkdevice.position
anddevice.value
for quantities to use and we will update these values each time begin is called. To provide a list, all devices must have aname
attribute. Defaults to its last configured value, or no controls values on the first configure.begin_sleep (
int
, optional) – The amount of time to wait after the DAQ returns begin is done. This is a hack because the DAQ often says that a begin transition is done without actually being done, so it needs a short delay. Defaults to its last configured value, or 0 on the first configure.
- Returns:
old, new – The old configuration and the new configuration. These dictionaries are verbose, containing all configuration values and the timestamps at which they were configured, as specified by
bluesky
.- Return type:
tuple
ofdict