Closed nonhermitian closed 3 years ago
FYI, there are a couple of other easy ways to do this today, using the readout_error
method in the BackendProperties
class.
Using range and len
props = backend.properties()
readout_errors = [props.readout_error(i) for i in range(len(props.qubits))]
readout_errors
Using enumerate
props = backend.properties()
readout_errors = [props.readout_error(i) for i, qubit in enumerate(props.qubits)]
readout_errors
But I agree that this can be simplified as proposed in this issue.
That is true because someone does the for-loop behind the scenes for you.
BTW, qiskit_ibm
uses the BackendProperties
class from terra.
Is terra the right place to fix this then? @mtreinish @jyu00
As someone who had to parse through the properties file, I agree it can use some improvement. But as @rathishcholarajan pointed out, the structure of the backend properties is defined by BackendProperties
in qiskit-terra
. So instead of making any extra convenience methods IBMQ only, I think it makes more sense for them to go into BackendProperties
.
My goal is for backend properties and backend configuration to disappear from the user facing backend api. It shouldn't have ever been a user facing class, it started as just an marshmallow object model of the iqx wire protocol for the properties data and the API is basically a 1:1 mapping with the json format. I've proposed dropping it from BackendV2
(which is still wip here: https://github.com/Qiskit/qiskit-terra/pull/5885 ) although for backwards compat you'll probably need to keep it around for a while in qiskit-ibm.
@mtreinish it's nice to decouple the user interface from the backend api!
@nonhermitian I think we can close this issue since it makes more sense to add/make the user interface changes you want in BackendV2
?
Yeah I am good with that.
What is the expected enhancement?
Currently the backend properties are a nightmare to parse through. Basically one has to go through nested lists of items to find what one is looking for. For example, finding the
readout_error
on all the qubits requires:This is not an ideal way to do things.
The interface should be changed so that it is easier to extract the data needed. For example it is easy to recast the above to look something like:
where
qubit
here is an object representing the qubit (As opposed to a list):with items accessible in a logic manner, e.g.
Because this is a new package we have the opportunity to do things better this time around.