create_backend_from_properties¶
- create_backend_from_properties(properties, n_qubits=None, default_date=None)[source]¶
Create a populated GenericBackendV2 from a BackendProperties dictionary.
This function handles the complete workflow:
Normalizes the properties dictionary (fills in missing fields).
Infers the number of qubits from the properties if not provided.
Creates a GenericBackendV2 backend whose
targetreflects the supplied calibration values (T1/T2, frequency, gate errors, gate durations, readout errors).
The returned backend’s
targetis the source of truth for downstream qiskit consumers — the transpiler reads gate durations and errors from it, andqiskit_aer.noise.NoiseModel.from_backendderives device noise from the same target.- Parameters:
properties (
dict[str,Any]) – BackendProperties dictionary. Missing fields will be filled automatically.n_qubits (
int|None) – Optional number of qubits. If None, will be inferred from the length of the “qubits” list in the properties dictionary.default_date (
datetime|None) – Optional datetime to use for missing date fields. If None, uses current time.
- Return type:
- Returns:
GenericBackendV2 backend whose
targetcarries the supplied calibration values.- Raises:
ValueError – If n_qubits is not provided and cannot be inferred from properties (i.e., qubits list is empty or missing), or if n_qubits is less than 1.
Example
>>> props = { ... "backend_name": "test", ... "qubits": [[{"name": "T1", "value": 100.0}]], # 1 qubit ... "gates": [{"gate": "sx", "qubits": [0], "parameters": []}] ... } >>> # Infer qubit count from properties (will be 1) >>> backend = create_backend_from_properties(props) >>> backend.num_qubits 1 >>> # Override qubit count if needed >>> backend_large = create_backend_from_properties(props, n_qubits=120) >>> backend_large.num_qubits 120