scan_signal_statistics#

Import: apstools.callbacks.scan_signal_statistics

Collect statistics on the first detector used in 1-D scans.#

SignalStatsCallback()

Callback: Collect peak (& other) statistics during a scan.

Module Contents#

class apstools.callbacks.scan_signal_statistics.SignalStatsCallback[source]#

Import: apstools.callbacks.scan_signal_statistics.SignalStatsCallback

Callback: Collect peak (& other) statistics during a scan.

Subscribe the receiver() method. Use with step scan plans such as bp.scan() and bp.rel_scan().

Caution

It is recommended to subscribe this callback to specific plans. It should not be run with just any plan (it could easily raise exceptions).

Basic example

 1from bluesky import plans as bp
 2from bluesky import preprocessors as bpp
 3from apstools.callbacks import SignalStatsCallback
 4
 5signal_stats = SignalStatsCallback()
 6
 7def my_plan(detectors, mover, rel_start, rel_stop, points, md={}):
 8
 9    @bpp.subs_decorator(signal_stats.receiver)  # collect the data
10    def _inner():
11        yield from bp.rel_scan(detectors, mover, rel_start, rel_end, points, md)
12
13    yield from _inner()  # run the scan
14    signal_stats.report()  # print the statistics

Public API

receiver(key, document)

Client method used to subscribe to the RunEngine.

report()

Print a table with the collected statistics for each signal.

data_stream

RunEngine document with signals to to watch.

reporting

If True (default), call the report() method when a stop document is received.

Internal API

clear()

Clear the internal memory for the next run.

descriptor(doc)

Receives 'descriptor' documents from the RunEngine.

event(doc)

Receives 'event' documents from the RunEngine.

start(doc)

Receives 'start' documents from the RunEngine.

stop(doc)

Receives 'stop' documents from the RunEngine.

analysis

Dictionary of statistical array analyses.

_data

Arrays of x & y data

_scanning

Is a run in progress?

_registers

Deprecated: Use 'analysis' instead, will remove in next major release.

analysis: object = None#

Dictionary of statistical array analyses.

clear()[source]#

Clear the internal memory for the next run.

compute()[source]#

Compute XY statistics from accumulated data.

Can be called mid-run (before the stop document) to populate self.analysis with the current statistics. This is used by lineup2() to write the statistics as a bluesky stream before the run closes.

(new in release 1.7.10)

data_stream: str = 'primary'#

RunEngine document with signals to to watch.

descriptor(doc)[source]#

Receives ‘descriptor’ documents from the RunEngine.

event(doc)[source]#

Receives ‘event’ documents from the RunEngine.

feature: str = None#

Name of the peak feature used for alignment (e.g. "centroid"). Set by the caller.

receiver(key, document)[source]#

Client method used to subscribe to the RunEngine.

report()[source]#

Print a table with the collected statistics for each signal.

reporting: bool = True#

If True (default), call the report() method when a stop document is received.

start(doc)[source]#

Receives ‘start’ documents from the RunEngine.

stop(doc)[source]#

Receives ‘stop’ documents from the RunEngine.