# square_pulse

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

```python
boulderopal.signals.square_pulse(duration, amplitude, start_time=0.0, end_time=None)
```

Create a Signal object representing a square pulse.

### Parameters
* **duration** (*float*) – The duration of the pulse.
* **amplitude** (*float* *or* *complex*) – The amplitude of the square pulse, $A$.
* **start_time** (*float* *,* *optional*) – The start time of the square pulse, $t_0$.
  Defaults to 0.
* **end_time** (*float* *or* *None* *,* *optional*) – The end time of the square pulse, $t_1$.
  Must be greater than the start time.
  Defaults to the duration.
### Returns
The square 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.

[`boulderopal.signals.gaussian_pulse`](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/signals/gaussian_pulse.md#boulderopal.signals.gaussian_pulse)
: Create a Signal object 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.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)
: Graph operation to create a Pwc representing a square pulse.

## Notes

The square pulse is defined as

$$
\mathop{\mathrm{Square}}(t) = A \theta(t-t_0) \theta(t_1-t) ,
$$

where $\theta(t)$ is the
[Heaviside step function](https://en.wikipedia.org/wiki/Heaviside_step_function).

## Examples

Define a square pulse and discretize it.

```pycon
>>> pulse = bo.signals.square_pulse(duration=4.0, amplitude=2.5, start_time=1.0, end_time=3.0)
>>> pulse.export_with_time_step(time_step=1.0)
array([0. , 2.5, 2.5, 0. ])
```
