def custom_step(detectors, motor, step): """ Inner loop of a 1D step scan This is the default function for ``per_step`` param in 1D plans. """ yield from checkpoint() print('Set attenuator to {}'.format(step)) yield from pause() yield from abs_set(motor, step, wait=True) return (yield from trigger_and_read(list(detectors) + [motor]))
def manual_count(det=eiger1m_single): detectors = [det] for det in detectors: yield from stage(det) yield from open_run() print("All slow setup code has been run. " "Type RE.resume() when ready to acquire.") yield from pause() yield from trigger_and_read(detectors) yield from close_run() for det in detectors: yield from unstage(det)
def test_interrupted_with_callbacks(RE, int_meth, stop_num, msg_num): docs = defaultdict(list) def collector_cb(name, doc): nonlocal docs docs[name].append(doc) RE.msg_hook = MsgCollector() with pytest.raises(RunEngineInterrupted): RE(subs_wrapper(run_wrapper(pause()), {"all": collector_cb})) getattr(RE, int_meth)() assert len(docs["start"]) == 1 assert len(docs["event"]) == 0 assert len(docs["descriptor"]) == 0 assert len(docs["stop"]) == stop_num assert len(RE.msg_hook.msgs) == msg_num
def test_interrupted_with_callbacks(RE, int_meth, stop_num, msg_num): docs = defaultdict(list) def collector_cb(name, doc): nonlocal docs docs[name].append(doc) RE.msg_hook = MsgCollector() with pytest.raises(RunEngineInterrupted): RE(subs_wrapper(run_wrapper(pause()), {"all": collector_cb})) getattr(RE, int_meth)() assert len(docs["start"]) == 1 assert len(docs["event"]) == 0 assert len(docs["descriptor"]) == 0 assert len(docs["stop"]) == stop_num assert len(RE.msg_hook.msgs) == msg_num
def custom_step(detectors, motor, step): """ Inner loop of a 1D step scan Modified the default function for ``per_step`` param in 1D plans. Add a pause to adjust the attenuator """ yield from checkpoint() print('Set attenuator to {}'.format(step)) # adjust DMM range if step < 12: yield from abs_set(dmm.volt_range_dc, 10) elif step < 30: yield from abs_set(dmm.volt_range_dc, 1) elif step >= 30: yield from abs_set(dmm.volt_range_dc, 0.1) yield from pause() yield from abs_set(motor, step, wait=True) return (yield from trigger_and_read(list(detectors) + [motor]))
def plan(): yield from open_run() yield from sleep(1) yield from pause() yield from close_run()