diff --git a/examples/asc_test/master.py b/examples/asc_test/master.py index c2e59c28f3e9f1e144ea30b72a3cab029e3ad4da..39825831f349fe695a02678031b8bba7c6e86505 100644 --- a/examples/asc_test/master.py +++ b/examples/asc_test/master.py @@ -117,7 +117,7 @@ def pd_phase(tmpkat): # function for root finding def PD_q_test(x): - kat.PDrefl_q.phase1=x + kat.PDrefl_q.phase1=float(x) out = kat.run() print('\r root finding: function value {0:<16g}'.format(float(out.y)), end='') sys.stdout.flush() @@ -180,7 +180,7 @@ def resonance(tmpkat): # function for root finding def carrier_resonance(x): - kat.ETM.phi=x + kat.ETM.phi=float(x) out = kat.run() phase = (out.y[0,0]-out.y[0,1]-90)%360-180.0 print('\r root finding: function value {0:<16g}'.format(float(phase)), end='') diff --git a/examples/asc_test/master2.py b/examples/asc_test/master2.py index f5215e70a6024b56f9a8885d42b75331d02bd6b2..3d5209e1ce1dc26f95802368f2e3b72536634b41 100644 --- a/examples/asc_test/master2.py +++ b/examples/asc_test/master2.py @@ -178,7 +178,7 @@ def asc_phases(tmpkat): kat.maxtem=1 def demod_phase1(x): - kat.WFS1_I.phase1=x[0] + kat.WFS1_I.phase1=float(x[0]) out = kat.run() signal = out["WFS1_I"] print('\r minimising: function value {0:<16g}'.format(float(signal)), end='') @@ -186,7 +186,7 @@ def asc_phases(tmpkat): return -1*abs(signal) def demod_phase2(x): - kat.WFS2_I.phase1=x[0] + kat.WFS2_I.phase1=float(x[0]) out = kat.run() signal = out["WFS2_I"] print('\r minimising: function value {0:<16g}'.format(float(signal)), end='') @@ -196,14 +196,14 @@ def asc_phases(tmpkat): kat.ITM.ybeta=1e-10 kat.ETM.ybeta=0.0 res = fmin(demod_phase1, [0.0], xtol=1e-8, disp=False) - WFS1_phase = res[0] + WFS1_phase = float(res[0]) print("") print(" WFS1 demod phase : %.10g deg" % WFS1_phase) kat.ITM.ybeta=0.0 kat.ETM.ybeta=-1e-10 res = fmin(demod_phase2, [0.0], xtol=1e-8, disp=False) - WFS2_phase = res[0] + WFS2_phase = float(res[0]) print("") print(" WFS2 demod phase : %.10g deg" % WFS2_phase) return(WFS1_phase, WFS2_phase) diff --git a/examples/asc_test/master4.py b/examples/asc_test/master4.py index 5d71e9141ccb0a1e6fd035fa7868acfd17751e38..314950513e80755b740070e514bf2d0557f41184 100644 --- a/examples/asc_test/master4.py +++ b/examples/asc_test/master4.py @@ -16,10 +16,10 @@ import copy import sys def set_thermal_lens(kat, f): - kat.ITM_TL.f=f + kat.ITM_TL.f=float(f) # if a bs-based cavity is used, we need to set second lens if "ITM_TL_r" in kat._kat__components: - kat.ITM_TL_r.f=f + kat.ITM_TL_r.f=float(f) return (kat) def main(): @@ -91,26 +91,24 @@ def main(): x1=0.70 x2=0.30 if "ITM_TL_r" in kat._kat__components: - beam50 = beam_param(z=(x1*beam1[1].z+x2*beam2[1].z), w0=(x1*beam1[1].w0+x2*beam2[1].w0)) - beam5 = beam_param(z=(x1*beam1[1].z+x2*beam3[1].z), w0=(x1*beam1[1].w0+x2*beam3[1].w0)) + beam50 = beam_param(z=float(x1*beam1[1].z+x2*beam2[1].z), w0=float(x1*beam1[1].w0+x2*beam2[1].w0)) + beam5 = beam_param(z=float(x1*beam1[1].z+x2*beam3[1].z), w0=float(x1*beam1[1].w0+x2*beam3[1].w0)) node_text = "at ITM->nITM1r" t_comp=kat.ITM t_node=kat.ITM.nITM1r else: - beam50 = beam_param(z=(x1*beam1[4].z+x2*beam2[4].z), w0=(x1*beam1[4].w0+x2*beam2[4].w0)) - beam5 = beam_param(z=(x1*beam1[4].z+x2*beam3[4].z), w0=(x1*beam1[4].w0+x2*beam3[4].w0)) + beam50 = beam_param(z=float(x1*beam1[4].z+x2*beam2[4].z), w0=float(x1*beam1[4].w0+x2*beam2[4].w0)) + beam5 = beam_param(z=float(x1*beam1[4].z+x2*beam3[4].z), w0=float(x1*beam1[4].w0+x2*beam3[4].w0)) node_text = "at s2->npo2" t_comp=kat.s2 t_node=kat.s2.npo2 - kat = set_thermal_lens(kat,50e3) + kat = set_thermal_lens(kat,50.0e3) - #import sys - #sys.exit() print("--------------------------------------------------------") print(" 12. computing beam tilt with thermal lens (f={0})".format(kat.ITM_TL.f)) - print(" Setting compromise beam parameter {0}: w0={1}, z={2}".format(node_text, beam50.w0, beam50.z)) + print(" Setting compromise beam parameter {0}:\n w0={1}, z={2}".format(node_text, beam50.w0, beam50.z)) t_node.node.setGauss(t_comp, beam50) kat.maxtem=8 print(" Calculating maxtem = %d " % kat.maxtem) @@ -119,7 +117,7 @@ def main(): kat = set_thermal_lens(kat,5e3) print("--------------------------------------------------------") print(" 13. computing beam tilt with thermal lens (f={0})".format(kat.ITM_TL.f)) - print(" Setting compromise beam parameter {0}: w0={1}, z={2}".format(node_text, beam5.w0, beam5.z)) + print(" Setting compromise beam parameter {0}:\n w0={1}, z={2}".format(node_text, beam5.w0, beam5.z)) t_node.node.setGauss(t_comp, beam5) #maxtems = [1, 3, 5, 9, 11, 13, 15, 19, 23, 25, 27, 29] #maxtems = [1, 3, 5, 9, 11, 13, 15] @@ -322,22 +320,22 @@ def gravity_tilt(tmpkat): kat.parseKatCode(code_WFS1) kat.parseKatCode(code_xaxis) kat.spo1.L=1000.0 - kat.ITM.ybeta=1e-10 + kat.ITM.ybeta=1.0e-10 kat.ETM.ybeta=0.0 t1=compute_gravity_tilt(kat) kat.ITM.ybeta=0.0 - kat.ETM.ybeta=-1e-10 + kat.ETM.ybeta=-1.0e-10 t2=compute_gravity_tilt(kat) kat = copy.deepcopy(tmpkat) kat.parseKatCode(code_WFS2) kat.parseKatCode(code_xaxis) kat.spo1.L=1.0e-9 - kat.ITM.ybeta=1e-10 + kat.ITM.ybeta=1.0e-10 kat.ETM.ybeta=0.0 t3=compute_gravity_tilt(kat) kat.ITM.ybeta=0.0 - kat.ETM.ybeta=-1e-10 + kat.ETM.ybeta=-1.0e-10 t4=compute_gravity_tilt(kat) print(" WFS1 ITM {0:.4} nrad".format(t1*1e9)) print(" WFS2 ITM {0:.4} nrad".format(t3*1e9))