Closed prjemian closed 1 year ago
It is worth investigating and documenting the answer here.
A big difference is that BEC expects a document stream (start, descriptor, event, event, ... stop). The tiled server does not deliver a stream of data events. Rather, it processes such streams and delivers xarray structures for the data of each stream. We could explore the techniques used in BEC to identify the default plottable data (NeXus wants this also) and also how to generate the appropriate type of plot.
The BEC source code: https://github.com/bluesky/bluesky/blob/master/bluesky/callbacks/best_effort.py
Since the BEC code expects a document stream, it cannot be re-used here. I will examine the BEC code and document how it determines the plottable data. Overall, the code refines a set of initial guesses. The plottable data is assumed to be in the stream named "primary"
. The first guess starts with motors:
motors = self._start_doc.get('motors')
if motors is not None:
GUESS = [([motor], 'primary') for motor in motors]
else:
GUESS = [(['time'], 'primary')]
# for each dimension, choose one field only
# the plan can supply a list of fields. It's assumed the first
# of the list is always the one plotted against
How does BEC discover how to plot a raster image, such as grid_scan
?
Gridding is determined by some code, starting with hints["gridding"]
:
elif ndims == 2:
# Decide whether to use LiveGrid or LiveScatter. LiveScatter is the
# safer one to use, so it is the fallback..
gridding = self._start_doc.get('hints', {}).get('gridding')
if gridding == 'rectilinear':
The first job is to identify what is an axis and signal. The NeXus terminology is clear here:
BEC:
rank | plot style |
---|---|
1D | LivePlotPlusPeaks (one for each column that is not a dimension) |
2D | LiveGrid if gridding == 'rectilinear' |
2D | LiveScatter (fallback) |
3D | not handled by BEC |
4D | not handled by BEC |
Question is answered.
@rodolakis asks:
Originally posted by @prjemian in https://github.com/BCDA-APS/gemviz/issues/50#issuecomment-1665850096