source/_cookbook/grid_in_grid.py
def grid_in_grid(samples):
    """
    Scan a grid around the neighborhood of each sample.

    Parameters
    ----------
    sample : dict
        mapping each sample's name to its (x, y) position
    """
    
    # In this example we hard-code the hardware and other parameters. For more
    # flexibility, they could instead be parameters to the function.
    detector = det4
    x = motor1
    y = motor2
    x_range = y_range = 0.2
    x_num = y_num = 5

    @subs_decorator([LiveTable([detector, x, y]),
                     LivePlot('motor2', 'motor1')])
    def plan():
        for name, position in samples.items():
            # Prepare metadata.
            md = {'sample': name}

            # Move to the cetner of the sample position.
            x_pos, y_pos = position
            yield from abs_set(x, x_pos)
            yield from abs_set(y, y_pos)
            yield from wait()

            # Scan a grid around that position.
            yield from relative_outer_product_scan([detector],
                                                   x, -x_range, x_range, x_num,
                                                   y, -y_range, y_range, y_num,
                                                   True, md=md)

    yield from plan()

    Scan a grid around the neighborhood of each sample.

    Parameters
    ----------
    sample : dict
        mapping each sample's name to its (x, y) position
    
Scan a grid around the neighborhood of each sample.
Parameters

sample : dict
mapping each sample's name to its (x, y) position
Scan a grid around the neighborhood of each sample . Parameters sample : dict mapping each sample ' s name to its ( x y ) position
def grid_in_grid(samples):
    detector = det4
    x = motor1
    y = motor2
    x_range = y_range = 0.2
    x_num = y_num = 5
    @subs_decorator([LiveTable([detector, x, y]),
                     LivePlot('motor2', 'motor1')])
    def plan():
        for name, position in samples.items():
            md = {'sample': name}
            x_pos, y_pos = position
            yield from abs_set(x, x_pos)
            yield from abs_set(y, y_pos)
            yield from wait()
            yield from relative_outer_product_scan([detector],
                                                   x, -x_range, x_range, x_num,
                                                   y, -y_range, y_range, y_num,
                                                   True, md=md)
    yield from plan()
def grid_in_grid ( samples ) : detector = det4 x = motor1 y = motor2 x_range = y_range = 0.2 x_num = y_num = 5 @ subs_decorator ( [ LiveTable ( [ detector , x , y ] ) , LivePlot ( 'motor2' , 'motor1' ) ] ) def plan ( ) : for name , position in samples . items ( ) : md = { 'sample' : name } x_pos , y_pos = position yield from abs_set ( x , x_pos ) yield from abs_set ( y , y_pos ) yield from wait ( ) yield from relative_outer_product_scan ( [ detector ] , x , - x_range , x_range , x_num , y , - y_range , y_range , y_num , True , md = md ) yield from plan ( )
Scan a grid around the neighborhood of each sample.
Scan a grid around the neighborhood of each sample .
"""
    Scan a grid around the neighborhood of each sample.

    Parameters
    ----------
    sample : dict
        mapping each sample's name to its (x, y) position
    """ # In this example we hard-code the hardware and other parameters. For more # flexibility, they could instead be parameters to the function. # Prepare metadata. # Move to the cetner of the sample position. # Scan a grid around that position.
samples