def waitfor_proton_charge(threshold): """Set, trigger, read until the current reaches threshold""" i = 0 while True: print("Waiting for Proton Charge (> %f) LOOP %d" % (threshold, i)) yield from trigger(bs_pcharge, wait=True) current_pcharge = yield from read(bs_pcharge) if current_pcharge['bs_pcharge']['value'] >= threshold: print('DONE') break i += 1
def inner_xpcs(): yield from bp.checkpoint() yield from bp.create() for det in detectors: # Start acquisition. yield from bp.trigger(det) # Read the UID that points to this dataset in progress. yield from bp.read(det) # Insert an 'Event' document into databroker. Now we can access the (partial) dataset. yield from bp.save() # *Now* wait for the detector to actual finish acquisition. yield from bp.wait()