3
$\begingroup$

Here's the quantum circuit I'm constructing:

 qrz = QuantumRegister(2,'q')
 crz = ClassicalRegister(3,'c')
 qc = QuantumCircuit(qrz,crz)
 for i in range (3):
    qc.append(qc1(P,t[i],epsilon),[0,1]). # qc1 is some circuit segment.
    qc.measure(1,i)
    qc.barrier()
    qc = transpile(qc,backend=backend,optimization_level=2,initial_layout = [0,1])

It contains 3 mid-circuit measurements. I'm wondering if I could perform the readout error mitigation in this case. Here's what I'm trying to do:

import matplotlib.pyplot as plt
qlist = [1]    # Suppose we want to perform the mid-circuit measurement on this qubit.
cal_circuits, state_labels = complete_meas_cal(qubit_list= qlist,circlabel='mcal')
print(len(cal_circuits))
cal_job = execute(cal_circuits, 
                 backend = backend,
                 shots = 1024,
                  optimization_level = 0
                 )
cal_results = cal_job.result()
meas_fitter = CompleteMeasFitter(cal_results, state_labels)  # Generate the complete fitter. 
fig, ax = plt.subplots(figsize=(10, 10))
meas_fitter.plot_calibration(ax)
meas_filter = meas_fitter.filter

I'm wondering if there's a way I can apply the filter to the qubit that I measured 3 times. Thanks for the help:)

$\endgroup$
0
$\begingroup$

Yes! You would need 3 times the number of classical registers to store each measurement. Please see this.

simp_counts1 = marginal_counts(simp_job.result(), indices=[0]).get_counts()
simp_counts2 = marginal_counts(simp_job.result(), indices=[1]).get_counts()
simp_counts3 = marginal_counts(simp_job.result(), indices=[3]).get_counts()

The for each measurement use your filter, for example:

meas_filter = meas_fitter.filter
mitigated_results = meas_filter.apply(sim_counts1)
New contributor
Siddhartha Morales is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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