# Qiskit - How do we measure the same single qubit system multiple times while also getting the counts/results after each measurement?

I am able to apply multiple measurements (2) to the same qubit system. However, I would like to get the counts right after each measurement is executed. I realize that the counts should be the same after every measurement of the same system. I would just like to see empirical proof of the so-called "repeated measurement principle" without any evolution of the system. I attempted to write a program which would achieve this, but had no success:

import time
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister
from qiskit import execute, IBMQ, Aer
from qiskit.backends.ibmq import least_busy
from qiskit import compile as q_compile

counter = 0

def generate_circuits(num_q):
# Create a Quantum Register with 1 qubits.
q = QuantumRegister(num_q, 'q')
# Create a Classical Register with 1 bits.
c = ClassicalRegister(num_q, 'c')
# Create a Quantum Circuit
qc = QuantumCircuit(q, c)

if counter == 0:
# Add a H gate on qubit 0, putting this qubit in superposition.
qc.h(q[0])
# Add a Measure gate to see the state.
qc.measure(q, c)
qc.barrier(q)
return qc
else:
qc.measure(q, c)
return qc

backend = Aer.get_backend('qasm_simulator')

qc_gen = generate_circuits(1)

qobj = q_compile(qc_gen, backend, shots=1000)

job = backend.run(qobj)

result = job.result()

data = result.get_counts(qc_gen)

print(data)

counter += 1

qobj = q_compile(qc_gen, backend, shots=1000)

job = backend.run(qobj)

result = job.result()

data = result.get_counts(qc_gen)

print(data)


which returned:

{'0': 489, '1': 511}
{'0': 491, '1': 509}


Any ideas?

• Not got time to write a full answer at the moment, but the basic point to note is that each measurement result needs to go to a separate classical bit. So you need measure(q[0],c[j]) for the jth measurement of q[0]. Feb 8, 2019 at 16:10

The two quantum circuits generated and submitted to the IBMQ system by your code are the same. So ideally, the result should be both {'0':500,'1':500}, but since those circuits are run on an experimental platform, a little fluctuation is tolerable.