pygsti.extras.devices.experimentaldevice.ExperimentalDevice#
- class ExperimentalDevice(qubits, graph, gate_mapping=None)#
Bases:
objectSpecification of an experimental device.
Initialize an IBMQ device from qubits and connectivity info.
- Parameters:
qubits (list) – Qubit labels
graph (QubitGraph) – QubitGraph depicting device connectivity.
gate_mapping (dict, optional) – Mapping between pyGSTi gate names (keys) and IBM native gates (values). If None, simply use {‘Gcnot’: ‘cx’} to recover legacy behavior.
Methods
__init__(qubits, graph[, gate_mapping])Initialize an IBMQ device from qubits and connectivity info.
create_error_rates_model([caldata, ...])Create an error rates model (OplessModel) from calibration data.
create_local_depolarizing_model([caldata, ...])Create a LocalNoiseModel with depolarizing noise based on calibration data.
create_processor_spec([gate_names, ...])Create a QubitProcessorSpec from user-specified gates and device connectivity.
from_legacy_device(devname)Create a ExperimentalDevice from a legacy pyGSTi pygsti.extras.devices module.
from_qiskit_backend(backend[, gate_mapping])Construct a ExperimentalDevice from Qiskit provider backend information.
- create_error_rates_model(caldata=None, calformat='ibmq-v2019', model_type='TwirledLayers', idle_name=None)#
Create an error rates model (OplessModel) from calibration data.
- Parameters:
caldata (dict) – Calibration data. Currently, this can be retrieved via backend.properties().to_dict().
calformat (One of ['ibmq-v2018', 'ibmq-v2019', 'rigetti', 'native']) – Calibration data format, defaults to ibmq-v2019. TODO: It seems this has been changed, what version are we actually on?
model_type (One of ['TwirledLayers', 'TwirledGates', 'AnyErrorCausesFailure', 'AnyErrorCausesRandomOutput']) – Type of OplessModel to create
idle_name (str) – Name for the idle gate
- Return type:
- create_local_depolarizing_model(caldata=None, calformat='ibmq-v2019', qubits=None)#
Create a LocalNoiseModel with depolarizing noise based on calibration data.
Note: this model is * NOT * suitable for optimization: it is not aware that it is a local depolarization with non-independent error rates model.
- Parameters:
caldata (dict) – Calibration data. Currently, this can be retrieved via backend.properties().to_dict().
calformat (One of ['ibmq-v2018', 'ibmq-v2019', 'rigetti', 'native']) – Calibration data format, defaults to ibmq-v2019. TODO: It seems this has been changed, what version are we actually on?
qubits (list) – Qubit labels to include in the model
- Return type:
- create_processor_spec(gate_names=None, qubit_subset=None, subset_only=False, remove_edges=None)#
Create a QubitProcessorSpec from user-specified gates and device connectivity.
- Parameters:
gate_names (list of str) – List of one-qubit and two-qubit gate names. If None, use the keys of self.gate_mapping.
qubit_subset (list) – A subset of qubits to include in the processor spec. If None, use self.qubits.
subset_only (bool) – Whether or not to include all the device qubits in the processor spec (False, default) or just qubit_subset (True).
remove_edges (list) – A list of edges to drop from the connectivity graph.
- Return type:
The created QubitProcessorSpec
- classmethod from_legacy_device(devname)#
Create a ExperimentalDevice from a legacy pyGSTi pygsti.extras.devices module.
- Parameters:
devname (str) – Name of the pygsti.extras.devices module to use
- Return type:
Initialized ExperimentalDevice
- classmethod from_qiskit_backend(backend, gate_mapping=None)#
Construct a ExperimentalDevice from Qiskit provider backend information.
- Provider backends can be obtained via:
IBMQ.load_account() provider = IBMQ.get_provider() # with potential optional kwargs backend = provider.get_backend(<device name>)
- Parameters:
backend (IBMQBackend) – Backend obtained from IBMQ
gate_mapping (dict, optional) – Mapping between pyGSTi gate names (keys) and IBM native gates (values). If None, simply use {‘Gcnot’: ‘cx’} to recover legacy behavior.
- Return type:
Initialized ExperimentalDevice