def phase_space(q_list_x, q_list_y):
    wx = []
    wy = []
    sx = []
    sy = []
    for i in range(len(q_list_x)):
        qx = pykat.BeamParam(q=q_list_x[i])
        qy = pykat.BeamParam(q=q_list_y[i])

        #cuvature in microdipoters
        sx.append(-(1 / qx.curvature()) * 1e6)
        sy.append(-(1 / qy.curvature()) * 1e6)

        #curvature in mm
        wx.append(1e3 * qx.beamsize())
        wy.append(1e3 * qy.beamsize())

    return wx, wy, sx, sy
def get_sqz_mode_BS(kat,q_in_x,q_iny):
    
    #Turn the sqz_q from simulation into a pykat object to easily calc parameters
    q_sqz_x_new = pykat.BeamParam(q=q_in_x)
    q_sqz_y_new = pykat.BeamParam(q=q_iny)
    
    q_sqz_in = "gauss cavSQZ sqz nsqz " +  str(q_sqz_x_new.w0) + " " + str(-q_sqz_x_new.z) +\
    " " + str(q_sqz_y_new.w0) + " " + str(-q_sqz_y_new.z)
        
    #copy kat code of the simulation
    kat_sqz = kat.deepcopy()
    kat_sqz.parseCommands(q_sqz_in)

    #### Get the sqz mode at the beamsplitter by turning off all the cavities so all the nodes refer to the sqzer
    for cav in kat_sqz.getAll(pykat.commands.cavity):
        cav.enabled = False
    
    out_get = kat_sqz.run(getTraceData = True)
    q_sqz_BS_x = out_get[1][0]['nPRBS'][0]._BeamParam__q
    q_sqz_BS_y = out_get[1][0]['nPRBS'][1]._BeamParam__q

    return q_sqz_BS_x, q_sqz_BS_y
# easy test to make sure beam tracing is tracking the gouy phase accumulation
# and shape along a path correctly. Here I just expand and lens a beam back again
# Gouy phase should be about 360 deg in total.
from __future__ import print_function

import numpy as np
import pykat

kat = pykat.finesse.kat()
kat.parse("""
l l1 1 0 n0
s s1 1000 n0 n1
bs m1 1 0 0 0 n1 n2 dump dump
s s2 1000 n2 n3
bs m2 1 0 0 0 n3 n4 dump dump
s s3 2000 n4 n5
""")

bp = pykat.BeamParam(w0=1e-5, z=-1000)

T = kat.beamTrace(bp, "n0", "n5")

kat.m2.Rc = T.data['m2']['qin'].Rc

T = kat.beamTrace(bp, "n0", "n5")

assert (np.allclose(359.99993233082711, T.data['s3']['gouy']))
assert (np.allclose(999.9999999999994 + 0.00029526246744265j,
                    T.data['s3']['qout'].q))
示例#4
0
import pykat

from pykat.optics.knm import plot_knm_matrix, knmHG, makeCouplingMatrix
from pykat.optics.maps import surfacemap

q1 = pykat.BeamParam(w0=5e-2, z=0)
q2 = pykat.BeamParam(w0=5e-2, z=0)

R = max(q1.w, q2.w)

N = 500
dx = R * 6 / N

m = surfacemap("empty",
               "phase both",
               size=(N, N),
               center=((N + 1) / 2, (N + 1) / 2),
               step_size=(dx, dx))

C = makeCouplingMatrix(2)
K = knmHG(C, q1, q2, surface_map=m)

plot_knm_matrix(C, abs(K))

C = [0, 0, 0, 0]  # 00 -> 00
K = knmHG(C, q1, q2, surface_map=m)

print(K)

C = [[0, 0, 1, 0], [0, 0, 0, 0]]  # [00->10, 00->00]
K = knmHG(C, q1, q2, surface_map=m)