# DrivenControl

Source: https://docs.q-ctrl.com/references/qctrl-open-controls/qctrlopencontrols/DrivenControl

```python
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<t_n$, 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

|||
|----------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------|
| [export](https://docs.q-ctrl.com/references/qctrl-open-controls/qctrlopencontrols/DrivenControl.export.md#qctrlopencontrols.DrivenControl.export)                         | Returns a dictionary formatted for plotting using the Q-CTRL Visualizer package.   |
| [export_to_file](https://docs.q-ctrl.com/references/qctrl-open-controls/qctrlopencontrols/DrivenControl.export_to_file.md#qctrlopencontrols.DrivenControl.export_to_file) | Prepares and saves the driven control in a file.                                   |
| [resample](https://docs.q-ctrl.com/references/qctrl-open-controls/qctrlopencontrols/DrivenControl.resample.md#qctrlopencontrols.DrivenControl.resample)                   | Returns a new driven control obtained by resampling this control.                  |

## Attributes

|||
|----------------------------------------------------------------------------------------------------------------|-------------------------------------------------------|
| [amplitude_x](https://docs.q-ctrl.com/references/qctrl-open-controls/qctrlopencontrols/DrivenControl.amplitude_x.md#qctrlopencontrols.DrivenControl.amplitude_x)                      | Returns the x-amplitude.                              |
| [amplitude_y](https://docs.q-ctrl.com/references/qctrl-open-controls/qctrlopencontrols/DrivenControl.amplitude_y.md#qctrlopencontrols.DrivenControl.amplitude_y)                      | Returns the y-amplitude.                              |
| [angles](https://docs.q-ctrl.com/references/qctrl-open-controls/qctrlopencontrols/DrivenControl.angles.md#qctrlopencontrols.DrivenControl.angles)                                     | Returns the Bloch sphere rotation angles.             |
| [directions](https://docs.q-ctrl.com/references/qctrl-open-controls/qctrlopencontrols/DrivenControl.directions.md#qctrlopencontrols.DrivenControl.directions)                         | Returns the Bloch sphere rotation directions.         |
| [duration](https://docs.q-ctrl.com/references/qctrl-open-controls/qctrlopencontrols/DrivenControl.duration.md#qctrlopencontrols.DrivenControl.duration)                               | Returns the total duration of the control.            |
| [maximum_detuning](https://docs.q-ctrl.com/references/qctrl-open-controls/qctrlopencontrols/DrivenControl.maximum_detuning.md#qctrlopencontrols.DrivenControl.maximum_detuning)       | Returns the maximum detuning of the control.          |
| [maximum_duration](https://docs.q-ctrl.com/references/qctrl-open-controls/qctrlopencontrols/DrivenControl.maximum_duration.md#qctrlopencontrols.DrivenControl.maximum_duration)       | Returns the duration of the longest control segment.  |
| [maximum_rabi_rate](https://docs.q-ctrl.com/references/qctrl-open-controls/qctrlopencontrols/DrivenControl.maximum_rabi_rate.md#qctrlopencontrols.DrivenControl.maximum_rabi_rate)    | Returns the maximum Rabi rate of the control.         |
| [minimum_duration](https://docs.q-ctrl.com/references/qctrl-open-controls/qctrlopencontrols/DrivenControl.minimum_duration.md#qctrlopencontrols.DrivenControl.minimum_duration)       | Returns the duration of the shortest control segment. |
| [number_of_segments](https://docs.q-ctrl.com/references/qctrl-open-controls/qctrlopencontrols/DrivenControl.number_of_segments.md#qctrlopencontrols.DrivenControl.number_of_segments) | Returns the number of segments.                       |
| [times](https://docs.q-ctrl.com/references/qctrl-open-controls/qctrlopencontrols/DrivenControl.times.md#qctrlopencontrols.DrivenControl.times)                                        | Returns the boundary times of the control segments.   |
