Hi,
I’d like to measure SPAM for 4 modes on realistic simulator. So I constructed the following circuit and run it on sim:ancella. The correct biststring 1010 shows up only for 3.5% of shots - is this expected for 500 shots for the real HW as well?
More in depth analysis suggests measurements error is correlated.
This is dual-rail encoding of 2 qubits.
I’d miss 1 qubit state w/ prob=0.5, the same for the 2nd qubit.
So for statistically independent readout errors I should miss both qubits with prob=0.5^2=0.25.
Yet I see only 3.5% of correct output - can you please explain what do I miss?
Attached is minimal code
Thanks
Jan
nq=2
circuit= pcvl.Circuit(2*nq)
remProc = pcvl.RemoteProcessor("sim:ascella")
remProc.set_circuit(circuit)
for iq in range(2*nq):
remProc.add(iq,pcvl.PS(np.pi+iq/5.))
remProc.min_detected_photons_filter(1)
remProc.with_input(pcvl.BasicState("|1,0,1,0>"))
nsamples = 500
sampler = Sampler(remProc, max_shots_per_call=nsamples)
job = sampler.sample_count.execute_async(nsamples)
results = job.get_results()
print(results['results'])
In the realistic simulators, we add the noise of the source of the actual QPU to the simulation if it is not specified by the user.
In your case, the two most probable states come from the imperfect brightness of the source. If you want to remove them, you have two options:
You increase the min_detected_photons_filter to 2, so the 1-photon states will go into the physical perf.
You add a PostSelect object to ensure that you end up with a qubit state remProc.set_postselection(PostSelect("[0, 1] == 1 & [2, 3] == 1")). The PostSelect here means “exactly one photon on modes 0 and 1, and exactly 1 photon on modes 2 and 3”. The incorrect states then go into the logical perf.
Hi Aubaert,
I want to use the noisy simulator.
After you pointed out to look at my logical perf, I see it is 0.117.
This means the number of shots I issued was 500/0.117=4300, not 500.
Then probabilities I actually measured are
|0,0,1,0>: 243/4300=0.058
|1,0,0,0>: 240/4300=0.058
|1,0,1,0>: 17/4300=0.0034 which is close enough to 0.058^2
Now I’m at peace with probabilities.
Can you tell me what should I add to my code below to do heralding on initial state to be 1010 , before my BS.H() gate is applied ?
I would like to not see shots where intial state differed from ‘1010’ and I’d like to see all results with at least 1 detected photon at the end.
Thanks
remProc = pcvl.RemoteProcessor("sim:ascella")
remProc.set_circuit(pcvl.Circuit(2*nq))
for iq in range(2*nq):
remProc.add(iq,pcvl.PS(np.pi+iq/5.))
remProc.add((0,2),pcvl.BS.H())
remProc.min_detected_photons_filter(1)
I’m not sure to fully understand what you want to do. If I understand well, you practically want a perfect source. You can do it by setting an empty NoiseModel to the remote Processor
You won’t get information about performances, but you will only get the ‘1010’ state at input.
Also, I’m not sure what you want to do, but the phase shifters that you add at the beginning of your circuit won’t change anything in the resulting probabilities (they only do something once the state is in superposition).
Hi Aurélien,
I read more your documentation and realize now the double real qubit encoding differres a lot from transmon’s encoding. I have some homework to do. Let close this ticket.
thanks for your help
Jan