  We present a new method for determining pulse imperfections and improving the
single-gate fidelity in a superconducting qubit. By applying consecutive
positive and negative $\pi$ pulses, we amplify the qubit evolution due to
microwave pulse distortion, which causes the qubit state to rotate around an
axis perpendicular to the intended rotation axis. Measuring these rotations as
a function of pulse period allows us to reconstruct the shape of the microwave
pulse arriving at the sample. Using the extracted response to predistort the
input signal, we are able to improve the pulse shapes and to reach an average
single-qubit gate fidelity higher than 99.8%.
