Does MeasureFock show entanglement of qumodes on X8?

I am trying to implement entangled modes and to measure them. I am interested in seeing the entanglement through the measurement results.

Here is the code I have so far.

from numpy import pi
import strawberryfields as sf
from strawberryfields import ops
import numpy as np
from strawberryfields import RemoteEngine

I4 = np.identity(4)

prog = sf.Program(8)
with prog.context as q:
    # Two-mode squeezing. Allowed values are r=1.0 (on) or r=0.0 (off)
    ops.S2gate(1.0) | (q[0], q[4])
    ops.S2gate(1.0) | (q[1], q[5])
    #****************************************  BSM
    ops.BSgate(0.543, 0.123) | (q[0], q[1])
    ops.BSgate(0.543, 0.123) | (q[4], q[5])
    # Equal interferometers on signal and idler modes
    ops.Interferometer(I4) | (q[0], q[1], q[2], q[3])
    ops.Interferometer(I4) | (q[4], q[5], q[6], q[7])
    ops.MeasureFock() | q


eng = RemoteEngine("X8")
results =, shots=Nshots)

I think (q[0] and q[1]) are entangled and (q[4] and q[4]) are entangled as well .

I have tried to plot the results to see if their final measurement show any form of correlation.

aa = list(zip(results.samples[:,0], results.samples[:,1]))
for i in range(len(results.samples[:,1])):
    L.append(str(aa[i][0])+ str(aa[i][1]))

import matplotlib.pyplot as plt
plt.hist(L) #gives you a histogram of your array 'a' #
print('\n (q[0] and q[1]) modes measurement results:\n')
print([[x,aa.count(x)] for x in set(aa)])

(q[0] and q[1]) modes measurement results follow. [[(4, 0), 5] means that 5 times q[0] detects 4 photons and q[1] detects none.

[[(4, 0), 5], [(3, 1), 4], [(0, 2), 29], [(0, 5), 2], [(2, 2), 2], [(1, 0), 153], [(1, 3), 1], [(3, 0), 19], [(3, 3), 1], [(5, 0), 4], [(0, 1), 139], [(2, 4), 1], [(1, 2), 10], [(2, 1), 13], [(3, 2), 1], [(4, 1), 1], [(0, 0), 496], [(1, 1), 48], [(0, 3), 10], [(2, 0), 61]]

I do not see the entanglement between them at all.

How to interpret the data to show the entanglement.

Compared to Qiskit, I can find out how many times they both end up in (00, 01, 10,11).

Hi @maldarwbi, welcome to the forum!

Our photonic hardware uses multi-mode states (also termed continuous variable or CV) whereas other approaches uses two-mode states (qubit model). In that sense, other strategies are needed to measure non-classicality and entanglement in the outcome of experimental measurements, i. e., the execution of your program.

To determine if your circuit has generated an entangled mode pair you need to compute the relevant statistics on the photon counts acquired. In this particular case, you can calculate the noise reduction factor or NRF which is a direct measure of the degree of entanglement between the two modes of interest. For classical states the NRF is greater or equal than 1 whereas a NRF lesser than one indicate non-classicality.

The section Analysis of the squeezer characterization tutorial thoroughly describes how to collect samples from the X8 machine and to determine if quantum light has been produced by calculating the NRF value.

A more detailed discussion and other results about the topic can be found in the paper Arrazola, J.M., Bergholm, V., Brádler, K. et al. Quantum circuits with many photons on a programmable nanophotonic chip. Nature 591, 54–60 (2021).