Last active
November 6, 2020 05:02
-
-
Save mrakitin/6cfc99d76d67f9f65216d0b5e3af27d1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bluesky.plan_stubs as bps | |
import bluesky.plans as bp | |
from bluesky.callbacks.best_effort import BestEffortCallback | |
from bluesky.run_engine import RunEngine | |
from bluesky.utils import install_kicker | |
from databroker import Broker | |
from ophyd.sim import det, motor | |
import matplotlib.pyplot as plt | |
plt.ion() | |
RE = RunEngine() | |
db = Broker.named('temp') | |
bec = BestEffortCallback() | |
RE.subscribe(db.insert) | |
RE.subscribe(bec) | |
install_kicker() | |
def my_table(name, doc): | |
if name == 'event': | |
diff = doc['data']['motor'] - doc['data']['motor_setpoint'] | |
print(f'The diff is: {diff}') | |
RE.subscribe(my_table) | |
# Run next: | |
RE(bp.scan([det], motor, -10, 10, 5)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment