# cosine_pulse

boulderopal.signals.cosine_pulse(duration, amplitude, drag=0.0, start_time=0.0, end_time=None, flat_duration=0.0)

Create a Signal object representing a cosine pulse.

### Parameters

• duration (float) – The duration of the pulse.
• amplitude (float or complex) – The amplitude of the pulse, $A$
• drag (float , optional) – The DRAG parameter, $\beta$
• start_time (float , optional) – The time at which the cosine pulse starts, $t_\mathrm{start}$
• end_time (float or None , optional) – The time at which the cosine pulse ends, $t_\mathrm{end}$
• flat_duration (float , optional) – The amount of time that the pulse remains constant after the peak of the cosine, $t_\mathrm{flat}$

### Returns

The cosine pulse.

### Return type

Signal

boulderopal.signals.gaussian_pulse : Create a Signal object representing a Gaussian pulse.

boulderopal.signals.hann_series : Create a Signal object representing a sum of Hann window functions.

boulderopal.signals.sech_pulse : Create a Signal object representing a hyperbolic secant pulse.

boulderopal.signals.sinusoid : Create a Signal object representing a sinusoidal oscillation.

boulderopal.signals.square_pulse : Create a Signal object representing a square pulse.

Graph.signals.cosine_pulse_pwc : Graph operation to create a Pwc representing a cosine pulse.

## Notes

The cosine pulse is defined as

$\mathop{\mathrm{Cos}}(t) = \begin{cases} 0 &\mathrm{if} \quad t < t_\mathrm{start} \\ \frac{A}{2} \left[1+\cos \left(\omega \\{t-\tau_-\\} \right) + i\omega\beta \sin \left(\omega \\{t-\tau_-\\}\right)\right] &\mathrm{if} \quad t_\mathrm{start} \le t < \tau_- \\ A &\mathrm{if} \quad \tau_- \le t \le \tau_+ \\ \frac{A}{2} \left[1+\cos \left(\omega\\{t-\tau_+\\}\right) + i\omega \beta\sin \left(\omega \\{t-\tau_+\\}\right)\right] &\mathrm{if} \quad \tau_+ < t \le t_\mathrm{end} \\ 0 &\mathrm{if} \quad t > t_\mathrm{end} \\ \end{cases},$

where $\omega=2\pi /(t_\mathrm{end}-t_\mathrm{start} - t_\mathrm{flat})$, $\tau_\mp$ are the start/end times of the flat segment, with $\tau_\mp=(t_\mathrm{start}+t_\mathrm{end} \mp t_\mathrm{flat})/2$

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

$\mathop{\mathrm{Cos}}(t) = \frac{A}{2} \left[1+\cos \left(\omega \\{t-\tau\\} \right) + i\omega\beta \sin \left(\omega \\{t-\tau\\}\right)\right] \theta(t-t_\mathrm{start}) \theta(t_\mathrm{end}-t),$

where now $\omega=2\pi /(t_\mathrm{end}-t_\mathrm{start})$, $\tau=(t_\mathrm{start}+t_\mathrm{end})/2$ and $\theta(t)$Heaviside step function.

## Examples

Define a cosine pulse.

>>> pulse = bo.signals.cosine_pulse(duration=3.0, amplitude=1.0)
>>> pulse.export_with_time_step(time_step=0.5)
array([0.0669873+0.j, 0.5      +0.j, 0.9330127+0.j, 0.9330127+0.j,
0.5      +0.j, 0.0669873+0.j])

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

>>> pulse = bo.signals.cosine_pulse(
...     duration=3.0, amplitude=1.0, drag=0.1, flat_duration=0.6
... )
>>> pulse.export_with_sampling_rate(sampling_rate=2.0)
array([0.10332333-0.07968668j, 0.69134172-0.12093555j,
1.        +0.j        , 1.        +0.j        ,
0.69134172+0.12093555j, 0.10332333+0.07968668j])