diff --git a/examples/asc_test/master.py b/examples/asc_test/master.py index b12312ff42d35ef7ecad95866ecdbbd54f6f2a11..eed7854364da3bde46e000f63e1d84b60a41450d 100644 --- a/examples/asc_test/master.py +++ b/examples/asc_test/master.py @@ -33,6 +33,7 @@ def main(): """) # for debugging we might need to see the temporay file: + global kat kat = finesse.kat(tempdir=".",tempname="test") kat.verbose = False kat.loadKatFile('asc_base.kat') @@ -105,7 +106,7 @@ def pd_signal(tmpkat): """ kat.parseKatCode(code1) kat.noxaxis = True - #global out + global out out = kat.run() print(" Cavity power: {0:.6f}W".format(out.y[0,2])) return (out.y[0,0], out.y[0,1]) @@ -123,8 +124,7 @@ def pd_phase(tmpkat): # function for root finding def PD_q_test(x): - kat.PDrefl_q.phi1=x - + kat.PDrefl_q.phase1=x out = kat.run() print('\r root finding: function value %g ' % out.y, end=' ') sys.stdout.flush() @@ -132,6 +132,8 @@ def pd_phase(tmpkat): # do root finding xtol=1e-8 + + #print("Starting values for bisect are: %e and %e \n" % (PD_q_test(60.0),PD_q_test(100.0))) (result, info)=scipy.optimize.bisect(PD_q_test,80.0,100.0, xtol=xtol, maxiter=500, full_output=True) diff --git a/examples/asc_test/master2.py b/examples/asc_test/master2.py index 9f28f9eab7b2922090c4eaf2362edc923a9a09b7..413d7e33440cf630a4dcfb1ada13f3c437f314fc 100644 --- a/examples/asc_test/master2.py +++ b/examples/asc_test/master2.py @@ -101,10 +101,10 @@ def main(): kat.parseKatCode(code_WFS2) (WFS1_phase, WFS2_phase) = asc_phases(kat) - kat.WFS1_I.phi1=WFS1_phase - kat.WFS1_Q.phi1=WFS1_phase+90.0 - kat.WFS2_I.phi1=WFS2_phase - kat.WFS2_Q.phi1=WFS2_phase+90.0 + kat.WFS1_I.phase1=WFS1_phase + kat.WFS1_Q.phase1=WFS1_phase+90.0 + kat.WFS2_I.phase1=WFS2_phase + kat.WFS2_Q.phase1=WFS2_phase+90.0 result['WFS1_phase']=WFS1_phase result['WFS2_phase']=WFS2_phase @@ -183,7 +183,7 @@ def asc_phases(tmpkat): kat.maxtem=1 def demod_phase1(x): - kat.WFS1_I.phi1=x[0] + kat.WFS1_I.phase1=x[0] out = kat.run() signal = out["WFS1_I"] print('\r minimising: function value %g ' % signal, end=' ') @@ -191,7 +191,7 @@ def asc_phases(tmpkat): return -1*abs(signal) def demod_phase2(x): - kat.WFS2_I.phi1=x[0] + kat.WFS2_I.phase1=x[0] out = kat.run() signal = out["WFS2_I"] print('\r minimising: function value %g ' % signal, end=' ') diff --git a/examples/asc_test/master3.py b/examples/asc_test/master3.py index e17826854389be086d54e1c2d598df30cfe32d80..b1c3f699a291b1d76621da032399aef4ae6b01b9 100644 --- a/examples/asc_test/master3.py +++ b/examples/asc_test/master3.py @@ -97,7 +97,7 @@ def asc_large(tmpkat, mir_name): done_maxtems.append(tem) print(" Calculating maxtem = %d " % tem) kat.maxtem = tem - out[str(tem)] = kat.run(printout=0,printerr=1) + out[str(tem)] = kat.run() import os.path if os.path.isfile(tmpfilename): shutil.copyfile(tmpfilename, backupname) diff --git a/examples/asc_test/master4.py b/examples/asc_test/master4.py index 2db0e7644df93538cd31ef5b048e1eb8acf66ae3..71f2eefc28578340605a847865f7dfbc2dcabf93 100644 --- a/examples/asc_test/master4.py +++ b/examples/asc_test/master4.py @@ -190,7 +190,7 @@ def get_qs(tmpkat,f): # add thermal lens and propagate input beam to ITM kat = set_thermal_lens(kat, f) - out = kat.run(printout=0,printerr=0) + out = kat.run() # computing beam size at ITM # and then we reflect of ITM, an set it as new startnode @@ -207,7 +207,7 @@ def get_qs(tmpkat,f): else: kat.ITM.nITM1.node.setGauss(kat.ITM, beam1) kat.parseKatCode("startnode nITM1") - out = kat.run(printout=0,printerr=0) + out = kat.run() # computing beam size at WFS1 and WFS2 q2 = out['w2'] @@ -228,7 +228,7 @@ def get_qs(tmpkat,f): return [beam1, beam2, beam3, beam4] global out # run finesse with input laser mode matched to cavity (no thermal lens) - out = kat.run(printout=0,printerr=0) + out = kat.run() # beam at laser when matched to cold cavity # (note the sign flip of the real part to change direction of gauss param) @@ -256,13 +256,13 @@ def asc_signal(tmpkat): signal=np.zeros((2, 2)) kat.ITM.ybeta=1e-10 kat.ETM.ybeta=0.0 - out = kat.run(printout=0,printerr=0) + out = kat.run() signal[0,0] = out["WFS1_I"] signal[1,0] = out["WFS2_I"] kat.ITM.ybeta=0.0 kat.ETM.ybeta=-1e-10 - out = kat.run(printout=0,printerr=0) + out = kat.run() signal[0,1] = out["WFS1_I"] signal[1,1] = out["WFS2_I"] signal = signal *1e10 @@ -281,7 +281,7 @@ def gravity_tilt(tmpkat): def compute_gravity_tilt(tmpkat): kat = copy.deepcopy(tmpkat) - out = kat.run(printout=0,printerr=0) + out = kat.run() y1 = out["b1"] y2 = out["b1_1k"] diff --git a/examples/asc_test/master5.py b/examples/asc_test/master5.py index bb1e445658e8d931b90327469e207caa2d464930..fcab7cf0f691b68c9ea4f17deffe2f1d4dd1b34e 100644 --- a/examples/asc_test/master5.py +++ b/examples/asc_test/master5.py @@ -146,7 +146,7 @@ def get_qs(tmpkat): def beam_size(tmpkat, f): kat = copy.deepcopy(tmpkat) # 1. run finesse with input laser mode matched to cavity (no thermal lens) - out = kat.run(printout=0,printerr=0) + out = kat.run() # beam at laser when matched to cold cavity # (note the sign flip of the real part to change direction of gauss param) @@ -159,7 +159,7 @@ def get_qs(tmpkat): kat.ITM_TL.f=f if "ITM_TL_r" in kat._kat__components: kat.ITM_TL_r.f=f - out = kat.run(printout=0,printerr=0) + out = kat.run() # computing beam size at ITM # and then we reflect of ITM, an set it as new startnode @@ -176,7 +176,7 @@ def get_qs(tmpkat): else: kat.ITM.nITM1.node.setGauss(kat.ITM, beam1) kat.parseKatCode("startnode nITM1") - out = kat.run(printout=0,printerr=0) + out = kat.run() # computing beam size at WFS1 and WFS2 q2 = out['w2'] @@ -215,7 +215,7 @@ def asc_signal(tmpkat): signal=np.zeros((2, 2)) kat.ITM.ybeta=1e-10 kat.ETM.ybeta=0.0 - out = kat.run(printout=0,printerr=0) + out = kat.run() WFS1_idx=out.ylabels.index("WFS1_I") WFS2_idx=out.ylabels.index("WFS2_I") signal[0,0] = out.y[WFS1_idx] @@ -223,7 +223,7 @@ def asc_signal(tmpkat): kat.ITM.ybeta=0.0 kat.ETM.ybeta=-1e-10 - out = kat.run(printout=0,printerr=0) + out = kat.run() signal[0,1] = out.y[WFS1_idx] signal[1,1] = out.y[WFS2_idx] signal = signal *1e10 @@ -247,7 +247,7 @@ def asc_phases(tmpkat): def demod_phase1(x): kat.WFS1_I.phi[0]=x - out = kat.run(printout=0,printerr=0) + out = kat.run() WFS1_idx=out.ylabels.index("WFS1_I") signal = out.y[WFS1_idx] print('\r minimising: function value %g ' % signal, end=' ') @@ -256,7 +256,7 @@ def asc_phases(tmpkat): def demod_phase2(x): kat.WFS2_I.phi[0]=x - out = kat.run(printout=0,printerr=0) + out = kat.run() WFS2_idx=out.ylabels.index("WFS2_I") signal = out.y[WFS2_idx] print('\r minimising: function value %g ' % signal, end=' ') @@ -283,7 +283,7 @@ def gravity_tilt(tmpkat): def compute_gravity_tilt(tmpkat): kat = copy.deepcopy(tmpkat) - out = kat.run(printout=0,printerr=0) + out = kat.run() y1 = out["b1"] y2 = out["b1_1k"] @@ -364,7 +364,7 @@ def beam_size(tmpkat, beam2, beam3): kat.po.nWFS1.node.setGauss(kat.po,beam2) - out = kat.run(printout=0,printerr=0) + out = kat.run() WFS1_idx=out.ylabels.index("wWFS1") WFS2_idx=out.ylabels.index("wWFS2") @@ -380,7 +380,7 @@ def beam_size(tmpkat, beam2, beam3): if "ITM_TL_r" in kat._kat__components: kat.ITM_TL_r.f=5e3 kat.po.nWFS1.node.setGauss(kat.po,beam3) - out = kat.run(printout=0,printerr=0) + out = kat.run() y1 = out.y[WFS1_idx] y2 = out.y[WFS2_idx] print(" Beam size with thermal lens f={0}".format(kat.ITM_TL.f))