Alignment Plans

Running the Rocking Curve

The rocking curve does two successive step scans, using the maximum of the first to center the finer scan on the second. There are a number of fields to configure and play with but lets start simple:

rock = rocking_curve(wave8.diode_1, hxrsnd.th2, 'peakT', 1, 0.1,
                     bounds=(0, 20), average=100)

RE(rock)

The code above runs a step scan from 0 to 20 in steps of 1, reading the diode at each point. A fit is processed at the end and a second scan is started 5 units to the left of the calculated center and runs using 0.1 as the step size until we reach 5 units greater than our first result. Finally, the rotation axis is centered with our new maximum.

If you want to use change the range of the second finer scan, you can use the fine_space keyword. In addition, the lmfit model that does our fitting accepts an initial guess. This can be useful to make an assumption about the system to improve the accuracy and dependability of the scan. Using this parameter would look like:

Documentation

hxrsnd.plans.alignment.rocking_curve(detector, motor, read_field, coarse_step, fine_step, bounds=None, average=None, fine_space=5, initial_guess=None, position_field='user_readback', show_plot=True)[source]

Travel to the maxima of a bell curve

The rocking curve scan is two repeated calls of maximize_lorentz(). The first is a rough step scan which searches the area given by bounds using coarse_step, the idea is that this will populate the model enough such that we can do a more accurate scan of a smaller region of the search space. Once the rough scan is completed, the maxima of the fit is used as the center of the new fine scan that probes a region of space with a region twice as large as the fine_space parameter. After this, the motor is translated to the calculated maxima of the model

Parameters:
detectorobj

The object to be read during the plan

motorobj

The object to be moved via the plan.

read_fieldstr

Field of detector to maximize

coarse_stepfloat

Step size for the initial rough scan

fine_stepfloat

Step size for the fine scan

boundstuple, optional

Bounds for the original rough scan. If not provided, the soft limits of the motor are used

averageint, optional

Number of shots to average at each step

fine_spacefloat, optional

The amount to scan on either side of the rough scan result. Note that the rocking_curve will never tell the secondary scan to travel outside

position_fieldstr, optional

Motor field that will have the Lorentzian relationship with the given signal

initial_guessdict, optional

Initial guess to the Lorentz model parameters of sigma center amplitude of the bounds, so this region may be truncated.

show_plotbool, optional

Create a plot displaying the progress of the rocking_curve

hxrsnd.plans.alignment.maximize_lorentz(detector, motor, read_field, step_size=1, bounds=None, average=None, filters=None, position_field='user_readback', initial_guess=None)[source]

Maximize a signal with a Lorentzian relationship to a motor

The following plan does a linear step scan through the parameter space while collecting information to create a Lorentzian model. After the scan has completed, the created model will be queried to find the estimated motor position that will yield the absolute maximum of the Lorentz equation

Parameters:
detectorobj

The object to be read during the plan

motorobj

The object to be moved via the plan.

read_fieldstr

Field of detector to maximize

nstepsint, optional

The step size used by the initial linear scan to create the Lorentzian model. A smaller step size will create a more accurate model, while a larger step size will increase the speed of the entire operation.

boundstuple, optional

The lower and higher limit of the search space. If no value is given the limits property of the motor will be queried next. If this does not yield anything useful an exception will be raised

averageint, optional

The number of shots to average at every step of the scan. If left as None, no average will be used

filtersdict, optional

Filters used to drop shots from the analysis

position_fieldstr, optional

Motor field that will have the Lorentzian relationship with the given signal

initial_guessdict, optional

Initial guess to the Lorentz model parameters of sigma center amplitude