PulseSequence

class braket.pulse.pulse_sequence.PulseSequence[source]

Bases: object

A representation of a collection of instructions to be performed on a quantum device and the requested results.

to_time_trace()[source]

Generate an approximate trace of the amplitude, frequency, phase for each frame contained in the PulseSequence, under the action of the instructions contained in the pulse sequence.

Return type:

PulseSequenceTrace

Returns:

PulseSequenceTrace – The approximation information with each attribute (amplitude, frequency and phase) mapping a str (frame id) to a TimeSeries (containing the time evolution of that attribute).

property parameters: set[FreeParameter]

Returns the set of FreeParameter s in the PulseSequence.

set_frequency(frame, frequency)[source]

Adds an instruction to set the frequency of the frame to the specified frequency value.

Parameters:
  • frame (Frame) – Frame for which the frequency needs to be set.

  • frequency (float | FreeParameterExpression) – frequency value to set for the specified frame.

Return type:

PulseSequence

Returns:

PulseSequence – self, with the instruction added.

shift_frequency(frame, frequency)[source]

Adds an instruction to shift the frequency of the frame by the specified frequency value.

Parameters:
  • frame (Frame) – Frame for which the frequency needs to be shifted.

  • frequency (float | FreeParameterExpression) – frequency value by which to shift the frequency for the specified frame.

Return type:

PulseSequence

Returns:

PulseSequence – self, with the instruction added.

set_phase(frame, phase)[source]

Adds an instruction to set the phase of the frame to the specified phase value.

Parameters:
  • frame (Frame) – Frame for which the frequency needs to be set.

  • phase (float | FreeParameterExpression) – phase value to set for the specified frame.

Return type:

PulseSequence

Returns:

PulseSequence – self, with the instruction added.

shift_phase(frame, phase)[source]

Adds an instruction to shift the phase of the frame by the specified phase value.

Parameters:
  • frame (Frame) – Frame for which the phase needs to be shifted.

  • phase (float | FreeParameterExpression) – phase value by which to shift the phase for the specified frame.

Return type:

PulseSequence

Returns:

PulseSequence – self, with the instruction added.

swap_phases(frame_1, frame_2)[source]

Adds an instruction to swap the phases between two frames.

Parameters:
  • frame_1 (Frame) – First frame for which to swap the phase.

  • frame_2 (Frame) – Second frame for which to swap the phase.

Return type:

PulseSequence

Returns:

PulseSequence – self, with the instruction added.

set_scale(frame, scale)[source]

Adds an instruction to set the scale on the frame to the specified scale value.

Parameters:
  • frame (Frame) – Frame for which the scale needs to be set.

  • scale (float | FreeParameterExpression) – scale value to set on the specified frame.

Return type:

PulseSequence

Returns:

PulseSequence – self, with the instruction added.

delay(qubits_or_frames, duration)[source]

Adds an instruction to advance the frame clock by the specified duration value.

Parameters:
  • qubits_or_frames (Frame | list[Frame] | QubitSet) – Qubits or frame(s) on which the delay needs to be introduced.

  • duration (float | FreeParameterExpression) – value (in seconds) defining the duration of the delay.

Return type:

PulseSequence

Returns:

PulseSequence – self, with the instruction added.

barrier(qubits_or_frames)[source]

Adds an instruction to align the frame clocks to the latest time across all the specified frames.

Parameters:

qubits_or_frames (list[Frame] | QubitSet) – Qubits or frames which the delay needs to be introduced.

Return type:

PulseSequence

Returns:

PulseSequence – self, with the instruction added.

play(frame, waveform)[source]

Adds an instruction to play the specified waveform on the supplied frame.

Parameters:
  • frame (Frame) – Frame on which the specified waveform signal would be output.

  • waveform (Waveform) – Waveform envelope specifying the signal to output on the specified frame.

Return type:

PulseSequence

Returns:

PulseSequence – returns self.

capture_v0(frame)[source]

Adds an instruction to capture the bit output from measuring the specified frame.

Parameters:

frame (Frame) – Frame on which the capture operation needs to be performed.

Return type:

PulseSequence

Returns:

PulseSequence – self, with the instruction added.

make_bound_pulse_sequence(param_values)[source]

Binds FreeParameters based upon their name and values passed in. If parameters share the same name, all the parameters of that name will be set to the mapped value.

Parameters:

param_values (dict[str, float]) – A mapping of FreeParameter names to a value to assign to them.

Return type:

PulseSequence

Returns:

PulseSequence – Returns a PulseSequence with all present parameters fixed to their respective values.

to_ir(sort_input_parameters=False)[source]

Converts this OpenPulse problem into IR representation.

Parameters:

sort_input_parameters (bool) – whether input parameters should be printed in a sorted order. Defaults to False.

Return type:

str

Returns:

str – a str representing the OpenPulse program encoding the PulseSequence.