# square_pulse_pwc¶

The Boulder Opal Toolkits are currently in beta phase of development. Breaking changes may be introduced.

square_pulse_pwc(duration, amplitude, start_time=0, end_time=None, *, name=None)

Create a Pwc representing a square pulse.

The entire signal lasts from time 0 to the given duration with the square pulse being applied from the start time to the end time.

Parameters
• duration (float) – The duration of the signal.

• amplitude (float or complex or Tensor) – The amplitude of the square pulse, $$A$$. It must either be a scalar or contain a single element.

• start_time (float, optional) – The start time of the square pulse, $$t_\mathrm{start}$$. Defaults to 0.

• end_time (float, optional) – The end time of the square pulse, $$t_\mathrm{end}$$. Must be greater than the start time. Defaults to the value of the given duration.

• name (str, optional) – The name of the node.

Returns

The square pulse. The returned Pwc can have a maximum of three segments and a minimum of one, depending on the start time, end time, and duration of the pulse.

Return type

Pwc

pulses.cosine_pulse_pwc()

Create a Pwc representing a cosine pulse.

pulses.gaussian_pulse_pwc()

Create a Pwc representing a Gaussian pulse.

pulses.sech_pulse_pwc()

Create a Pwc representing a hyperbolic secant pulse.

pulses.square_pulse()

Function to create a Pulse object representing a square pulse.

Notes

The square pulse is defined as

$\mathop{\mathrm{Square}}(t) = A \theta(t-t_\mathrm{start}) \theta(t_\mathrm{end}-t) ,$

where $$\theta(t)$$ is the Heaviside step function.

Examples

Define a square pulse with an optimizable amplitude.

>>> amplitude = graph.optimization_variable(
...     count=1, lower_bound=0, upper_bound=2.*np.pi, name="amplitude"
... )
>>> graph.pulses.square_pulse_pwc(
...     duration=4.0, amplitude=amplitude, name="square"
... )
<Pwc: name="square", operation_name="time_concatenate_pwc", value_shape=(), batch_shape=()>


Define a square PWC pulse.

>>> graph.pulses.square_pulse_pwc(
...     duration=4.0,
...     amplitude=2.5,
...     start_time=1.0,
...     end_time=3.0,
...     name="square",
... )
<Pwc: name="square", operation_name="time_concatenate_pwc", value_shape=(), batch_shape=()>
>>> result = qctrl.functions.calculate_graph(graph=graph, output_node_names=["square"])
>>> result.output["square"]
[
{'duration': 1.0, 'value': 0.0},
{'duration': 2.0, 'value': 2.5},
{'duration': 1.0, 'value': 0.0}
]