Skip to content

Commit

Permalink
Merge pull request #63 from Qiskit-Partners/qiskit_direct_fix
Browse files Browse the repository at this point in the history
Allow for running via old Qobj path for Qiskit Direct
  • Loading branch information
nonhermitian authored Sep 30, 2021
2 parents f14e10b + 16c15c3 commit e1ba9de
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions mthree/mitigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
import scipy.linalg as la
import scipy.sparse.linalg as spla
import orjson
from qiskit import QuantumCircuit, transpile
from qiskit import QuantumCircuit, transpile, execute
from qiskit.providers import BaseBackend

from mthree.matrix import _reduced_cal_matrix, sdd_check
from mthree.utils import counts_to_vector, vector_to_quasiprobs
Expand Down Expand Up @@ -275,13 +276,11 @@ def _grab_additional_cals(self, qubits, shots=8192, method='balanced', rep_delay
circs = _marg_meas_states(num_cal_qubits, initial_reset=initial_reset)
trans_qcs = transpile(circs, self.system,
initial_layout=qubits, optimization_level=0)
job = self.system.run(trans_qcs, shots=self.cal_shots, rep_delay=self.rep_delay)
elif method == 'balanced':
cal_strings = _balanced_cal_strings(num_cal_qubits)
circs = _balanced_cal_circuits(cal_strings, initial_reset=initial_reset)
trans_qcs = transpile(circs, self.system,
initial_layout=qubits, optimization_level=0)
job = self.system.run(trans_qcs, shots=self.cal_shots, rep_delay=self.rep_delay)
# Indeopendent
else:
circs = []
Expand All @@ -290,6 +289,12 @@ def _grab_additional_cals(self, qubits, shots=8192, method='balanced', rep_delay
initial_reset=initial_reset))

trans_qcs = transpile(circs, self.system, optimization_level=0)

# This BaseBackend check is here for Qiskit direct access. Should be removed later.
if isinstance(self.system, BaseBackend):
job = execute(trans_qcs, self.system, optimization_level=0,
shots=self.cal_shots, rep_delay=self.rep_delay)
else:
job = self.system.run(trans_qcs, shots=self.cal_shots, rep_delay=self.rep_delay)
counts = job.result().get_counts()

Expand Down

0 comments on commit e1ba9de

Please sign in to comment.