bluesky.plans.tune_centroid

bluesky.plans.tune_centroid(detectors, signal, motor, start, stop, min_step, num=10, step_factor=3.0, snake=False, *, md=None)[source]

plan: tune a motor to the centroid of signal(motor)

Initially, traverse the range from start to stop with the number of points specified. Repeat with progressively smaller step size until the minimum step size is reached. Rescans will be centered on the signal centroid (for $I(x)$, centroid$= sum{I}/sum{x*I}$) with original scan range reduced by step_factor.

Set snake=True if your positions are reproducible moving from either direction. This will not necessarily decrease the number of traversals required to reach convergence. Snake motion reduces the total time spent on motion to reset the positioner. For some positioners, such as those with hysteresis, snake scanning may not be appropriate. For such positioners, always approach the positions from the same direction.

Note: Ideally the signal has only one peak in the range to be scanned. It is assumed the signal is not polymodal between start and stop.

Parameters
detectorsSignal

list of ‘readable’ objects

signalstring

detector field whose output is to maximize

motorobject

any ‘settable’ object (motor, temp controller, etc.)

startfloat

start of range

stopfloat

end of range, note: start < stop

min_stepfloat

smallest step size to use.

numint, optional

number of points with each traversal, default = 10

step_factorfloat, optional

used in calculating new range after each pass

note: step_factor > 1.0, default = 3

snakebool, optional

if False (default), always scan from start to stop

mddict, optional

metadata

Examples

Find the center of a peak using synthetic hardware.

>>> from ophyd.sim import SynAxis, SynGauss
>>> motor = SynAxis(name='motor')
>>> det = SynGauss(name='det', motor, 'motor',
...                center=-1.3, Imax=1e5, sigma=0.05)
>>> RE(tune_centroid([det], "det", motor, -1.5, -0.5, 0.01, 10))