Skip to content

Commit

Permalink
try/except
Browse files Browse the repository at this point in the history
  • Loading branch information
SamFerracin committed Aug 12, 2024
1 parent 59e5b71 commit 8485406
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions qiskit_ibm_runtime/utils/noise_learner_result_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@ def decode( # type: ignore # pylint: disable=arguments-differ

data = []
for layer in decoded["data"]:
error = PauliLindbladError(layer[1]["generators"], layer[1]["rates"])
datum = LayerError(layer[0]["circuit"], layer[0]["qubits"], error)
data.append(datum)

if isinstance(layer, LayerError):
data.append(layer)
else:
# supports the legacy result format
error = PauliLindbladError(layer[1]["generators"], layer[1]["rates"])
datum = LayerError(layer[0]["circuit"], layer[0]["qubits"], error)
data.append(datum)

return NoiseLearnerResult(data=data, metadata=decoded["metadata"])

0 comments on commit 8485406

Please sign in to comment.