Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 39 additions & 2 deletions qiskit/providers/fake_provider/fake_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
import json
import os

from typing import List
from typing import List, Iterable

from qiskit import circuit
from qiskit.providers.models import BackendProperties
from qiskit.providers.models import BackendProperties, PulseBackendConfiguration
from qiskit.providers import BackendV2, BackendV1
from qiskit import pulse
from qiskit.exceptions import QiskitError
Expand Down Expand Up @@ -72,6 +72,8 @@ class FakeBackendV2(BackendV2):
def __init__(self):
"""FakeBackendV2 initializer."""
self._conf_dict = self._get_conf_dict_from_json()
if self._conf_dict["open_pulse"]:
self._pulse_conf = PulseBackendConfiguration.from_dict(self._conf_dict)
self._props_dict = None
self._defs_dict = None
super().__init__(
Expand Down Expand Up @@ -337,6 +339,41 @@ def _get_noise_model_from_backend_v2(

return noise_model

def control_channel(self, qubits: Iterable[int]):
"""Return the secondary drive channel for the given qubit

This is typically utilized for controlling multiqubit interactions.
This channel is derived from other channels.

This is required to be implemented if the backend supports Pulse
scheduling.

Args:
qubits: Tuple or list of qubits of the form
``(control_qubit, target_qubit)``.

Returns:
List[ControlChannel]: The Qubit measurement acquisition line.

"""
return self._pulse_conf.control_channels[qubits]

@property
def control_channels(self):
"""Return the full dictionary of control channels

This is typically utilized for controlling multiqubit interactions.
This channel is derived from other channels.

This is required to be implemented if the backend supports Pulse
scheduling.

Returns:
Dict[Tuple[int], ControlChannel]: The contro channels dictionary

"""
return self._pulse_conf.control_channels


class FakeBackend(BackendV1):
"""This is a dummy backend just for testing purposes."""
Expand Down
2 changes: 1 addition & 1 deletion qiskit/providers/models/backendconfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ def from_dict(cls, data):
in_data = copy.copy(data)
gates = [GateConfig.from_dict(x) for x in in_data.pop("gates")]
in_data["gates"] = gates
input_uchannels = in_data.pop("u_channel_lo")
input_uchannels = in_data.pop("u_channel_lo", [])
u_channels = []
for channel in input_uchannels:
u_channels.append([UchannelLO.from_dict(x) for x in channel])
Expand Down