Commit 0df7fbba authored by Daniel Brown's avatar Daniel Brown
Browse files

Set gouy phase function for laser

parent e7206936
......@@ -100,11 +100,13 @@ class Laser(Connector, FrequencyGenerator):
laser_carrier_fill_rhs,
laser_fill_signal,
LaserWorkspace,
laser_set_gouy
)
ws = LaserWorkspace(self, sim, True)
ws.node_car_id = sim.carrier.node_id(self.p1.o)
ws.fsrc_car_idx = -1
ws.set_gouy_function(laser_set_gouy)
# Carrier just fills RHS
ws.carrier.set_fill_rhs_fn(laser_carrier_fill_rhs)
......
......@@ -5,7 +5,7 @@ from finesse.cymath.complex cimport conj, cexp
from finesse.simulations.base cimport ModelData
from finesse.frequency cimport frequency_info_t
from finesse.simulations.basematrix cimport CarrierSignalMatrixSimulation
from finesse.components.workspace cimport ConnectorWorkspace, FillFuncWrapper
from finesse.components.workspace cimport ConnectorWorkspace, FillFuncWrapper, GouyFuncWrapper
from finesse.element cimport BaseCValues
import numpy as np
......@@ -57,4 +57,3 @@ cdef class LaserWorkspace(ConnectorWorkspace):
cdef object c_laser_carrier_fill_rhs(ConnectorWorkspace cws)
cdef void set_tem_gouy_phases(LaserWorkspace ws)
......@@ -134,11 +134,11 @@ cdef object c_laser_fill_signal(ConnectorWorkspace cws):
phs_sig = 1j * 0.5
(<SubCCSView>conns.SIGPHS_P1o[0][f.index]).fill_za_zm_2(factor * phs_sig, car, 1, 1)
laser_set_gouy = GouyFuncWrapper.make_from_ptr(set_tem_gouy_phases)
@cython.boundscheck(False)
@cython.wraparound(False)
@cython.initializedcheck(False)
cdef void set_tem_gouy_phases(LaserWorkspace ws):
cdef int set_tem_gouy_phases(ConnectorWorkspace ws) except -1:
cdef:
NodeBeamParam q_p1o = ws.sim.trace[ws.P1o_id]
......@@ -151,7 +151,7 @@ cdef void set_tem_gouy_phases(LaserWorkspace ws):
int n, m
if not q_p1o.is_changing:
return
return 0
gouy_x = gouy(q_p1o.qx)
gouy_y = gouy(q_p1o.qy)
......@@ -165,3 +165,5 @@ cdef void set_tem_gouy_phases(LaserWorkspace ws):
phase = (n + 0.5) * gouy_x + (m + 0.5) * gouy_y
ws.power_coeffs[i] = crotate(ws.power_coeffs[i], phase - phase00)
return 0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment