Data analysis MZI

Data analysis MZI#

We analyze the following MZI samples from the edx course

MZI1: dL_wg=0

MZI2: r=5 dL_path = (208.40000 - 148.15000) * 2 dL_wg = dL_path + 2pir - 42r = 111.915

MZI3: r=5 dL_path = (259.55000-148.15000) * 2 dL_wg = dL_path + 2pir - 42r ; dL_wg = 214.215

MZI4: r1 = 435.90000-427.60000; r1 r2 = 10 dL_path = (259.55000-148.15000) * 2 dL_wg = dL_path + pi*(r1+r2) - 4*(r1+r2) ; dL_wg = 207.08945

MZI5: r1 = 556.35000-547.60000; r1 r2 = 10 dL_path = (259.55000-148.15000) * 2 dL_wg = dL_path + pi*(r1+r2) - 4*(r1+r2) ; dL_wg = 206.703125

MZI6: r=4 dL_path = (259.55000-148.15000) * 2 dL_wg = dL_path + 2pir - 42r ; dL_wg = 215.932

MZI8: r=3 dL_path = (259.55000-148.15000) * 2 dL_wg = dL_path + 2pir - 42r ; dL_wg = 217.649

MZI17: r=2 dL_path = (259.55000-148.15000) * 2 dL_wg = dL_path + 2pir - 42r ; dL_wg = 219.366

import matplotlib.pyplot as plt
import numpy as np

import ubcpdk
from ubcpdk.simulation.circuits.mzi_spectrum import mzi_spectrum
w, p = ubcpdk.data.read_mat(ubcpdk.PATH.mzi1, port=0)
plt.plot(w, p)
[<matplotlib.lines.Line2D at 0x7f9299544510>]
../_images/0894a27011b8407c07a3b8fa53c8f3950e51394842f26ac86f0c4aa13719be47.png

For some reason this MZI has an interference pattern. This is strange because the lengths of both arms are the same. This means that there was a strong height variation on the chip.

w, p = ubcpdk.data.read_mat(ubcpdk.PATH.mzi3, port=0)
plt.plot(w, p)
[<matplotlib.lines.Line2D at 0x7f92965653d0>]
../_images/7b2813de40bc07e8dd0ad0f8bd2747a301a06f958bc7ad987f029cd7de00418e.png
wr = np.linspace(1520, 1580, 1200) * 1e-3
pr = mzi_spectrum(L1_um=0, L2_um=214.215, wavelength_um=wr)
plt.plot(wr * 1e3, 10 * np.log10(pr))
[<matplotlib.lines.Line2D at 0x7f929616cf90>]
../_images/12e24496d347156812c4b64882711fba78c3143ea386886c0e3ecd80a3cad9e3.png
w, p = ubcpdk.data.read_mat(ubcpdk.PATH.mzi3, port=0)
pb = ubcpdk.data.remove_baseline(w, p)
plt.plot(w, pb)
[<matplotlib.lines.Line2D at 0x7f92961c0f90>]
../_images/aec6c55f4f83d14e9bca3efc419346ff4875098abfb754e81003c0eb1f6625aa.png
plt.plot(w, pb, label="measurement")
plt.plot(wr * 1e3, 10 * np.log10(pr), label="analytical")
plt.legend()
<matplotlib.legend.Legend at 0x7f9295d305d0>
../_images/0d8a5e128a21e21db39ea9beb08ed9ec9752188121093d7de781a64e19cd2c1c.png
ms.sweep_wavelength?
Object `ms.sweep_wavelength` not found.
from scipy.optimize import curve_fit

L1_um = 40
L2_um = L1_um + 215.932


def mzi_logscale(wavelength_um, alpha, n1, n2, n3):
    return 10 * np.log10(
        mzi_spectrum(
            L1_um=L1_um,
            L2_um=L2_um,
            wavelength_um=wavelength_um,
            alpha=alpha,
            n1=n1,
            n2=n2,
            n3=n3,
        )
    )


w, p = ubcpdk.data.read_mat(ubcpdk.PATH.mzi6, port=0)
wum = w * 1e-3
pb = ubcpdk.data.remove_baseline(w, p)

p0 = [1e-3, 2.4, -1, 0]
plt.plot(w, pb, label="data")
plt.plot(w, mzi_logscale(wum, *p0), label="initial condition")
plt.legend()
<matplotlib.legend.Legend at 0x7f9295db4490>
../_images/5a8c2278ba92049825278b5dc0b6fbdb0f402a74356e58fe8662b0459ff427cd.png
params, params_covariance = curve_fit(mzi_logscale, wum, pb, p0=[1e-3, 2.4, -1, 0])
params
array([ 0.00555726,  2.39711747, -1.01841085,  4.99322188])
plt.plot(w, pb, label="data")
plt.plot(w, mzi_logscale(wum, *params), label="fit")
plt.legend()
<matplotlib.legend.Legend at 0x7f92959405d0>
../_images/2a06a48449f2223ab3d244b414b8f9d0b7bdcc7bd3d5f447dbd3c16954cf482b.png
L1_um = 40
L2_um = L1_um + 215.932


def mzi(wavelength_um, alpha, n1, n2, n3):
    return mzi_spectrum(
        L1_um=L1_um,
        L2_um=L2_um,
        wavelength_um=wavelength_um,
        alpha=alpha,
        n1=n1,
        n2=n2,
        n3=n3,
    )


w, p = ubcpdk.data.read_mat(ubcpdk.PATH.mzi6, port=0)
wum = w * 1e-3
pb = ubcpdk.data.remove_baseline(w, p)
pb_linear = 10 ** (pb / 10)

p0 = [1e-3, 2.4, -1, 0]
plt.plot(w, pb_linear, label="data")
plt.plot(w, mzi(wum, *p0), label="initial condition")
plt.legend()
<matplotlib.legend.Legend at 0x7f92959e3410>
../_images/c3ac4099de7a701b8e45387c0cc976b989effa97789a06fcdedb17c9b9a0b618.png
params, params_covariance = curve_fit(mzi, wum, pb, p0=p0)
/tmp/ipykernel_405/2008316264.py:1: OptimizeWarning: Covariance of the parameters could not be estimated
  params, params_covariance = curve_fit(mzi, wum, pb, p0=p0)
plt.plot(w, pb_linear, label="data")
plt.plot(w, mzi(wum, *params), label="fit")
plt.legend()
<matplotlib.legend.Legend at 0x7f9290eb85d0>
../_images/a33df1f88091e6054ee9124d665d56c09416f7c292866fbcc45b177b2fbb3106.png