  High-brightness X-ray pulses, as generated at synchrotrons and X-ray free
electron lasers (XFEL), are used in a variety of scientific experiments. Many
experimental testbeds require optical equipment, e.g Compound Refractive Lenses
(CRLs), to be precisely aligned and focused. The lateral alignment of CRLs to a
beamline requires precise positioning along four axes: two translational, and
the two rotational. At a synchrotron, alignment is often accomplished manually.
However, XFEL beamlines present a beam brightness that fluctuates in time,
making manual alignment a time-consuming endeavor. Automation using classic
stochastic methods often fail, given the errant gradient estimates. We present
an online correction based on the combination of a generalized finite
difference stencil and a time-dependent sampling pattern. Error expectation is
analyzed, and efficacy is demonstrated. We provide a proof of concept by
laterally aligning optics on a simulated XFEL beamline.
