braket.pulse.waveforms module

class braket.pulse.waveforms.Waveform[source]

Bases: ABC

A waveform is a time-dependent envelope that can be used to emit signals on an output port or receive signals from an input port. As such, when transmitting signals to the qubit, a frame determines time at which the waveform envelope is emitted, its carrier frequency, and it’s phase offset. When capturing signals from a qubit, at minimum a frame determines the time at which the signal is captured. See https://openqasm.com/language/openpulse.html#waveforms for more details.

abstract sample(dt: float) ndarray[source]

Generates a sample of amplitudes for this Waveform based on the given time resolution.

Parameters:

dt (float) – The time resolution.

Returns:

np.ndarray – The sample amplitudes for this waveform.

class braket.pulse.waveforms.ArbitraryWaveform(amplitudes: list[complex], id: str | None = None)[source]

Bases: Waveform

An arbitrary waveform with amplitudes at each timestep explicitly specified using an array.

Initializes an ArbitraryWaveform.

Parameters:
  • amplitudes (list[complex]) – Array of complex values specifying the waveform amplitude at each timestep. The timestep is determined by the sampling rate of the frame to which waveform is applied to.

  • id (Optional[str]) – The identifier used for declaring this waveform. A random string of ascii characters is assigned by default.

sample(dt: float) ndarray[source]

Generates a sample of amplitudes for this Waveform based on the given time resolution.

Parameters:

dt (float) – The time resolution.

Raises:

NotImplementedError – This class does not implement sample.

Returns:

np.ndarray – The sample amplitudes for this waveform.

class braket.pulse.waveforms.ConstantWaveform(length: float | FreeParameterExpression, iq: complex, id: str | None = None)[source]

Bases: Waveform, Parameterizable

A constant waveform which holds the supplied iq value as its amplitude for the specified length.

Initializes a ConstantWaveform.

Parameters:
  • length (Union[float, FreeParameterExpression]) – Value (in seconds) specifying the duration of the waveform.

  • iq (complex) – complex value specifying the amplitude of the waveform.

  • id (Optional[str]) – The identifier used for declaring this waveform. A random string of ascii characters is assigned by default.

property parameters: list[FreeParameterExpression | FreeParameter | float]

Returns the parameters associated with the object, either unbound free parameter expressions or bound values.

Returns:

list[Union[FreeParameterExpression, FreeParameter, float]] – a list of parameters.

bind_values(**kwargs: FreeParameter | str) ConstantWaveform[source]

Takes in parameters and returns an object with specified parameters replaced with their values.

Parameters:

**kwargs (Union[FreeParameter, str]) – Arbitrary keyword arguments.

Returns:

ConstantWaveform – A copy of this waveform with the requested parameters bound.

sample(dt: float) ndarray[source]

Generates a sample of amplitudes for this Waveform based on the given time resolution.

Parameters:

dt (float) – The time resolution.

Returns:

np.ndarray – The sample amplitudes for this waveform.

class braket.pulse.waveforms.DragGaussianWaveform(length: float | FreeParameterExpression, sigma: float | FreeParameterExpression, beta: float | FreeParameterExpression, amplitude: float | FreeParameterExpression = 1, zero_at_edges: bool = False, id: str | None = None)[source]

Bases: Waveform, Parameterizable

A gaussian waveform with an additional gaussian derivative component and lifting applied.

Initializes a DragGaussianWaveform.

Parameters:
  • length (Union[float, FreeParameterExpression]) – Value (in seconds) specifying the duration of the waveform.

  • sigma (Union[float, FreeParameterExpression]) – A measure (in seconds) of how wide or narrow the Gaussian peak is.

  • beta (Union[float, FreeParameterExpression]) – The correction amplitude.

  • amplitude (Union[float, FreeParameterExpression]) – The amplitude of the waveform envelope. Defaults to 1.

  • zero_at_edges (bool) – bool specifying whether the waveform amplitude is clipped to zero at the edges. Defaults to False.

  • id (Optional[str]) – The identifier used for declaring this waveform. A random string of ascii characters is assigned by default.

property parameters: list[FreeParameterExpression | FreeParameter | float]

Returns the parameters associated with the object, either unbound free parameter expressions or bound values.

bind_values(**kwargs: FreeParameter | str) DragGaussianWaveform[source]

Takes in parameters and returns an object with specified parameters replaced with their values.

Parameters:

**kwargs (Union[FreeParameter, str]) – Arbitrary keyword arguments.

Returns:

DragGaussianWaveform – A copy of this waveform with the requested parameters bound.

sample(dt: float) ndarray[source]

Generates a sample of amplitudes for this Waveform based on the given time resolution.

Parameters:

dt (float) – The time resolution.

Returns:

np.ndarray – The sample amplitudes for this waveform.

class braket.pulse.waveforms.GaussianWaveform(length: float | FreeParameterExpression, sigma: float | FreeParameterExpression, amplitude: float | FreeParameterExpression = 1, zero_at_edges: bool = False, id: str | None = None)[source]

Bases: Waveform, Parameterizable

A waveform with amplitudes following a gaussian distribution for the specified parameters.

Initializes a GaussianWaveform.

Parameters:
  • length (Union[float, FreeParameterExpression]) – Value (in seconds) specifying the duration of the waveform.

  • sigma (Union[float, FreeParameterExpression]) – A measure (in seconds) of how wide or narrow the Gaussian peak is.

  • amplitude (Union[float, FreeParameterExpression]) – The amplitude of the waveform envelope. Defaults to 1.

  • zero_at_edges (bool) – bool specifying whether the waveform amplitude is clipped to zero at the edges. Defaults to False.

  • id (Optional[str]) – The identifier used for declaring this waveform. A random string of ascii characters is assigned by default.

property parameters: list[FreeParameterExpression | FreeParameter | float]

Returns the parameters associated with the object, either unbound free parameter expressions or bound values.

bind_values(**kwargs: FreeParameter | str) GaussianWaveform[source]

Takes in parameters and returns an object with specified parameters replaced with their values.

Parameters:

**kwargs (Union[FreeParameter, str]) – Arbitrary keyword arguments.

Returns:

GaussianWaveform – A copy of this waveform with the requested parameters bound.

sample(dt: float) ndarray[source]

Generates a sample of amplitudes for this Waveform based on the given time resolution.

Parameters:

dt (float) – The time resolution.

Returns:

np.ndarray – The sample amplitudes for this waveform.