0
$\begingroup$

I know that BackendConfiguration has the method from_dict(dict) but I don't know how to use it. Can someone give an example?

$\endgroup$

1 Answer 1

2
$\begingroup$

To be honest the BackendConfiguration class is not the most ergonomic to use, and it really is just a mapping of the IBM Quantum API response to a Python object (it was explicitly this in the early releases of Qiskit, but was made independent a long time ago) when querying for a backend's configuration. This is why the class isn't used in BackendV2 having been replaced by backend attributes and the Target class. This is more vendor agnostic and easier to work with. You can see details of this here: https://qiskit.org/documentation/apidoc/providers.html#backendv1-backendv2 for details of the difference.

As for how to use the BackendConfiguration.from_dict() constructor method, it's basically designed to take in the JSON parsed output from the IBM quantum api response payload. However, the best example of doing it manually is honestly the old version of the aqt provider (since on main it's already moved to BackendV2 to avoid this). See:

https://github.com/Qiskit-Partners/qiskit-aqt-provider/blob/0.4.2/qiskit_aqt_provider/aqt_backend.py#L35-L57

which on line 59 is passed to BackendConfiguration.from_dict(). That shows you how to create a minimal BackendConfiguration object from an input dictionary.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.