# gaussian_pulse

Source: https://docs.q-ctrl.com/references/boulder-opal/boulderopal/signals/gaussian_pulse

```python
boulderopal.signals.gaussian_pulse(duration, amplitude, width=None, center_time=None, drag=0.0, flat_duration=0.0)
```

Create a Signal object representing a Gaussian pulse.

### Parameters
* **duration** (*float*) – The duration of the signal, $T$.
* **amplitude** (*float* *or* *complex*) – The amplitude of the Gaussian pulse, $A$.
* **width** (*float* *or* *None* *,* *optional*) – The standard deviation of the Gaussian pulse, $\sigma$.
  Defaults to $T/10$ or $(T-t_\mathrm{flat})/10$ if flat_duration is passed.
* **center_time** (*float* *or* *None* *,* *optional*) – The center of the Gaussian pulse, $t_0$.
  Defaults to half of the given value of the duration, $T/2$.
* **drag** (*float* *,* *optional*) – The DRAG parameter, $\beta$.
  Defaults to 0, in which case there is no DRAG correction.
* **flat_duration** (*float* *,* *optional*) – The amount of time to remain constant after the peak of the Gaussian,
  $t_\mathrm{flat}$.
  If passed, it must be nonnegative and less than the duration.
  Defaults to 0, in which case no constant part is added to the Gaussian pulse.
### Returns
The Gaussian pulse.
### Return type
[Signal](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/signals/Signal.md#boulderopal.signals.Signal)

### SEE ALSO
[`boulderopal.signals.cosine_pulse`](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/signals/cosine_pulse.md#boulderopal.signals.cosine_pulse)
: Create a Signal object representing a cosine pulse.

[`Graph.signals.gaussian_pulse_pwc`](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Graph/signals/gaussian_pulse_pwc.md#boulderopal.graph.signals.gaussian_pulse_pwc)
: Graph operation to create a Pwc representing a Gaussian pulse.

[`Graph.signals.gaussian_pulse_stf`](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Graph/signals/gaussian_pulse_stf.md#boulderopal.graph.signals.gaussian_pulse_stf)
: Graph operation to create a Stf representing a Gaussian pulse.

[`boulderopal.signals.sech_pulse`](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/signals/sech_pulse.md#boulderopal.signals.sech_pulse)
: Create a Signal object representing a hyperbolic secant pulse.

[`boulderopal.signals.square_pulse`](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/signals/square_pulse.md#boulderopal.signals.square_pulse)
: Create a Signal object representing a square pulse.

## Notes

The Gaussian pulse is defined as

$$
\mathop{\mathrm{Gaussian}}(t) =
\begin{cases}
    A \left(1-\frac{i\beta (t-t_1)}{\sigma^2}\right)
    \exp \left(- \frac{(t-t_1)^2}{2\sigma^2} \right)
        &\mathrm{if} \quad t < t_1=t_0- t_\mathrm{flat}/2\\
    A
        &\mathrm{if} \quad t_0-t_\mathrm{flat}/2 \le t < t_0+t_\mathrm{flat}/2 \\
    A \left(1-\frac{i\beta (t-t_2)}{\sigma^2}\right)
    \exp \left(- \frac{(t-t_2)^2}{2\sigma^2} \right)
        &\mathrm{if} \quad t > t_2=t_0+t_\mathrm{flat}/2
\end{cases} .
$$

If the flat duration is zero (the default setting), this reduces to

$$
\mathop{\mathrm{Gaussian}}(t) =
A \left(1-\frac{i\beta (t-t_0)}{\sigma^2}\right)
\exp \left(- \frac{(t-t_0)^2}{2\sigma^2} \right) .
$$

## Examples

Define a Gaussian pulse.

```pycon
>>> pulse = bo.signals.gaussian_pulse(duration=2.0, amplitude=1.0)
>>> pulse.export_with_time_step(time_step=0.2)
array([4.00652974e-05+0.j, 2.18749112e-03+0.j, 4.39369336e-02+0.j,
   3.24652467e-01+0.j, 8.82496903e-01+0.j, 8.82496903e-01+0.j,
   3.24652467e-01+0.j, 4.39369336e-02+0.j, 2.18749112e-03+0.j,
   4.00652974e-05+0.j])
```

Define a flat-top Gaussian pulse with a DRAG correction.

```pycon
>>> pulse = bo.signals.gaussian_pulse(
...     duration=1.0,
...     amplitude=1.0,
...     width=0.2,
...     center_time=0.6,
...     drag=0.1,
...     flat_duration=0.2,
... )
>>> pulse.export_with_sampling_rate(sampling_rate=10.)
array([0.07955951+0.08950445j, 0.21626517+0.18923202j,
   0.45783336+0.28614585j, 0.7548396 +0.28306485j,
   0.96923323+0.12115415j, 1.        +0.j        ,
   1.        +0.j        , 0.96923323-0.12115415j,
   0.7548396 -0.28306485j, 0.45783336-0.28614585j])
```
