Code injection

Here is an example of injecting user code. The action per point is replaced by the function one_1d_step.

from bluesky.plans import scan
import blueskyDESY
from bluesky import RunEngine
from bluesky.plan_stubs import checkpoint, abs_set, trigger_and_read

AMG = blueskyDESY.getActiveMntGrp()
print( "testMG.main: AMG %s " % repr( AMG))
mg = blueskyDESY.Experiment( read_attrs = AMG[ 'counters']) 
eh_mot65 = blueskyDESY.motorTango( name = 'eh_mot65')

def one_1d_step(detectors, motor, step):
    yield from checkpoint()
    print( "one_1d_step to %s " % repr( step))
    yield from abs_set(motor, step, wait=True)
    return (yield from trigger_and_read(list(detectors) + [motor]))

RE = RunEngine()
RE.subscribe(blueskyDESY.docCallback())

RE(scan([mg], eh_mot65, 0, 0.1, 3, per_step=one_1d_step))