# This FINESSE scripts models the testbedAI Mach-Zehnder using Python-API script # For older kat style syntax, see mach_zehnder_kat_style.py # To execute from Matlab, see execute_finesse.m # <+ # | # | # | # | # | # | BS2 # M2 +-------+--------x # +------------------+ | | xxx| # | xxx| | | xx | # | xxx | | | xxx | CCD n1 # | +-------+------------------------------------------------+-------+--------+---------------------> # | x| | | xxx| | # | xxx | | | xxxx | | # | xxxx | | |xx-----+--------+ # xxxx-------+-------+ | # | | # | | # | testbedAI - Mach-Zehnder | # | | # Collimated Laser Beam | | # | | # BM1 | | # L1-----------------\ +------+-------xx +----+--------x # / | | xxx| | | xx # / | xxx | | | x | # / | |xxx | | | xx | # \-------------+------+--------+--------------------------------------------------+----+---- | # BM2 | xxx | | xxx | # xxxx | | xxxx | # x---------------+ |xx-----------+ # BS1 M1 # import finesse finesse.configure(plotting=False) import numpy as np import scipy.io from finesse import Model import finesse.components as fc import finesse.detectors as fd import finesse.analysis.actions as fa beam_propagation_flag = 0 beam_trace_flag = 0 beam_mismatch_flag = 0 # Rayleigh Range laser_zr = (3.1416*1*0.001**2)/1.064e-06; # Rayleigh range #10 ############################################# ## DEFINE OPTICAL MODEL model = Model() # laser L1 = model.add(fc.Laser("L1", P=1)) q = finesse.BeamParam(zr=laser_zr, z=0) model.L1.p1.o.q = q # 0.000 + 10.000j model.modes(maxtem=19) # first beams steering mirror BM1 = model.add(fc.Beamsplitter("BM1", R=1, T=0, L=0 ,phi=0 ,alpha=30,xbeta=-2.226e-05, ybeta=2.653e-05)) # second beams steering mirror BM2 = model.add(fc.Beamsplitter("BM2", R=1, T=0, L=0 ,phi=0 ,alpha=30,xbeta=-5.292e-05, ybeta=-7.77e-06)) # first beamsplitter BS1 = model.add(fc.Beamsplitter("BS1", R=0.5, T=0.5, L=0 ,phi=0 ,alpha=45,xbeta=3.08e-06, ybeta=3.556e-05)) # first Mirror (M1) M1 = model.add(fc.Beamsplitter("M1", R=1 ,T=0 ,L=0 ,phi=0, alpha=45 , xbeta=-4.2e-06, ybeta=-0.00016128)) # second beamsplitter BS2 BS2 = model.add(fc.Beamsplitter("BS2" ,R=0.5 ,T=0.5, L=0 ,phi=0 ,alpha=45 , xbeta=9.331e-05, ybeta=-5.95e-06)) # second Mirror (M2) M2 = model.add(fc.Beamsplitter("M2", R=1 ,T=0, L=0 ,phi=0 ,alpha=45 , xbeta=2.114e-05, ybeta=0.00017283)) # Add a 'nothing' component at the location of the CCD detector #nothing n1 n1 = model.add(fc.Nothing("n1")) # connect components model.connect(L1.p1, BM1.p1,L=0.3) model.connect(BM1.p2, BM2.p1,L=10) model.connect(BM2.p2, BS1.p1,L=0.2286) model.connect(BS1.p3,M1.p1,L=0.4318) model.connect(BS1.p2,M2.p1,L=0.254) model.connect(M1.p2, BS2.p1,L=0.254) model.connect(M2.p2, BS2.p4,L=0.4318) model.connect(model.BS2.p2,model.n1.p1, L=0.2413) # Also put a full 2-D CCD at the same position model.add(fd.camera.CCD("ccd2",node=n1.p1.i,xlim=[-15,15] ,ylim=[-15,15], npts=200, w0_scaled=True)) ############################################# # RUN out = model.run() # IN case of using actions # example syntax #out = model.run(fa.Series(fa.Xaxis(name="FAX1",...),fa.Xaxis(name="FAX2",...)) ############################################# ## BEAM ANALYSIS ############################################# # BEAM_TRACING # REF: https://finesse.ifosim.org/docs/latest/usage/homs/propagating_beams.html # some issue while specifying one of the two possible beam paths #BS1_M1_BS2 = model.path(BS1.p1,M1.p1,BS2.p1) # ps = model.propagate_beam(from_node = L1.p1, to_node = n1.p1, path = BS1_M1_BS2) # propagate beam if beam_propagation_flag == 1: ps = model.propagate_beam(from_node = L1.p1, to_node = n1.p1) print(ps) # get beam_trace if beam_trace_flag==1: print(model.beam_trace()) # Get mismatches table if beam_mismatch_flag==1: print(model.mismatches_table()) ############################################# ## PLOTTING ############################################# # plot CCD OUT #out.plot() ############################################# ## SAVING ############################################# # save CCD output for use in Matlab sim_out = out.data scipy.io.savemat('temporary_finesse_output.mat', {'CCD_out':sim_out}) '