Callbacks#
Receive documents from the bluesky RunEngine. File Writers are a specialized type of callback.
Callbacks
Bluesky callback to collect all documents from most-recent plan |
|
prints document contents -- use for diagnosing a document stream |
|
Callback: Collect peak (& other) statistics during a scan. |
File Writing Callbacks
|
Customize |
|
General class for writing HDF5/NeXus file (using only NeXus base classes). |
|
Deprecated: Use |
|
Write SPEC data file as data is collected, line-by-line. |
Document Collector#
Bluesky callback to collect all documents from most-recent plan |
|
|
prints document contents -- use for diagnosing a document stream |
- class apstools.callbacks.doc_collector.DocumentCollectorCallback[source]#
Bluesky callback to collect all documents from most-recent plan
Will reset when it receives a start document.
EXAMPLE:
from apstools.callbacks import DocumentCollectorCallback doc_collector = DocumentCollectorCallback() RE.subscribe(doc_collector.receiver) ... RE(some_plan()) print(doc_collector.uids) print(doc_collector.documents["stop"])
- apstools.callbacks.doc_collector.document_contents_callback(key, doc)[source]#
prints document contents – use for diagnosing a document stream
Collect statistics on the signals used in 1-D scans.#
FWHM \(=2\sqrt{2\ln{2}}\cdot\sigma_c\) |
|
Callback: Collect peak (& other) statistics during a scan. |
- class apstools.callbacks.scan_signal_statistics.SignalStatsCallback[source]#
Callback: Collect peak (& other) statistics during a scan.
Caution
This is an early draft and is subject to change!
Subscribe the
receiver()
method. Use with step scan plans such asbp.scan()
andbp.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 3 4signal_stats = SignalStatsCallback() 5 6def my_plan(detectors, mover, rel_start, rel_stop, points, md={}): 7 8 @bpp.subs_decorator(signal_stats.receiver) # collect the data 9 def _inner(): 10 yield from bp.rel_scan(detectors, mover, rel_start, rel_end, points, md) 11 12 yield from _inner() # run the scan 13 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.
RunEngine document with signals to to watch.
If
True
(default), call thereport()
method when astop
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.
Is a run in progress?
Dictionary (keyed on Signal name) of
SummationRegister()
objects.- _registers: dict = {}#
Dictionary (keyed on Signal name) of
SummationRegister()
objects.
- _scanning: bool = False#
Is a run in progress?
- data_stream: str = 'primary'#
RunEngine document with signals to to watch.
- stop_report: bool = True#
If
True
(default), call thereport()
method when astop
document is received.
- apstools.callbacks.scan_signal_statistics.factor_fwhm = 2.3548200450309493#
FWHM \(=2\sqrt{2\ln{2}}\cdot\sigma_c\)