def optMI(opt_name): opt = pyt.Optickle(eng, opt_name, vRF) opt.addMirror('EX', Thr=0) opt.addMirror('EY', Thr=0) opt.addMirror('IX', Thr=Ti) opt.addMirror('IY', Thr=Ti) opt.addBeamSplitter('BS', aoi=45, Thr=0.5) opt.addSource('Laser', np.sqrt(Pin) * (vRF == 0)) opt.addRFmodulator('Mod', fmod, gmod * 1j) opt.addLink('Laser', 'out', 'Mod', 'in', 0) opt.addLink('Mod', 'out', 'BS', 'frA', 1) opt.addLink('BS', 'bkA', 'IX', 'bk', lx) opt.addLink('IX', 'fr', 'EX', 'fr', Lcav) opt.addLink('EX', 'fr', 'IX', 'fr', Lcav) opt.addLink('IX', 'bk', 'BS', 'bkB', lx) opt.addLink('BS', 'frA', 'IY', 'bk', ly) opt.addLink('IY', 'fr', 'EY', 'fr', Lcav) opt.addLink('EY', 'fr', 'IY', 'fr', Lcav) opt.addLink('IY', 'bk', 'BS', 'frB', ly) opt.addSink('AS') opt.addLink('BS', 'bkB', 'AS', 'in', 1) opt.addReadout('AS', fmod, 0) return opt
def optFP(opt_name): opt = pyt.Optickle(eng, opt_name, vRF) opt.addMirror('IX', Thr=Ti) opt.addMirror('EX', Thr=0) opt.addLink('IX', 'fr', 'EX', 'fr', Lcav) opt.addLink('EX', 'fr', 'IX', 'fr', Lcav) opt.setCavityBasis('EX', 'IX') for optic in ['IX', 'EX']: opt.setMechTF(optic, [], [0, 0], 1) opt.addSource('Laser', np.sqrt(Pin)*(vRF == 0)) opt.addModulator('AM', 1) opt.addModulator('PM', 1j) opt.addRFmodulator('Mod', fmod, gmod*1j) opt.addLink('Laser', 'out', 'AM', 'in', 0) opt.addLink('AM', 'out', 'PM', 'in', 0) opt.addLink('PM', 'out', 'Mod', 'in', 0) opt.addLink('Mod', 'out', 'IX', 'bk', 0) opt.addSink('REFL') opt.addLink('IX', 'bk', 'REFL', 'in', 0) opt.addReadout('REFL', fmod, 0) return opt
def optFPMI(eng, opt_name, sqAng, sqdB, rf=True): if rf: vRF = np.array([-fmod, 0, fmod]) else: vRF = 0 opt = pyt.Optickle(eng, opt_name, vRF=vRF) opt.addMirror('EX') opt.addMirror('EY') opt.addMirror('IX', Thr=Ti) opt.addMirror('IY', Thr=Ti) opt.addBeamSplitter('BS') for optic in ['EX', 'EY', 'IX', 'IY']: opt.setMechTF(optic, [], poles, 1 / M) Tpo = 1 - 1 / Pin opt.addMirror('LO_PO', Thr=Tpo) opt.addSource('Laser', np.sqrt(Pin) * (vRF == 0)) if rf: opt.addRFmodulator('Mod', fmod, gmod * 1j) opt.addLink('Laser', 'out', 'Mod', 'in', 0) opt.addLink('Mod', 'out', 'LO_PO', 'fr', 0) else: opt.addLink('Laser', 'out', 'LO_PO', 'fr', 0) opt.addLink('LO_PO', 'bk', 'BS', 'frA', 0) opt.addLink('BS', 'bkA', 'IX', 'bk', lx) opt.addLink('IX', 'fr', 'EX', 'fr', Larm) opt.addLink('EX', 'fr', 'IX', 'fr', Larm) opt.addLink('IX', 'bk', 'BS', 'bkB', lx) opt.addLink('BS', 'frA', 'IY', 'bk', ly) opt.addLink('IY', 'fr', 'EY', 'fr', Larm) opt.addLink('EY', 'fr', 'IY', 'fr', Larm) opt.addLink('IY', 'bk', 'BS', 'frB', ly) opt.addMirror('AS_PO', aoi=45, Thr=0.5) opt.addLink('BS', 'bkB', 'AS_PO', 'fr', 0) if rf: opt.addSink('AS') opt.addLink('AS_PO', 'fr', 'AS', 'in', 0) opt.addReadout('AS', fmod, 0) opt.addSqueezer('Sqz', sqAng=sqAng, sqdB=sqdB) opt.addLink('Sqz', 'out', 'BS', 'bkA', 0) return opt
def optFP(eng, opt_name, par): """Make an Optickle Fabry Perot cavity Inputs: eng: the matlab engine opt_name: name of the optickle model par: parameter dictionary Returns: opt: the model """ fmod = par['Mod']['fmod'] gmod = par['Mod']['gmod'] vRF = np.array([-fmod, 0, fmod]) opt = pyt.Optickle(eng, opt_name, vRF=vRF, lambda0=par['lambda0']) # Make the cavity # In this case it's very simple, but in more complicated models you can # easily loop through all of the optics if you've defined the parameters # in a dictionary mirrors = ['EX', 'IX'] for mirror in mirrors: # add the mirror and set the optic properties opt.addMirror(mirror, **par[mirror]['opt']) # set the mechanical response pmech = par[mirror]['mech'] poles = np.array( resRoots(2 * np.pi * pmech['f0'], pmech['Q'], Hz=False)) opt.setMechTF(mirror, [], poles, 1 / pmech['mass']) opt.addLink('IX', 'fr', 'EX', 'fr', par['Lcav']) opt.addLink('EX', 'fr', 'IX', 'fr', par['Lcav']) opt.setCavityBasis('IX', 'EX') # add input opt.addSource('Laser', np.sqrt(par['Pin']) * (vRF == 0)) opt.addRFmodulator('Mod', fmod, 1j * gmod) opt.addLink('Laser', 'out', 'Mod', 'in', 0) opt.addLink('Mod', 'out', 'IX', 'bk', 0) # add DC and RF photodiodes opt.addSink('REFL') opt.addLink('IX', 'bk', 'REFL', 'in', 0) opt.addReadout('REFL', fmod, 0) return opt
def optFPMI(eng, opt_name, par): """Make an Optickle FPMI Inputs: eng: the matlab engine opt_name: name of the optickle model par: parameter dictionary Returns: opt: the model """ fmod = par['Mod']['fmod'] gmod = par['Mod']['gmod'] vRF = np.array([-fmod, 0, fmod]) opt = pyt.Optickle(eng, opt_name, vRF=vRF, lambda0=par['lambda0']) # Add optics and set mechanical plants mirrors = ['EX', 'IX', 'EY', 'IY'] splitters = ['BS'] for mirror in mirrors: opt.addMirror(mirror, **par[mirror]['opt']) for splitter in splitters: opt.addBeamSplitter(splitter, **par[splitter]['opt']) for optic in mirrors + splitters: pmech = par[optic]['mech'] opt.setMechTF(optic, pmech['zs'], pmech['ps'], pmech['k']) # Add input opt.addSource('Laser', np.sqrt(par['Pin'])*(vRF == 0)) opt.addRFmodulator('Mod', fmod, 1j*gmod) opt.addLink('Laser', 'out', 'Mod', 'in', 0) opt.addLink('Mod', 'out', 'BS', 'frA', 1) # Add links plen = par['Length'] # X arm opt.addLink('BS', 'bkA', 'IX', 'bk', plen['lx']) opt.addLink('IX', 'fr', 'EX', 'fr', plen['Lx']) opt.addLink('EX', 'fr', 'IX', 'fr', plen['Lx']) opt.addLink('IX', 'bk', 'BS', 'bkB', plen['lx']) # Y arm opt.addLink('BS', 'frA', 'IY', 'bk', plen['ly']) opt.addLink('IY', 'fr', 'EY', 'fr', plen['Ly']) opt.addLink('EY', 'fr', 'IY', 'fr', plen['Ly']) opt.addLink('IY', 'bk', 'BS', 'frB', plen['ly']) # Add output probes opt.addSink('REFL') opt.addSink('AS') opt.addLink('BS', 'frB', 'REFL', 'in', 1) opt.addLink('BS', 'bkB', 'AS', 'in', 1) # demod phases chosen to maximize CARM in REFL_I and DARM in AS_Q opt.addReadout('REFL', fmod, -11) opt.addReadout('AS', fmod, -11) return opt
def opt40m(eng, opt, par, phi=0, zeta=0, Pin=1): """Create a 40m Optickle model. Inputs: eng: matlab engine par: parameters of the model phi: one-way SRC detuning [deg] zeta: homodyne angle [deg] Pin: input power incident on the back of PRM [W] Two probes AS_DIFF and AS_SUM measure the homodyne difference and sum signals at the AS port respectively. All angles use BnC conventions: phi = 0 deg is ESR phi = 90 deg is ERSE zeta = 0 deg is the phase quadrature (.i.e. b2) zeta = 90 deg is the amplitude quadrature (i.e. b1) """ opt = pyt.Optickle(eng, opt) ########################################################################## # Add optics. ########################################################################## splitters = ['BS', 'PR2', 'PR3', 'SR2', 'SR3'] mirrors = ['IX', 'IY', 'EX', 'EY', 'PRM', 'SRM'] for splitter in splitters: p = par[splitter] opt.addBeamSplitter(splitter, p['aoi'], p['Chr'], p['Thr'], p['Lhr'], p['Rar'], p['Lmd']) opt.setPosOffset(splitter, p['pos']) for mirror in mirrors: p = par[mirror] opt.addMirror(mirror, p['aoi'], p['Chr'], p['Thr'], p['Lhr'], p['Rar'], p['Lmd']) opt.setPosOffset(mirror, p['pos']) # Set SRM detuning. opt.setPosOffset('SRM', -phi * par['lambda'] / 360) ########################################################################## # Mechanical. ########################################################################## # Set transfer functions. dampRes = np.array([-0.1 + 1j, -0.1 - 1j]) poles = par['w'] * dampRes # optics = ['EX', 'EY', 'IX', 'IY'] optics = mirrors + splitters for optic in optics: opt.setMechTF(optic, [], poles, 1 / par[optic]['mass']) opt.setMechTF(optic, [], poles, 1 / par[optic]['mass'], 'pitch') opt.setMechTF(optic, [], poles, 1 / par[optic]['mass'], 'yaw') ########################################################################## # Input. ########################################################################## # Main laser. opt.addSource('Laser', np.sqrt(Pin)) # Modulators for amplitude and phase noise. opt.addModulator('AM', 1) opt.addModulator('PM', 1j) ########################################################################## # Add links. ########################################################################## # Input. opt.addLink('Laser', 'out', 'AM', 'in', 0) opt.addLink('AM', 'out', 'PM', 'in', 0) opt.addLink('PM', 'out', 'PRM', 'bk', 0) # PRC. opt.addLink('PRM', 'fr', 'PR2', 'frA', par['Length']['PR1']) opt.addLink('PR2', 'frA', 'PR3', 'frA', par['Length']['PR2']) opt.addLink('PR3', 'frA', 'BS', 'frA', par['Length']['PR3']) opt.addLink('BS', 'frB', 'PR3', 'frB', par['Length']['PR3']) opt.addLink('PR3', 'frB', 'PR2', 'frB', par['Length']['PR2']) opt.addLink('PR2', 'frB', 'PRM', 'fr', par['Length']['PR1']) # X arm. opt.addLink('BS', 'frA', 'IX', 'bk', par['Length']['BS_X']) opt.addLink('IX', 'fr', 'EX', 'fr', par['Length']['Xarm']) opt.addLink('EX', 'fr', 'IX', 'fr', par['Length']['Xarm']) opt.addLink('IX', 'bk', 'BS', 'frB', par['Length']['BS_X']) # Y arm. opt.addLink('BS', 'bkA', 'IY', 'bk', par['Length']['BS_Y']) opt.addLink('IY', 'fr', 'EY', 'fr', par['Length']['Yarm']) opt.addLink('EY', 'fr', 'IY', 'fr', par['Length']['Yarm']) opt.addLink('IY', 'bk', 'BS', 'bkB', par['Length']['BS_Y']) # Output and SRC. opt.addLink('BS', 'bkB', 'SR3', 'frB', par['Length']['SR3']) opt.addLink('SR3', 'frB', 'SR2', 'frB', par['Length']['SR2']) opt.addLink('SR2', 'frB', 'SRM', 'fr', par['Length']['SR1']) opt.addLink('SRM', 'fr', 'SR2', 'frA', par['Length']['SR1']) opt.addLink('SR2', 'frA', 'SR3', 'frA', par['Length']['SR2']) opt.addLink('SR3', 'frA', 'BS', 'bkA', par['Length']['SR3']) opt.setCavityBasis('IX', 'EX') opt.setCavityBasis('IY', 'EY') ########################################################################## # Add Readout. ########################################################################## opt.addHomodyneReadout('AS', zeta, par['qe'], LOpower=0) # Pick off LO from PR2 opt.addLink('PR2', 'bkA', 'AS_LOphase', 'fr', 0) # set homodyne phase homoPhase = ((zeta + phi) / 2 + 45) * par['lambda'] / 360 opt.setPosOffset('AS_LOphase', homoPhase) # Connect signal to homodyne detector opt.addLink('SRM', 'bk', 'AS_BS', 'fr', 0) return opt
""" import matlab.engine import numpy as np import qlance.optickle as pyt import qlance.controls as ctrl import close import pytest data = np.load('data/optickle_lsc_data.npz', allow_pickle=True) eng = matlab.engine.start_matlab() pyt.addOpticklePath(eng) eng.eval("addpath(genpath('data'));", nargout=0) opt = pyt.Optickle(eng, 'opt') eng.eval("par = struct;", nargout=0) eng.eval("par = paramCE1;", nargout=0) eng.eval("par.PR.Thr = 0.01;", nargout=0) eng.eval("opt = optCE_homo(par, 1);", nargout=0) eng.eval("probesCE_homo(opt, par, 1);", nargout=0) opt.loadMatModel() ff = np.logspace(np.log10(3), np.log10(7e3), 300) opt.run(ff) DARM = {'EX': 1, 'EY': -1} MICH = {'BS': 1, 'SR': 1 / np.sqrt(2), 'PR': -1 / np.sqrt(2)} filtDARM = ctrl.Filter(ctrl.catzp(-2 * np.pi * 20, -2 * np.pi * 800), ctrl.catzp(0, 0, -2 * np.pi * 300 * (1 + 1j / 2),
def optSagnac(eng, opt, sqzAng=0, sqdB=0, antidB=0): """Create a Sagnac Optickle model Inputs: eng: matlab engine opt: name of the optickle model sqzAng: squeeze angle [deg] sqzdB: squeezing amplitude in dB antidB: anti-squeezing in dB Returns: opt: the optickle model """ lambda0 = 1064e-9 Pin = 100 gamma = 0.1 PBSleakS = 0.01 PBSleakP = 0.01 # Tpbs = [[PBSleakS, lambda0, 1], # [1 - PBSleakP, lambda0, 0]] Tbs = 0.5 Tin = 0.01 Tend = 10e-6 lCav = 4e3 fmod = 20e6 vRF = np.array([-fmod, 0, fmod]) vRF = np.concatenate((vRF, vRF)) pol = np.array(['S'] * 3 + ['P'] * 3) opt = pyt.Optickle(eng, opt, vRF, lambda0, pol) ###################################################################### # Add components ###################################################################### # Add laser with all power in the P carrier inds = np.logical_and(opt.vRF == 0, opt.pol == 'P') opt.addSource('Laser', inds * np.sqrt(Pin)) # Modulators opt.addModulator('AM', 1) opt.addModulator('PM', 1j) opt.addRFmodulator('Mod1', fmod, gamma * 1j) opt.addBeamSplitter('BS', aoi=45, Thr=Tbs) opt.addPBS('PBS', aoi=45, transS=PBSleakS, reflP=PBSleakP, BS=True) opt.addWaveplate('WPX_A', 0.25, 45) opt.addWaveplate('WPX_B', 0.25, -45) opt.addWaveplate('WPY_A', 0.25, 45) opt.addWaveplate('WPY_B', 0.25, -45) opt.addMirror('IX', Thr=Tin) opt.addMirror('EX', Chr=0.7 / lCav, Thr=Tend) opt.addMirror('IY', Thr=Tin) opt.addMirror('EY', Chr=0.7 / lCav, Thr=Tend) ###################################################################### # Add links ###################################################################### # input opt.addLink('Laser', 'out', 'AM', 'in', 0) opt.addLink('AM', 'out', 'PM', 'in', 0) opt.addLink('PM', 'out', 'Mod1', 'in', 0) opt.addLink('Mod1', 'out', 'BS', 'frA', 0) # beam splitters - links going forward (A sides) opt.addLink('BS', 'frA', 'PBS', 'bkA', 0) opt.addLink('BS', 'bkA', 'PBS', 'bkB', 0) opt.addLink('PBS', 'frA', 'WPX_A', 'in', 0) opt.addLink('PBS', 'frB', 'WPY_A', 'in', 0) opt.addLink('WPY_A', 'out', 'IY', 'bk', 0) opt.addLink('WPX_A', 'out', 'IX', 'bk', 0) # X-arm opt.addLink('IX', 'fr', 'EX', 'fr', lCav) opt.addLink('EX', 'fr', 'IX', 'fr', lCav) # Y-arm opt.addLink('IY', 'fr', 'EY', 'fr', lCav) opt.addLink('EY', 'fr', 'IY', 'fr', lCav) # beam splitters - links going backward (B sides) opt.addLink('IY', 'bk', 'WPY_B', 'in', 0) opt.addLink('IX', 'bk', 'WPX_B', 'in', 0) opt.addLink('WPX_B', 'out', 'PBS', 'frB', 0) opt.addLink('WPY_B', 'out', 'PBS', 'frA', 0) opt.addLink('PBS', 'bkB', 'BS', 'frB', 0) opt.addLink('PBS', 'bkA', 'BS', 'bkB', 0) ###################################################################### # Mechanical ###################################################################### w = 2 * np.pi * 0.7 mI = 40 mE = 40 w_pit = 2 * np.pi * 0.5 rTM = 0.17 tTM = 0.2 iTM = (3 * rTM**2 + tTM**2) / 12 iI = mE * iTM iE = mE * iTM dampRes = np.array([0.01 + 1j, 0.01 - 1j]) opt.setMechTF('IX', [], -w * dampRes, 1 / mI) opt.setMechTF('EX', [], -w * dampRes, 1 / mE) opt.setMechTF('IY', [], -w_pit * dampRes, 1 / iI, 'pitch') opt.setMechTF('EY', [], -w_pit * dampRes, 1 / iE, 'pitch') ###################################################################### # Squeezer ###################################################################### if sqdB > 0: opt.addSqueezer('Sqz', pol='P', sqAng=sqzAng, sqdB=sqdB, antidB=antidB) opt.addLink('Sqz', 'out', 'BS', 'bkA', 0) ###################################################################### # Probes ###################################################################### opt.addSink('REFL') opt.addLink('BS', 'frB', 'REFL', 'in', 0) phi = 0 opt.addReadout('REFL', fmod, phi) opt.addHomodyneReadout('AS', 0, LOpower=1, pol='P') opt.addLink('BS', 'bkB', 'AS_BS', 'fr', 0) opt.setCavityBasis('IX', 'EX') return opt