-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
two quick sketches for how to make use of multiple LivePlots in one scan:
from functools import partial
from ophyd.sim import hw as _hw
from bluesky import RunEngine
from bluesky.plans import scan
from bluesky.callbacks.mpl_plotting import LivePlot
import bluesky.callbacks
import bluesky.preprocessors as bpp
hw = _hw()
bluesky.callbacks.mpl_plotting.initialize_qt_teleporter()
RE = RunEngine({})
def same_axes():
def get_ax():
import matplotlib.pyplot as plt
return plt.figure('my plot').gca()
lt = LivePlot('det', 'motor', marker='x', markersize=10, ax=get_ax)
lt2 = LivePlot('det1', 'motor', marker='o', markersize=10, ax=get_ax)
return (yield from bpp.subs_wrapper(scan([hw.det, hw.det1], hw.motor, -5, 5, 30), [lt, lt2]))
def same_figure():
def get_ax(i):
import matplotlib.pyplot as plt
fig = plt.figure('my plot')
if len(fig.axes) == 0:
fig.subplots(1, 2)
return fig.axes[i]
lt = LivePlot('det', 'motor', marker='x', markersize=10, ax=partial(get_ax, i=0))
lt2 = LivePlot('det1', 'motor', marker='o', markersize=10, ax=partial(get_ax, i=1))
return (yield from bpp.subs_wrapper(scan([hw.det, hw.det1], hw.motor, -5, 5, 30), [lt, lt2]))
RE(same_figure())
In your actual use the hard coded lt and lt2 can be replaced with a loop over the y-values of interest.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels