def inner_dark_frame_aware_plan():
        tmp = yield from bps.read(shutter.status)
        init_shutter_state = tmp[shutter.status.name]['value'] if tmp is not None else None
        yield from bps.mv(shutter, 'Open')

        for _ in range(num_images):
            yield from check_and_take_darks()
            yield from bpp.trigger_and_read([cam], name='primary')

        yield from bps.mv(shutter, init_shutter_state)
    def _pe_acquisition_plan():
        for det in dets:
            if images_per_set is not None:
                yield from bps.mov(det.images_per_set, images_per_set)

        for det in dets:
            yield from bps.stage(det)

        yield from bps.sleep(1)

        # close fast shutter, now take a dark
        # yield from bps.mov(fs, 0)
        yield from bpp.trigger_and_read(dets, name='dark')

        # open fast shutter
        # yield from bps.mov(fs, 1)
        yield from bpp.trigger_and_read(dets, name='primary')

        for det in dets:
            yield from bps.unstage(det)
Example #3
0
def one_1d_step_check_beam( detectors, motor, step ):
    from bluesky.plans import Msg
    from bluesky.preprocessors import trigger_and_read
    from bluesky.plan_stubs import mv, _short_uid
    def move():
        grp = _short_uid('set')
        yield Msg('checkpoint')
        yield Msg('set', motor, step, group=grp)
        yield Msg('wait', None, group=grp)
        #yield from mv( attn_shutter, 'Retract')
        yield from wait_for_ring()
        print('Check beam here.')

    yield from move()
    ret = (yield from trigger_and_read(list(detectors) + [motor]))
    #yield from mv(attn_shutter, 'Insert')
    return ret
Example #4
0
def one_1d_step_check_beam( detectors, motor, step ):
    from bluesky.plans import Msg
    from bluesky.preprocessors import trigger_and_read
    from bluesky.plan_stubs import mv, _short_uid
    def move():
        grp = _short_uid('set')
        yield Msg('checkpoint')
        yield Msg('set', motor, step, group=grp)
        yield Msg('wait', None, group=grp)
        #yield from mv( attn_shutter, 'Retract')
        yield from wait_for_ring()
        print('Check beam here.')

    yield from move()
    ret = (yield from trigger_and_read(list(detectors) + [motor]))
    #yield from mv(attn_shutter, 'Insert')
    return ret
Example #5
0
def one_1d_step_pseudo_shutter(detectors, motor, step):
    """
    Inner loop of a 1D step scan

    This is the default function for ``per_step`` param in 1D plans.
    """
    from bluesky.plans import Msg
    from bluesky.preprocessors import trigger_and_read
    from bluesky.plan_stubs import mv, _short_uid
    def move():
        grp = _short_uid('set')
        yield Msg('checkpoint')
        yield Msg('set', motor, step, group=grp)
        yield Msg('wait', None, group=grp)
        yield from mv(attn_shutter, 'Retract')
        
    yield from move()
    ret = (yield from trigger_and_read(list(detectors) + [motor]))
    yield from mv(attn_shutter, 'Insert')
    return ret
Example #6
0
def one_1d_step_pseudo_shutter(detectors, motor, step):
    """
    Inner loop of a 1D step scan

    This is the default function for ``per_step`` param in 1D plans.
    """
    from bluesky.plans import Msg
    from bluesky.preprocessors import trigger_and_read
    from bluesky.plan_stubs import mv, _short_uid
    def move():
        grp = _short_uid('set')
        yield Msg('checkpoint')
        yield Msg('set', motor, step, group=grp)
        yield Msg('wait', None, group=grp)
        yield from mv(attn_shutter, 'Retract')
        
    yield from move()
    ret = (yield from trigger_and_read(list(detectors) + [motor]))
    yield from mv(attn_shutter, 'Insert')
    return ret
Example #7
0
def one_nd_step_check_beam(detectors, step, pos_cache): 
    from bluesky.plans import Msg
    from bluesky.preprocessors import trigger_and_read
    from bluesky.plan_stubs import mv, _short_uid
    def move():
        yield Msg('checkpoint')
        grp = _short_uid('set')
        for motor, pos in step.items():
            if pos == pos_cache[motor]:
                # This step does not move this motor.
                continue
            yield Msg('set', motor, pos, group=grp)
            pos_cache[motor] = pos
        yield Msg('wait', None, group=grp)

    motors = step.keys()
    yield from move()
    ret = (yield from trigger_and_read(list(detectors) + list(motors)))
    # this means "put the attenuator in the beam"
    yield from mv(attn_shutter, 'Insert')
    return ret
Example #8
0
def one_nd_step_check_beam(detectors, step, pos_cache): 
    from bluesky.plans import Msg
    from bluesky.preprocessors import trigger_and_read
    from bluesky.plan_stubs import mv, _short_uid
    def move():
        yield Msg('checkpoint')
        grp = _short_uid('set')
        for motor, pos in step.items():
            if pos == pos_cache[motor]:
                # This step does not move this motor.
                continue
            yield Msg('set', motor, pos, group=grp)
            pos_cache[motor] = pos
        yield Msg('wait', None, group=grp)

    motors = step.keys()
    yield from move()
    ret = (yield from trigger_and_read(list(detectors) + list(motors)))
    # this means "put the attenuator in the beam"
    yield from mv(attn_shutter, 'Insert')
    return ret
def one_nd_step_pseudo_shutter(detectors, step, pos_cache):
    """
    Inner loop of an N-dimensional step scan

    This is the default function for ``per_step`` param`` in ND plans.

    Parameters
    ----------
    detectors : iterable
        devices to read
    step : dict
        mapping motors to positions in this step
    pos_cache : dict
        mapping motors to their last-set positions
    """
    from bluesky.plans import Msg
    from bluesky.preprocessors import trigger_and_read
    from bluesky.plan_stubs import mv, _short_uid

    def move():
        yield Msg('checkpoint')
        grp = _short_uid('set')
        for motor, pos in step.items():
            if pos == pos_cache[motor]:
                # This step does not move this motor.
                continue
            yield Msg('set', motor, pos, group=grp)
            pos_cache[motor] = pos
        yield Msg('wait', None, group=grp)
        # this means "take the attenuator out of the beam"
        yield from mv(attn_shutter, 'Retract')

    motors = step.keys()
    yield from move()
    ret = (yield from trigger_and_read(list(detectors) + list(motors)))
    # this means "put the attenuator in the beam"
    yield from mv(attn_shutter, 'Insert')
    return ret
Example #10
0
def one_nd_step_pseudo_shutter(detectors, step, pos_cache):
    """
    Inner loop of an N-dimensional step scan

    This is the default function for ``per_step`` param`` in ND plans.

    Parameters
    ----------
    detectors : iterable
        devices to read
    step : dict
        mapping motors to positions in this step
    pos_cache : dict
        mapping motors to their last-set positions
    """
    from bluesky.plans import Msg
    from bluesky.preprocessors import trigger_and_read
    from bluesky.plan_stubs import mv, _short_uid
    def move():
        yield Msg('checkpoint')
        grp = _short_uid('set')
        for motor, pos in step.items():
            if pos == pos_cache[motor]:
                # This step does not move this motor.
                continue
            yield Msg('set', motor, pos, group=grp)
            pos_cache[motor] = pos
        yield Msg('wait', None, group=grp)
        # this means "take the attenuator out of the beam"
        yield from mv(attn_shutter, 'Retract')

    motors = step.keys()
    yield from move()
    ret = (yield from trigger_and_read(list(detectors) + list(motors)))
    # this means "put the attenuator in the beam"    
    yield from mv(attn_shutter, 'Insert')
    return ret
 def check_and_take_darks():
     yield from dark_plan(cam, dark_frame_cache, obsolete_secs, shutter)
     if dark_frame_cache.update_done:
         yield from bpp.trigger_and_read([dark_frame_cache], name='dark')