  Numerically optimised microwave pulses are used to increase excitation
efficiency and modulation depth in electron spin resonance experiments
performed on a spectrometer equipped with an arbitrary waveform generator. The
optimisation procedure is sample-specific and reminiscent of the magnet
shimming process used in the early days of nuclear magnetic resonance -- an
objective function (for example, echo integral in a spin echo experiment) is
defined and optimised numerically as a function of the pulse waveform vector
using noise-resilient gradient-free methods. We found that the resulting shaped
microwave pulses achieve higher excitation bandwidth and better echo modulation
depth than the pulse shapes used as the initial guess. Although the method is
theoretically less sophisticated than simulation based quantum optimal control
techniques, it has the advantage of being free of the linear response
approximation; rapid electron spin relaxation also means that the optimisation
takes only a few seconds. This makes the procedure fast, convenient, and easy
to use. An important application of this method is at the final stage of the
implementation of theoretically designed pulse shapes: compensation of pulse
distortions introduced by the instrument. The performance is illustrated using
spin echo and out-of-phase electron spin echo envelope modulation experiments.
Interface code between Bruker SpinJet arbitrary waveform generator and Matlab
is included in versions 2.2 and later of the Spinach library.
