def properties( self, refresh: bool = False, datetime: Optional[python_datetime] = None ) -> Optional[BackendProperties]: """Return the online backend properties with optional filtering. Args: refresh: if True, the return is via a QX API call. Otherwise, a cached version is returned. datetime: by specifying a datetime, this function returns an instance of the BackendProperties whose timestamp is closest to, but older than, the specified datetime. Returns: The properties of the backend. If the backend has no properties to display, it returns ``None``. """ # pylint: disable=arguments-differ if datetime: # Do not use cache for specific datetime properties. api_properties = self._api.backend_properties(self.name(), datetime=datetime) if not api_properties: return None return BackendProperties.from_dict(api_properties) if refresh or self._properties is None: api_properties = self._api.backend_properties(self.name()) self._properties = BackendProperties.from_dict(api_properties) return self._properties
def qubit_props_list_from_props( properties: BackendProperties, ) -> List[IBMQubitProperties]: """Uses BackendProperties to construct and return a list of IBMQubitProperties. """ qubit_props: List[IBMQubitProperties] = [] for qubit, _ in enumerate(properties.qubits): t_1 = properties.t1(qubit) * 1e-6 # microseconds to seconds t_2 = properties.t2(qubit) * 1e-6 # microseconds to seconds frequency = properties.frequency(qubit) * 1e9 # GHz to Hz try: anharmonicity = ( properties.qubit_property(qubit, "anharmonicity")[0] * 1e9 ) # GHz to Hz except Exception: # pylint: disable=broad-except anharmonicity = None qubit_props.append( IBMQubitProperties( # type: ignore[no-untyped-call] t1=t_1, t2=t_2, frequency=frequency, anharmonicity=anharmonicity, ) ) return qubit_props
def properties( self, refresh: bool = False, datetime: Optional[python_datetime] = None ) -> Optional[BackendProperties]: """Return the backend properties, subject to optional filtering. Args: refresh: If ``True``, re-query the server for the backend properties. Otherwise, return a cached version. datetime: By specifying `datetime`, this function returns an instance of the :class:`BackendProperties<qiskit.providers.models.BackendProperties>` whose timestamp is closest to, but older than, the specified `datetime`. Returns: The backend properties or ``None`` if the backend properties are not currently available. """ # pylint: disable=arguments-differ if datetime: # Do not use cache for specific datetime properties. api_properties = self._api.backend_properties(self.name(), datetime=datetime) if not api_properties: return None return BackendProperties.from_dict(api_properties) if refresh or self._properties is None: api_properties = self._api.backend_properties(self.name()) self._properties = BackendProperties.from_dict(api_properties) return self._properties
def test_bad_readout(self): """Test that the mapper avoids bad readout unit""" calib_time = datetime(year=2019, month=2, day=1, hour=0, minute=0, second=0) qr = QuantumRegister(2, name="q") circuit = QuantumCircuit(qr) circuit.cx(qr[0], qr[1]) dag = circuit_to_dag(circuit) qubit_list = [] ro_errors = [0.01, 0.01, 0.8] for ro_error in ro_errors: qubit_list.append(make_qubit_with_error(ro_error)) p01 = [Nduv(date=calib_time, name="gate_error", unit="", value=0.1)] g01 = Gate(name="CX0_1", gate="cx", parameters=p01, qubits=[0, 1]) p12 = [Nduv(date=calib_time, name="gate_error", unit="", value=0.1)] g12 = Gate(name="CX1_2", gate="cx", parameters=p12, qubits=[1, 2]) gate_list = [g01, g12] bprop = BackendProperties( last_update_date=calib_time, backend_name="test_backend", qubits=qubit_list, backend_version="1.0.0", gates=gate_list, general=[], ) nalayout = NoiseAdaptiveLayout(bprop) nalayout.run(dag) initial_layout = nalayout.property_set["layout"] self.assertNotEqual(initial_layout[qr[0]], 2) self.assertNotEqual(initial_layout[qr[1]], 2)
def test_create_program_graphs(): calib_time = datetime(year=2019, month=2, day=1, hour=0, minute=0, second=0, tzinfo=timezone.utc) qubit_list = [] ro_errors = [0.01, 0.01, 0.01] for ro_error in ro_errors: qubit_list.append(make_qubit_with_error(ro_error)) p01 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.9)] g01 = Gate(name="CX0_1", gate="cx", parameters=p01, qubits=[0, 1]) p12 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.1)] g12 = Gate(name="CX1_2", gate="cx", parameters=p12, qubits=[1, 2]) gate_list = [g01, g12] bprop = BackendProperties(last_update_date=calib_time, backend_name="test_backend", qubits=qubit_list, backend_version="1.0.0", gates=gate_list, general=[]) circ_list = [random_circuit(2, 10, measure=True), random_circuit( 4, 10, measure=True), random_circuit(3, 10, measure=True), random_circuit(5, 10, measure=True)] dag_list = [circuit_to_dag(circ) for circ in circ_list] caml = CrosstalkAdaptiveMultiLayout(bprop) num_q = caml._create_program_graphs(dag_list) print(num_q) heights = [] for dag in caml.dag_list: height = dag.num_qubits() heights.append(height) print(heights)
def properties(self): """Return backend properties""" dummy_date = datetime.datetime.now().isoformat() properties = { 'backend_name': self.name(), 'backend_version': self.configuration().backend_version, 'last_update_date': dummy_date, 'qubits': [[{ 'name': 'DUMMY', 'date': dummy_date, 'unit': 'ms', 'value': 0 }]], 'gates': [{ 'qubits': [0], 'gate': 'DUMMY', 'parameters': [{ 'name': 'DUMMY', 'date': dummy_date, 'unit': 'ms', 'value': 0 }] }], 'general': [] } return BackendProperties.from_dict(properties)
def properties(self): """Returns a snapshot of device properties as recorded on 8/30/19.""" dirname = os.path.dirname(__file__) filename = "props_tokyo.json" with open(os.path.join(dirname, filename)) as f_prop: props = json.load(f_prop) return BackendProperties.from_dict(props)
def properties(self): """Returns a snapshot of device properties""" dirname = os.path.dirname(__file__) filename = "props_poughkeepsie.json" with open(os.path.join(dirname, filename)) as f_prop: props = json.load(f_prop) return BackendProperties.from_dict(props)
def test_on_linear_topology(self): """ Test that the mapper identifies the correct gate in a linear topology """ calib_time = datetime(year=2019, month=2, day=1, hour=0, minute=0, second=0) qr = QuantumRegister(2, name='q') circuit = QuantumCircuit(qr) circuit.cx(qr[0], qr[1]) dag = circuit_to_dag(circuit) qubit_list = [] ro_errors = [0.01, 0.01, 0.01] for ro_error in ro_errors: qubit_list.append(make_qubit_with_error(ro_error)) p01 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.9)] g01 = Gate(name="CX0_1", gate="cx", parameters=p01, qubits=[0, 1]) p12 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.1)] g12 = Gate(name="CX1_2", gate="cx", parameters=p12, qubits=[1, 2]) gate_list = [g01, g12] bprop = BackendProperties(last_update_date=calib_time, backend_name="test_backend", qubits=qubit_list, backend_version="1.0.0", gates=gate_list, general=[]) nalayout = NoiseAdaptiveLayout(bprop) nalayout.run(dag) initial_layout = nalayout.property_set['layout'] self.assertNotEqual(initial_layout[qr[0]], 0) self.assertNotEqual(initial_layout[qr[1]], 0)
def properties(self): """Return backend properties""" properties = { 'backend_name': self.name(), 'backend_version': self.configuration().backend_version, 'last_update_date': '2000-01-01 00:00:00Z', 'qubits': [[{ 'name': 'TODO', 'date': '2000-01-01 00:00:00Z', 'unit': 'TODO', 'value': 0 }]], 'gates': [{ 'qubits': [0], 'gate': 'TODO', 'parameters': [{ 'name': 'TODO', 'date': '2000-01-01 00:00:00Z', 'unit': 'TODO', 'value': 0 }] }], 'general': [] } return BackendProperties.from_dict(properties)
def _build_props(self) -> BackendProperties: """Build properties for backend.""" qubits = [] gates = [] for (qubit_t1, qubit_t2, freq, read_err) in zip(self.qubit_t1, self.qubit_t2, self.qubit_frequency, self.qubit_readout_error): qubits.append([ Nduv(date=self.now, name="T1", unit="µs", value=qubit_t1), Nduv(date=self.now, name="T2", unit="µs", value=qubit_t2), Nduv(date=self.now, name="frequency", unit="GHz", value=freq), Nduv(date=self.now, name="readout_error", unit="", value=read_err), ]) for gate in self.basis_gates: parameters = [ Nduv(date=self.now, name="gate_error", unit="", value=0.01), Nduv(date=self.now, name="gate_length", unit="ns", value=4 * self.dt), ] if gate in self.single_qubit_gates: for i in range(self.n_qubits): gates.append( Gate( gate=gate, name=f"{gate}_{i}", qubits=[i], parameters=parameters, )) elif gate == "cx": for (qubit1, qubit2) in list( itertools.combinations(range(self.n_qubits), 2)): gates.append( Gate( gate=gate, name=f"{gate}{qubit1}_{qubit2}", qubits=[qubit1, qubit2], parameters=parameters, )) else: raise QiskitError( "{gate} is not supported by fake backend builder." "".format(gate=gate)) return BackendProperties( backend_name=self.name, backend_version=self.version, last_update_date=self.now, qubits=qubits, gates=gates, general=[], )
def properties(self): """Return backend properties""" coupling_map = self.configuration().coupling_map unique_qubits = list(set().union(*coupling_map)) properties = { 'backend_name': self.name(), 'backend_version': self.configuration().backend_version, 'last_update_date': '2000-01-01 00:00:00Z', 'qubits': [ [ { "date": "2000-01-01 00:00:00Z", "name": "T1", "unit": "\u00b5s", "value": 0.0 }, { "date": "2000-01-01 00:00:00Z", "name": "T2", "unit": "\u00b5s", "value": 0.0 }, { "date": "2000-01-01 00:00:00Z", "name": "frequency", "unit": "GHz", "value": 0.0 }, { "date": "2000-01-01 00:00:00Z", "name": "readout_error", "unit": "", "value": 0.0 } ] for _ in range(len(unique_qubits)) ], 'gates': [{ "gate": "cx", "name": "CX" + str(pair[0]) + "_" + str(pair[1]), "parameters": [ { "date": "2000-01-01 00:00:00Z", "name": "gate_error", "unit": "", "value": 0.0 } ], "qubits": [ pair[0], pair[1] ] } for pair in coupling_map], 'general': [] } return BackendProperties.from_dict(properties)
def properties(self): """Returns a snapshot of device properties""" if not self._properties: dirname = os.path.dirname(__file__) filename = "props_montreal.json" with open(os.path.join(dirname, filename), "r") as f_prop: props = json.load(f_prop) self._properties = BackendProperties.from_dict(props) return self._properties
def properties(self): """Returns a snapshot of device properties as recorded on 8/30/19. Sets the qubit 1 as non-operational. """ props = super().properties().to_dict() props['qubits'][1].append({"date": "2000-01-01 00:00:00Z", "name": "operational", "unit": "", "value": 0}) return BackendProperties.from_dict(props)
def properties(self): """Returns a snapshot of device properties as recorded on 10/24/19. """ if not self._properties: dirname = os.path.dirname(__file__) filename = "props_cambridge.json" with open(os.path.join(dirname, filename), "r") as f_prop: props = json.load(f_prop) self._properties = BackendProperties.from_dict(props) return self._properties
def properties(self): """Return the backend properties for this job. Returns: BackendProperties: the backend properties used for this job. """ self._wait_for_submission() properties = self._api.job_properties(job_id=self.job_id()) return BackendProperties.from_dict(properties)
def properties( self, refresh: bool = False, datetime: Optional[python_datetime] = None ) -> Optional[BackendProperties]: """Return the backend properties, subject to optional filtering. This data describes qubits properties (such as T1 and T2), gates properties (such as gate length and error), and other general properties of the backend. The schema for backend properties can be found in `Qiskit/ibm-quantum-schemas <https://github.com/Qiskit/ibm-quantum-schemas/blob/main/schemas/backend_properties_schema.json>`_. Args: refresh: If ``True``, re-query the server for the backend properties. Otherwise, return a cached version. datetime: By specifying `datetime`, this function returns an instance of the :class:`BackendProperties<qiskit.providers.models.BackendProperties>` whose timestamp is closest to, but older than, the specified `datetime`. Returns: The backend properties or ``None`` if the backend properties are not currently available. Raises: TypeError: If an input argument is not of the correct type. """ # pylint: disable=arguments-differ if not isinstance(refresh, bool): raise TypeError("The 'refresh' argument needs to be a boolean. " "{} is of type {}".format(refresh, type(refresh))) if datetime and not isinstance(datetime, python_datetime): raise TypeError("'{}' is not of type 'datetime'.") if datetime: warnings.warn( 'Unless a UTC timezone information is present, the parameter `datetime`' 'is now expected to be in local time instead of UTC.', stacklevel=2) datetime = local_to_utc(datetime) if datetime or refresh or self._properties is None: api_properties = self._api_client.backend_properties( self.name(), datetime=datetime) if not api_properties: return None decode_backend_properties(api_properties) api_properties = utc_to_local_all(api_properties) backend_properties = BackendProperties.from_dict(api_properties) if datetime: # Don't cache result. return backend_properties self._properties = backend_properties return self._properties
def create_fake_machine(): """Create a 6 qubit machine to test crosstalk adaptive schedules""" calib_time = datetime(year=2019, month=2, day=1, hour=0, minute=0, second=0) qubit_list = [] for _ in range(6): qubit_list.append(make_noisy_qubit()) cx01 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.05), Nduv(date=calib_time, name='gate_length', unit='ns', value=500.0)] cx12 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.05), Nduv(date=calib_time, name='gate_length', unit='ns', value=501.0)] cx23 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.05), Nduv(date=calib_time, name='gate_length', unit='ns', value=502.0)] cx34 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.05), Nduv(date=calib_time, name='gate_length', unit='ns', value=503.0)] cx45 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.05), Nduv(date=calib_time, name='gate_length', unit='ns', value=504.0)] gcx01 = Gate(name="CX0_1", gate="cx", parameters=cx01, qubits=[0, 1]) gcx12 = Gate(name="CX1_2", gate="cx", parameters=cx12, qubits=[1, 2]) gcx23 = Gate(name="CX2_3", gate="cx", parameters=cx23, qubits=[2, 3]) gcx34 = Gate(name="CX3_4", gate="cx", parameters=cx34, qubits=[3, 4]) gcx45 = Gate(name="CX4_5", gate="cx", parameters=cx45, qubits=[4, 5]) u_1 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.001), Nduv(date=calib_time, name='gate_length', unit='ns', value=100.0)] gu10 = Gate(name="u1_0", gate="u1", parameters=u_1, qubits=[0]) gu11 = Gate(name="u1_1", gate="u1", parameters=u_1, qubits=[1]) gu12 = Gate(name="u1_2", gate="u1", parameters=u_1, qubits=[2]) gu13 = Gate(name="u1_3", gate="u1", parameters=u_1, qubits=[3]) gu14 = Gate(name="u1_4", gate="u1", parameters=u_1, qubits=[4]) gu15 = Gate(name="u1_4", gate="u1", parameters=u_1, qubits=[5]) u_2 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.001), Nduv(date=calib_time, name='gate_length', unit='ns', value=100.0)] gu20 = Gate(name="u2_0", gate="u2", parameters=u_2, qubits=[0]) gu21 = Gate(name="u2_1", gate="u2", parameters=u_2, qubits=[1]) gu22 = Gate(name="u2_2", gate="u2", parameters=u_2, qubits=[2]) gu23 = Gate(name="u2_3", gate="u2", parameters=u_2, qubits=[3]) gu24 = Gate(name="u2_4", gate="u2", parameters=u_2, qubits=[4]) gu25 = Gate(name="u2_4", gate="u2", parameters=u_2, qubits=[5]) u_3 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.001), Nduv(date=calib_time, name='gate_length', unit='ns', value=100.0)] gu30 = Gate(name="u3_0", gate="u3", parameters=u_3, qubits=[0]) gu31 = Gate(name="u3_1", gate="u3", parameters=u_3, qubits=[1]) gu32 = Gate(name="u3_2", gate="u3", parameters=u_3, qubits=[2]) gu33 = Gate(name="u3_3", gate="u3", parameters=u_3, qubits=[3]) gu34 = Gate(name="u3_4", gate="u3", parameters=u_3, qubits=[4]) gu35 = Gate(name="u3_5", gate="u3", parameters=u_3, qubits=[5]) gate_list = [gcx01, gcx12, gcx23, gcx34, gcx45, gu10, gu11, gu12, gu13, gu14, gu15, gu20, gu21, gu22, gu23, gu24, gu25, gu30, gu31, gu32, gu33, gu34, gu35] bprop = BackendProperties(last_update_date=calib_time, backend_name="test_backend", qubits=qubit_list, backend_version="1.0.0", gates=gate_list, general=[]) return bprop
def _build_props(self) -> BackendProperties: """Build properties for backend.""" qubits = [] gates = [] for (qubit_t1, qubit_t2, freq, read_err) in zip(self.qubit_t1, self.qubit_t2, self.qubit_frequency, self.qubit_readout_error): qubits.append([ Nduv(date=self.now, name='T1', unit='µs', value=qubit_t1), Nduv(date=self.now, name='T2', unit='µs', value=qubit_t2), Nduv(date=self.now, name='frequency', unit='GHz', value=freq), Nduv(date=self.now, name='readout_error', unit='', value=read_err) ]) for gate in self.basis_gates: parameters = [ Nduv(date=self.now, name='gate_error', unit='', value=0.01), Nduv(date=self.now, name='gate_length', unit='ns', value=4 * self.dt) ] if gate in self.single_qubit_gates: for i in range(self.n_qubits): gates.append( Gate(gate=gate, name="{0}_{1}".format(gate, i), qubits=[i], parameters=parameters)) elif gate == 'cx': for (qubit1, qubit2) in list( itertools.combinations(range(self.n_qubits), 2)): gates.append( Gate(gate=gate, name="{gate}{q1}_{q2}".format(gate=gate, q1=qubit1, q2=qubit2), qubits=[qubit1, qubit2], parameters=parameters)) else: raise QiskitError( "{gate} is not supported by fake backend builder." "".format(gate=gate)) return BackendProperties(backend_name=self.name, backend_version=self.version, last_update_date=self.now, qubits=qubits, gates=gates, general=[])
def properties(self): """Return the online backend properties. The return is via QX API call. Returns: BackendProperties: The properties of the backend. """ api_properties = self._api.backend_properties(self.name()) return BackendProperties.from_dict(api_properties)
def properties(self): """Return backend properties""" properties = { 'backend_name': self.name(), 'backend_version': self.configuration().backend_version, 'last_update_date': '2000-01-01 00:00:00Z', 'qubits': [], 'gates': [], 'general': [] } return BackendProperties.from_dict(properties)
def properties(self): """Returns a snapshot of device properties as recorded on 8/30/19. Sets the gate CX(Q1, Q3) (and symmetric) as non-operational. """ props = super().properties().to_dict() for gate in props['gates']: if gate['gate'] == 'cx' and set(gate['qubits']) == {3, 1}: gate['parameters'].append({"date": "2000-01-01 00:00:00Z", "name": "operational", "unit": "", "value": 0}) return BackendProperties.from_dict(props)
def properties( self, refresh: bool = False, datetime: Optional[datetime] = None # pylint: disable=redefined-outer-name ) -> Optional[BackendProperties]: """Return the online backend properties with optional filtering. Args: refresh (bool): if True, the return is via a QX API call. Otherwise, a cached version is returned. datetime (datetime.datetime): by specifying a datetime, this function returns an instance of the BackendProperties whose timestamp is closest to, but older than, the specified datetime. Returns: BackendProperties: The properties of the backend. If the backend has no properties to display, it returns ``None``. """ # pylint: disable=arguments-differ if datetime: if not isinstance(self._api, BaseClient): warnings.warn('Retrieving the properties of a ' 'backend in a specific datetime is ' 'only available when using IBM Q v2') return None # Do not use cache for specific datetime properties. api_properties = self._api.backend_properties(self.name(), datetime=datetime) if not api_properties: return None return BackendProperties.from_dict(api_properties) if refresh or self._properties is None: api_properties = self._api.backend_properties(self.name()) self._properties = BackendProperties.from_dict(api_properties) return self._properties
def properties(self): """Returns a snapshot of device properties as recorded on 8/30/19. Sets the gate CX(Q1, Q3) as non-operational. """ props = super().properties().to_dict() for gate in props["gates"]: if gate["gate"] == "cx" and gate["qubits"] == [1, 3]: gate["parameters"].append({ "date": "2000-01-01 00:00:00Z", "name": "operational", "unit": "", "value": 0 }) return BackendProperties.from_dict(props)
def test_grid_layout(self): """ Test that the mapper identifies best location for a star-like program graph Machine row1: (0, 1, 2) Machine row2: (3, 4, 5) """ calib_time = datetime(year=2019, month=2, day=1, hour=0, minute=0, second=0) qr = QuantumRegister(4, name='q') circuit = QuantumCircuit(qr) circuit.cx(qr[0], qr[3]) circuit.cx(qr[1], qr[3]) circuit.cx(qr[2], qr[3]) dag = circuit_to_dag(circuit) qubit_list = [] ro_errors = [0.01] * 6 for ro_error in ro_errors: qubit_list.append(make_qubit_with_error(ro_error)) p01 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.3)] p03 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.3)] p12 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.3)] p14 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.1)] p34 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.1)] p45 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.1)] p25 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.3)] g01 = Gate(name="CX0_1", gate="cx", parameters=p01, qubits=[0, 1]) g03 = Gate(name="CX0_3", gate="cx", parameters=p03, qubits=[0, 3]) g12 = Gate(name="CX1_2", gate="cx", parameters=p12, qubits=[1, 2]) g14 = Gate(name="CX1_4", gate="cx", parameters=p14, qubits=[1, 4]) g34 = Gate(name="CX3_4", gate="cx", parameters=p34, qubits=[3, 4]) g45 = Gate(name="CX4_5", gate="cx", parameters=p45, qubits=[4, 5]) g25 = Gate(name="CX2_5", gate="cx", parameters=p25, qubits=[2, 5]) gate_list = [g01, g03, g12, g14, g34, g45, g25] bprop = BackendProperties(last_update_date=calib_time, backend_name="test_backend", qubits=qubit_list, backend_version="1.0.0", gates=gate_list, general=[]) nalayout = NoiseAdaptiveLayout(bprop) nalayout.run(dag) initial_layout = nalayout.property_set['layout'] for qid in range(4): for qloc in [0, 2]: self.assertNotEqual(initial_layout[qr[qid]], qloc)
def properties(self): """Return the online backend properties. The return is via QX API call. Returns: BackendProperties: The properties of the backend. If the backend is a simulator, it returns ``None``. """ if self.configuration().simulator: return None api_properties = self._api.backend_properties(self.name()) return BackendProperties.from_dict(api_properties)
def aws_general_to_properties( properties: DeviceCapabilities, configuration: QasmBackendConfiguration) -> BackendProperties: updated_time: datetime = properties.service.updatedAt or datetime.now() general: List[Nduv] = [] qubits: List[List[Nduv]] = [] gates: List[qiskit.providers.models.backendproperties.Gate] = [] backend_properties: BackendProperties = BackendProperties( backend_name=configuration.name, backend_version=configuration.arn, last_update_date=updated_time, qubits=qubits, gates=gates, general=general) return backend_properties
def properties(self, refresh=False): """Return the online backend properties. Args: refresh (bool): if True, the return is via a QX API call. Otherwise, a cached version is returned. Returns: BackendProperties: The properties of the backend. """ # pylint: disable=arguments-differ if refresh or self._properties is None: api_properties = self._api.backend_properties(self.name()) self._properties = BackendProperties.from_dict(api_properties) return self._properties
def properties(self) -> Optional[BackendProperties]: """Return the backend properties for this job. Returns: the backend properties used for this job, or None if properties are not available. Raises: IBMQJobApiError: if there was some unexpected failure in the server. """ with api_to_job_error(): properties = self._api.job_properties(job_id=self.job_id()) if not properties: return None return BackendProperties.from_dict(properties)
def properties(self) -> Optional[BackendProperties]: """Return the backend properties for this job. Returns: The backend properties used for this job, or ``None`` if properties are not available. Raises: IBMQJobApiError: If an unexpected error occurred when communicating with the server. """ with api_to_job_error(): properties = self._api.job_properties(job_id=self.job_id()) if not properties: return None return BackendProperties.from_dict(properties)