# sech_pulse_pwc

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

```python
signals.sech_pulse_pwc(duration, segment_count, amplitude, width=None, center_time=None, *, name=None)
```

Create a Pwc representing a hyperbolic secant pulse.

### Parameters
* **duration** (*float*) – The duration of the signal, $T$.
* **segment_count** (*int*) – The number of segments in the PWC.
* **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 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 characteristic time for the hyperbolic secant pulse, $t_\mathrm{pulse}$.
  If passed, it must either be a scalar or contain a single element.
  Defaults to $T/12$,
  giving the pulse a full width at half maximum (FWHM) of $0.22 T$.
* **center_time** (*float* *or* [*Tensor*](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Tensor.md#boulderopal.graph.Tensor) *or* *None* *,* *optional*) – The time at which the pulse peaks, $t_\mathrm{peak}$.
  If passed, it must either be a scalar or contain a single element.
  Defaults to $T/2$.
* **name** (*str* *or* *None* *,* *optional*) – The name of the node.
### Returns
The sampled hyperbolic secant pulse.
### 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_pwc`](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Graph/signals/gaussian_pulse_pwc.md#boulderopal.graph.signals.gaussian_pulse_pwc)
: Create a Pwc 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.

[`Graph.signals.sech_pulse_stf`](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Graph/signals/sech_pulse_stf.md#boulderopal.graph.signals.sech_pulse_stf)
: Corresponding operation with Stf output.

[`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 hyperbolic secant pulse is defined as

$$
\mathop{\mathrm{Sech}}(t)
= \frac{A}{\cosh\left((t - t_\mathrm{peak}) / t_\mathrm{pulse} \right)} .
$$

The FWHM of the pulse is about $2.634 t_\mathrm{pulse}$.

## Examples

Define a simple sech PWC pulse.

```pycon
>>> graph.signals.sech_pulse_pwc(
...     duration=5, segment_count=50, amplitude=1, name="sech"
... )
<Pwc: name="sech", operation_name="discretize_stf", value_shape=(), batch_shape=()>
>>> result = bo.execute_graph(graph=graph, output_node_names="sech")
>>> result["output"]["sech"]
{
    'durations': array([0.1, 0.1, ..., 0.1, 0.1]),
    'values': array([0.00558953, 0.00710565, ..., 0.00710565, 0.00558953]),
    'time_dimension': 0
}
```

Define a displaced sech PWC pulse.

```pycon
>>> graph.signals.sech_pulse_pwc(
...     duration=3e-6,
...     segment_count=60,
...     amplitude=20e6,
...     width=0.15e-6,
...     center_time=1e-6,
...     name="displaced",
... )
<Pwc: name="displaced", operation_name="discretize_stf", value_shape=(), batch_shape=()>
>>> result = bo.execute_graph(graph=graph, output_node_names="sech_displaced")
>>> result["output"]["sech_displaced"]
{
    'durations': array([5.e-08, 5.e-08, ..., 5.e-08, 5.e-08]),
    'values': array([6.01374318e+04, 8.39283672e+04, ..., 1.06810547e+02, 7.65331014e+01]),
    'time_dimension': 0
}
```

Define a sech pulse with optimizable parameters.

```pycon
>>> amplitude = graph.optimizable_scalar(
...     lower_bound=0, upper_bound=10e6, name="amplitude"
... )
>>> width = graph.optimizable_scalar(
...     lower_bound=0.1e-6, upper_bound=0.5e-6, name="width"
... )
>>> center_time = graph.optimizable_scalar(
...     lower_bound=1e-6, upper_bound=2e-6, name="center_time"
... )
>>> graph.signals.sech_pulse_pwc(
...     duration=3e-6,
...     segment_count=32,
...     amplitude=amplitude,
...     width=width,
...     center_time=center_time,
...     name="sech_pulse",
... )
<Pwc: name="sech_pulse", operation_name="discretize_stf", value_shape=(), batch_shape=()>
```
