# DrivenControl

class qctrlopencontrols.DrivenControl(durations, rabi_rates=None, azimuthal_angles=None, detunings=None, name=None)

A piecewise-constant driven control for a single qubit.

### Parameters

• durations (np.ndarray) – The durations $\{\delta t_n\}$ for each segment, in units of seconds. Every element must be positive. Represented as a 1D array of length $N$, where $N$ is number of segments.
• rabi_rates (np.ndarray , optional) – The Rabi rates $\{\Omega_n\}$ for each segment, in units of radians per second. Every element must be nonnegative. Represented as a 1D array of length $N$, where $N$ is number of segments. You can omit this field if the Rabi rate is zero on all segments.
• azimuthal_angles (np.ndarray , optional) – The azimuthal angles $\{\phi_n\}$ for each segment. Represented as a 1D array of length $N$, where $N$ is number of segments. You can omit this field if the azimuthal angle is zero on all segments.
• detunings (np.ndarray , optional) – The detunings $\{\Delta_n\}$ for each segment, in units of radians per second. Represented as a 1D array of length $N$, where $N$ is number of segments. You can omit this field if the detuning is zero on all segments.
• name (string , optional) – An optional string to name the control. Defaults to None.

## Notes

This class represents a control for a single driven qubit with Hamiltonian:

$H(t) = \frac{1}{2}\left(\Omega(t) e^{i\phi(t)} \sigma_- + \Omega(t) e^{-i\phi(t)}\sigma_+\right) + \frac{1}{2}\Delta(t)\sigma_z,$

where $\Omega(t)$ is the Rabi rate, $\phi(t)$ is the azimuthal angle (or drive phase), $\Delta(t)$ is the detuning, $\sigma_\pm = (\sigma_x \mp i\sigma_y)/2$, and $\sigma_k$ are the Pauli matrices.

The controls are piecewise-constant, meaning $\Omega(t)=\Omega_n$ for $t_{n-1}\leq t, where $t_0=0$ and $t_n=t_{n-1}+\delta t_n$ (and similarly for $\phi(t)$ and $\Delta(t)$).

For each segment of the control, the constant Hamiltonian effects unitary time evolution of the form:

$U_n = \exp\left[-i\frac{\theta_n}{2} (\mathbf u_n\cdot\boldsymbol \sigma)\right],$

where $\theta_n = \sqrt{\Omega_n^2+\Delta_n^2}\delta t_n$, $\mathbf u_n$ is the unit vector in the direction $(\Omega_n\cos\phi_n, \Omega_n\sin\phi_n, \Delta_n)$, and $\boldsymbol\sigma=(\sigma_x, \sigma_y, \sigma_z)$. This unitary time evolution corresponds to a rotation of the Bloch sphere of an angle $\theta_n$ about the axis $\mathbf u_n$.

## Methods

exportReturns a dictionary formatted for plotting using the Q-CTRL Visualizer package.
export_to_filePrepares and saves the driven control in a file.
resampleReturns a new driven control obtained by resampling this control.

## Attributes

amplitude_xReturns the x-amplitude.
amplitude_yReturns the y-amplitude.
anglesReturns the Bloch sphere rotation angles.
directionsReturns the Bloch sphere rotation directions.
durationReturns the total duration of the control.
maximum_detuningReturns the maximum detuning of the control.
maximum_durationReturns the duration of the longest control segment.
maximum_rabi_rateReturns the maximum Rabi rate of the control.
minimum_durationReturns the duration of the shortest control segment.
number_of_segmentsReturns the number of segments.
timesReturns the boundary times of the control segments.