lda = 852e-9
    x0 = 3 * win
    N = 2**10
    x = np.linspace(-x0, x0, N)
    E = efields.HG_efield(n=0,
                          x=x,
                          w=win,
                          amplitude=1.0,
                          x0=0.0,
                          normalize=True,
                          lda=lda)

    r_optic = 2.5e-2
    orders, coeffs = [(4, 0)], [0.5]
    phase_map = zernike.zernike_combination(orders,
                                            coeffs,
                                            x / r_optic,
                                            phi=0.0)

    R1, R2 = 0.98, 0.98
    T = 1 - R1

    base = np.sqrt(R1 * R2) * np.exp(1j * phase_map)

    def power(phase):
        u = x[len(x) // 2:]
        v = E.E[len(x) // 2:]
        b = base[len(x) // 2:]
        return np.trapz(x=u,
                        y=(2 * np.pi * u *
                           abs(v * np.sqrt(T) /
                               (1 - b * np.exp(1j * phase)))**2))
Ejemplo n.º 2
0
# E_ref = FD_efield(
#     x=x, R0=5e-3, b=16, amplitude=1.0, x0=0,
#     normalize_power=True, lda=lda, radial=handler.radial,
# )
E_ref.E /= np.sqrt(E_ref.P)

# E_ref.propagate(-100)
# logging.info('k s0 = {:.2f} '.format(2*np.pi/lda * lda*f/(np.pi * win) / np.sqrt(2)))
"""Adding aberrations
"""
r_optic = 2.5e-2

orders = [(4, 0)]
coeffs = [2 * np.pi * 0.02]
phase_map = zernike.zernike_combination(orders,
                                        np.array(coeffs),
                                        x / r_optic,
                                        phi=0.0)

# phase_map = generate_map(N, 0.04) * 2 * np.pi * 0.1
# cavity.insert(2, PhaseMask(-phase_map))

# plt.figure()
# plt.plot(x / win, phase_map / (2 * np.pi))
"""Computation
"""
N_rt = int(2 * cavity.finess)

handler.calculate_fields(E_ref, N=N_rt)
handler.plot_fields()
phases_lock = handler.compute_resonances(n_res=1)
phases, spectrum = handler.spectrum()
    return power(total_field)


# *** start of the main program ***
x = np.linspace(-a, a, N)
y = np.linspace(-a, a, N)
X, Y = np.meshgrid(x, y)
freqsx = nf.fftfreq(N, x[1] - x[0])
freqsy = nf.fftfreq(N, y[1] - y[0])
Freqs = np.meshgrid(freqsx, freqsy)

orders = config['orders']
coeffs = config['coeffs']
r_optic = 22.5e-3
phi = np.arctan2(X, Y)
aberration_map = zernike_combination(orders, coeffs,
                                     np.sqrt(X**2 + Y**2) / r_optic, phi)

delta = config['delta']
d1 = f  # distance between big mirror and lens
d2 = f + delta  # distance between lens and small mirror


def MIGA_cavity_fun(d1, d2, f, R, TL, FD):
    lens_wf = 2 * np.pi / lda * f * (1 + 0.5 * (X**2 / f**2 + Y**2 / f**2))
    lens_factor = np.exp(1j * lens_wf)
    aberr_factor = np.exp(1j * 2 * np.pi * aberration_map)

    def cavity_fun(in_field):
        w0 = w  # waist on the big mirror
        zR = np.pi * w0**2 / lda
        w1 = w0 * np.sqrt(1 + (d1 / zR)**2)  # waist on the lens