DAQ

The following objects are provided for interacting with the data acquisition system:

  • daq: controls execution of the run

  • scan_pvs: controls the auxilliary scan pvs, which are used to organize the run tables.

Full documentation is available at https://pcdshub.github.io/pcdsdaq. This page will be a brief overview.

Note

scan_pvs are disabled by default! This is to prevent confusion from two users accidentally writing to the PVs at the same time. Call scan_pvs.enable() to enable them. You may consider doing this as part of your standard scan routine.

Basic Usage

Use daq.begin to start a run. Runs must be ended explicitly or the run will remain open. A second call to a begin during an open run will resume the run.

# Run for 120 events, wait, leave the run open.
In [1]: daq.begin(events=120, wait=True)

# Close the run
In [2]: daq.end_run()

# Run for 1 second, record, set the run to end automatically
In [3]: daq.begin(duration=1, record=True, end_run=True)

# Wait until done taking data
In [4]: daq.wait()

The python will steal control from the GUI. Only one or the other can have control at a time. Use daq.disconnect to give up control to the GUI.

In [5]: daq.disconnect()

You can start an infinite run using daq.begin_infinite. You can stop this run manually using daq.end_run.

In a Scan

Use the daq object as your detector to include it in a bluesky plan. The DAQ will then run for the configured duration at every scan step. If scan_pvs are enabled, these will be written to during the bluesky plan.

# Configure for 120 events per point
In [6]: daq.preconfig(events=120)

# Scan motor from 0 to 10 in 11 steps, run daq at each point
In [7]: RE(scan([daq], motor, 0, 10, 11))
Out[7]: ('2ff14d9b-1105-4964-a31e-e06f0f1b6c5d',)

Controlling Post-Scan State

The daq will return to the state it was in before the scan was run. If we start disconnected, we will revert to disconnected. If we start configured, we will stay connected and configured. If we start while already running, we’ll start running again (record=False) after the scan.

The daq.configure method must connect, so the daq.preconfig method is provided if you’d like to schedule a configuration to apply upon connecting in the scan.