spin_pulse.transpilation.pulse_layer¶
Layer of pulses applied to the target qubits simultaneously.
Classes¶
Layer of one- and two-qubit gate pulse sequences. |
Module Contents¶
- class spin_pulse.transpilation.pulse_layer.PulseLayer(qubits, oneq_pulse_sequences, twoq_pulse_sequences)[source]¶
Layer of one- and two-qubit gate pulse sequences.
A PulseLayer groups single-qubit and two-qubit PulseSequence objects that act over a common time interval. Pulse sequences in the layer are eventually padded with idle instructions such that all of them share the same duration. The layer keeps track of which qubits are driven by one-qubit or two-qubit pulses and which qubits remain idle.
- - duration
Duration of the layer, which is the maximal duration of the pulse sequences given.
- Type:
- - qubits
Ordered list of qubits included in the layer.
- Type:
list[qiskit.circuit.Qubit]
- - num_qubits
Number of qubits in the layer.
- Type:
- - oneq_pulse_sequences
One-qubit pulse sequence assigned to each qubit. For qubits without an explicit drive, an idle-only PulseSequence of length duration is created.
- Type:
- - twoq_pulse_sequences
Two-qubit pulse sequences acting on pair of qubits in the layer.
- Type:
- - pulse_sequences
Concatenation of all one- and two-qubit pulse sequences in the layer.
- Type:
- - n_pulses
Total number of pulse sequences in the layer.
- Type:
- - qubits_oneq_active
Qubits that are manipulated during the layer through single-qubit gate.
- Type:
list[qiskit.circuit.Qubit]
- - qubits_twoq_active
Qubits that are manipulated during the layer through two-qubit gate.
- Type:
list[qiskit.circuit.Qubit]
- - qubits_idle
Qubits that are idle during this layer.
- Type:
list[qiskit.circuit.Qubit]
Initialize the PulseLayer from lists of pulse sequences and qubits.
- Parameters:
qubits (list[qiskit.circuit.Qubit]) – Ordered list of qubits included in the layer.
oneq_pulse_sequences (list[PulseSequence]) – One-qubit pulse sequences to be applied in the layer.
twoq_pulse_sequences (list[PulseSequence]) – Two-qubit pulse sequences to be applied in the layer.
- classmethod from_circuit_layer(qubits, circuit_layer, hardware_specs)[source]¶
Construct a PulseLayer from a circuit layer.
This method converts each gate in a circuit layer into a PulseSequence object according to the hardware specifications. Single- and two-qubit gates are translated separately, and the resulting pulse sequences are grouped into a PulseLayer.
- Parameters:
qubits (list[qiskit.circuit.Qubit]) – Ordered list of qubits included in the layer.
circuit_layer (QuantumCircuit) – QuantumCircuit instance representing one layer of a bigger circuit. Its instructions are passed to
gate_to_pulse_sequencesto be converted into pulses.hardware_specs (HardwareSpecs) – HardwareSpecs class instance that defines the hardware specifications.
- Returns:
A PulseLayer containing the pulse sequences that corresponds to the circuit_layer.
- Return type:
- plot(axs=None, label_gates=True)[source]¶
Plot all single-qubit and two-qubit pulse sequences in the layer.
For each qubit, the corresponding one-qubit PulseSequence is displayed on its own axis. Two-qubit PulseSequences are plotted on intermediate axes between the qubits they act on. If no axis array is provided, a new matplotlib figure is created.
- Parameters:
axs (list[Axes] | None) – Array of axes on which to draw the sequences. If None, a new figure and axis array is created.
label_gates (bool | str) – Controls gate labelling. If True, each pulse is annotated with a default gate label. If a string, the value is forwarded to the underlying
PulseSequence.plotmethods to customize labelling.
- to_circuit()[source]¶
Convert the pulse layer into an equivalent qiskit.QuantumCircuit.
Each PulseSequence is translated into a unitary matrix by propagating the corresponding Hamiltonian terms over the layer duration. Two-qubit sequences generate 4x4 unitaries, while single-qubit sequences generate 2x2 unitaries. The resulting unitaries are appended to a new qiskit.QuantumCircuit in an order consistent with the layer structure.
- Returns:
- A circuit representation of the pulse layer, where UnitaryGate
corresponds to a pulse sequence.
- Return type:
qiskit.QuantumCircuit
- attach_dynamical_decoupling(hardware_specs)[source]¶
Apply a dynamical decoupling sequence to all one-qubit pulse sequences if possible.
If a dynamical decoupling mode is specified in the hardware specifications, this method transforms each one-qubit PulseSequence in the layer with a new sequence obtained by applying a dynamical decoupling transformation according to the specified hardware parameters. Two-qubit sequences are left unchanged.
- Parameters:
hardware_specs (HardwareSpecs) – Hardware configuration specifying the dynamical decoupling mode and available pulse shapes.
- Return type:
None