# gaussian_pulse_pwc

Source: https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Graph/signals/gaussian_pulse_pwc

```python
signals.gaussian_pulse_pwc(duration, segment_count, amplitude, width=None, center_time=None, drag=None, flat_duration=None, segmentation=SegmentationType.UNIFORM, *, name=None)
```

Create a Pwc representing a Gaussian pulse.

### Parameters
* **duration** (*float*) – The duration of the signal, $T$.
* **segment_count** (*int*) – The number of segments in the PWC.
  Must be at least four.
* **amplitude** (*float* *or* *complex* *or* [*Tensor*](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Tensor.md#boulderopal.graph.Tensor)) – The amplitude of the Gaussian pulse, $A$.
  It must either be a scalar or contain a single element.
* **width** (*float* *or* [*Tensor*](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Tensor.md#boulderopal.graph.Tensor) *or* *None* *,* *optional*) – The standard deviation of the Gaussian pulse, $\sigma$.
  It must either be a scalar or contain a single element.
  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* *or* [*Tensor*](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Tensor.md#boulderopal.graph.Tensor) *or* *None* *,* *optional*) – The DRAG parameter, $\beta$.
  If passed, it must either be a scalar or contain a single element.
  Defaults to no DRAG correction.
* **flat_duration** (*float* *or* *None* *,* *optional*) – The amount of time to remain constant after the peak of the Gaussian,
  $t_\mathrm{flat}$.
  If passed, it must be positive and less than the duration.
  Defaults to None, in which case no constant part is added to the Gaussian pulse.
* **segmentation** ([`SegmentationType`](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Graph/signals/SegmentationType.md#boulderopal.graph.signals.SegmentationType)) – The type of segmentation for the signal.
  With a “MINIMAL” segmentation, most of the segments are placed in the
  non-constant parts of the signal.
  Defaults to “UNIFORM”, in which case the segments are uniformly
  distributed along the signal’s duration.
* **name** (*str* *or* *None* *,* *optional*) – The name of the node.
### Returns
The sampled Gaussian pulse.
If no flat duration is passed then the pulse is evenly sampled between $0$ and
$T$. If one is passed, the flat part of the pulse is described by one or two
segments (depending on the values of center_time and segment_count), and the
rest of the pulse is sampled with the remaining segments.
### Return type
[Pwc](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Pwc.md#boulderopal.graph.Pwc)

### SEE ALSO
[`Graph.signals.cosine_pulse_pwc`](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Graph/signals/cosine_pulse_pwc.md#boulderopal.graph.signals.cosine_pulse_pwc)
: Create a Pwc representing a cosine 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)
: Corresponding operation with Stf output.

[`Graph.signals.sech_pulse_pwc`](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Graph/signals/sech_pulse_pwc.md#boulderopal.graph.signals.sech_pulse_pwc)
: Create a Pwc representing a hyperbolic secant pulse.

[`Graph.signals.square_pulse_pwc`](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Graph/signals/square_pulse_pwc.md#boulderopal.graph.signals.square_pulse_pwc)
: Create a Pwc 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 PWC pulse.

```pycon
>>> graph.signals.gaussian_pulse_pwc(
...     duration=3.0,
...     segment_count=100,
...     amplitude=1.0,
...     name="gaussian",
... )
<Pwc: name="gaussian", operation_name="discretize_stf", value_shape=(), batch_shape=()>
>>> result = bo.execute_graph(graph=graph, output_node_names="gaussian")
>>> result["output"]["gaussian"]
{
    'durations': array([0.03, 0.03, ..., 0.03, 0.03]),
    'values': array([4.77913973e-06, 7.80106730e-06, ..., 7.80106730e-06, 4.77913973e-06]),
    'time_dimension': 0
}
```

Define a flat-top Gaussian PWC pulse with a DRAG correction with minimal segmentation.

```pycon
>>> graph.signals.gaussian_pulse_pwc(
...     duration=3.0,
...     segment_count=100,
...     amplitude=1.0,
...     width=0.2,
...     center_time=1.5,
...     drag=0.1,
...     flat_duration=0.2,
...     segmentation="MINIMAL",
...     name="drag",
... )
<Pwc: name="drag", operation_name="time_concatenate_pwc", value_shape=(), batch_shape=()>
>>> result = bo.execute_graph(graph=graph, output_node_names="gaussian_drag")
>>> result["output"]["gaussian_drag"]
{
    'durations': array([0.02857143, 0.02857143, ..., 0.02857143, 0.02857143]),
    'values': array([3.76551948e-11+1.30448351e-10j, 1.00289674e-10+3.40268532e-10j, ...,
                     1.00289593e-10-3.40268262e-10j, 3.76551637e-11-1.30448246e-10j]),
    'time_dimension': 0
}
```

Define a Gaussian pulse with optimizable parameters.

```pycon
>>> amplitude = graph.optimizable_scalar(
...     lower_bound=0, upper_bound=2.*np.pi, name="amplitude"
... )
>>> width = graph.optimizable_scalar(
...     lower_bound=0.1, upper_bound=2., name="width"
... )
>>> drag = graph.optimizable_scalar(
...     lower_bound=0, upper_bound=1., name="drag"
... )
>>> graph.signals.gaussian_pulse_pwc(
...     duration=3.0,
...     segment_count=100,
...     amplitude=amplitude,
...     width=width,
...     drag=drag,
...     name="gaussian",
... )
<Pwc: name="gaussian", operation_name="discretize_stf", value_shape=(), batch_shape=()>
```
