Skip to content
Snippets Groups Projects
Commit 2af32e96 authored by Andreas Freise's avatar Andreas Freise
Browse files

fixing unicode warnings

parent 746e58ad
No related branches found
No related tags found
No related merge requests found
...@@ -117,7 +117,7 @@ def pd_phase(tmpkat): ...@@ -117,7 +117,7 @@ def pd_phase(tmpkat):
# function for root finding # function for root finding
def PD_q_test(x): def PD_q_test(x):
kat.PDrefl_q.phase1=x kat.PDrefl_q.phase1=float(x)
out = kat.run() out = kat.run()
print('\r root finding: function value {0:<16g}'.format(float(out.y)), end='') print('\r root finding: function value {0:<16g}'.format(float(out.y)), end='')
sys.stdout.flush() sys.stdout.flush()
...@@ -180,7 +180,7 @@ def resonance(tmpkat): ...@@ -180,7 +180,7 @@ def resonance(tmpkat):
# function for root finding # function for root finding
def carrier_resonance(x): def carrier_resonance(x):
kat.ETM.phi=x kat.ETM.phi=float(x)
out = kat.run() out = kat.run()
phase = (out.y[0,0]-out.y[0,1]-90)%360-180.0 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='') print('\r root finding: function value {0:<16g}'.format(float(phase)), end='')
......
...@@ -178,7 +178,7 @@ def asc_phases(tmpkat): ...@@ -178,7 +178,7 @@ def asc_phases(tmpkat):
kat.maxtem=1 kat.maxtem=1
def demod_phase1(x): def demod_phase1(x):
kat.WFS1_I.phase1=x[0] kat.WFS1_I.phase1=float(x[0])
out = kat.run() out = kat.run()
signal = out["WFS1_I"] signal = out["WFS1_I"]
print('\r minimising: function value {0:<16g}'.format(float(signal)), end='') print('\r minimising: function value {0:<16g}'.format(float(signal)), end='')
...@@ -186,7 +186,7 @@ def asc_phases(tmpkat): ...@@ -186,7 +186,7 @@ def asc_phases(tmpkat):
return -1*abs(signal) return -1*abs(signal)
def demod_phase2(x): def demod_phase2(x):
kat.WFS2_I.phase1=x[0] kat.WFS2_I.phase1=float(x[0])
out = kat.run() out = kat.run()
signal = out["WFS2_I"] signal = out["WFS2_I"]
print('\r minimising: function value {0:<16g}'.format(float(signal)), end='') print('\r minimising: function value {0:<16g}'.format(float(signal)), end='')
...@@ -196,14 +196,14 @@ def asc_phases(tmpkat): ...@@ -196,14 +196,14 @@ def asc_phases(tmpkat):
kat.ITM.ybeta=1e-10 kat.ITM.ybeta=1e-10
kat.ETM.ybeta=0.0 kat.ETM.ybeta=0.0
res = fmin(demod_phase1, [0.0], xtol=1e-8, disp=False) res = fmin(demod_phase1, [0.0], xtol=1e-8, disp=False)
WFS1_phase = res[0] WFS1_phase = float(res[0])
print("") print("")
print(" WFS1 demod phase : %.10g deg" % WFS1_phase) print(" WFS1 demod phase : %.10g deg" % WFS1_phase)
kat.ITM.ybeta=0.0 kat.ITM.ybeta=0.0
kat.ETM.ybeta=-1e-10 kat.ETM.ybeta=-1e-10
res = fmin(demod_phase2, [0.0], xtol=1e-8, disp=False) res = fmin(demod_phase2, [0.0], xtol=1e-8, disp=False)
WFS2_phase = res[0] WFS2_phase = float(res[0])
print("") print("")
print(" WFS2 demod phase : %.10g deg" % WFS2_phase) print(" WFS2 demod phase : %.10g deg" % WFS2_phase)
return(WFS1_phase, WFS2_phase) return(WFS1_phase, WFS2_phase)
......
...@@ -16,10 +16,10 @@ import copy ...@@ -16,10 +16,10 @@ import copy
import sys import sys
def set_thermal_lens(kat, f): 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 a bs-based cavity is used, we need to set second lens
if "ITM_TL_r" in kat._kat__components: if "ITM_TL_r" in kat._kat__components:
kat.ITM_TL_r.f=f kat.ITM_TL_r.f=float(f)
return (kat) return (kat)
def main(): def main():
...@@ -91,26 +91,24 @@ def main(): ...@@ -91,26 +91,24 @@ def main():
x1=0.70 x1=0.70
x2=0.30 x2=0.30
if "ITM_TL_r" in kat._kat__components: 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)) 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=(x1*beam1[1].z+x2*beam3[1].z), w0=(x1*beam1[1].w0+x2*beam3[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" node_text = "at ITM->nITM1r"
t_comp=kat.ITM t_comp=kat.ITM
t_node=kat.ITM.nITM1r t_node=kat.ITM.nITM1r
else: else:
beam50 = beam_param(z=(x1*beam1[4].z+x2*beam2[4].z), w0=(x1*beam1[4].w0+x2*beam2[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=(x1*beam1[4].z+x2*beam3[4].z), w0=(x1*beam1[4].w0+x2*beam3[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" node_text = "at s2->npo2"
t_comp=kat.s2 t_comp=kat.s2
t_node=kat.s2.npo2 t_node=kat.s2.npo2
kat = set_thermal_lens(kat,50e3) kat = set_thermal_lens(kat,50.0e3)
#import sys
#sys.exit()
print("--------------------------------------------------------") print("--------------------------------------------------------")
print(" 12. computing beam tilt with thermal lens (f={0})".format(kat.ITM_TL.f)) 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) t_node.node.setGauss(t_comp, beam50)
kat.maxtem=8 kat.maxtem=8
print(" Calculating maxtem = %d " % kat.maxtem) print(" Calculating maxtem = %d " % kat.maxtem)
...@@ -119,7 +117,7 @@ def main(): ...@@ -119,7 +117,7 @@ def main():
kat = set_thermal_lens(kat,5e3) kat = set_thermal_lens(kat,5e3)
print("--------------------------------------------------------") print("--------------------------------------------------------")
print(" 13. computing beam tilt with thermal lens (f={0})".format(kat.ITM_TL.f)) 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) 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, 19, 23, 25, 27, 29]
#maxtems = [1, 3, 5, 9, 11, 13, 15] #maxtems = [1, 3, 5, 9, 11, 13, 15]
...@@ -322,22 +320,22 @@ def gravity_tilt(tmpkat): ...@@ -322,22 +320,22 @@ def gravity_tilt(tmpkat):
kat.parseKatCode(code_WFS1) kat.parseKatCode(code_WFS1)
kat.parseKatCode(code_xaxis) kat.parseKatCode(code_xaxis)
kat.spo1.L=1000.0 kat.spo1.L=1000.0
kat.ITM.ybeta=1e-10 kat.ITM.ybeta=1.0e-10
kat.ETM.ybeta=0.0 kat.ETM.ybeta=0.0
t1=compute_gravity_tilt(kat) t1=compute_gravity_tilt(kat)
kat.ITM.ybeta=0.0 kat.ITM.ybeta=0.0
kat.ETM.ybeta=-1e-10 kat.ETM.ybeta=-1.0e-10
t2=compute_gravity_tilt(kat) t2=compute_gravity_tilt(kat)
kat = copy.deepcopy(tmpkat) kat = copy.deepcopy(tmpkat)
kat.parseKatCode(code_WFS2) kat.parseKatCode(code_WFS2)
kat.parseKatCode(code_xaxis) kat.parseKatCode(code_xaxis)
kat.spo1.L=1.0e-9 kat.spo1.L=1.0e-9
kat.ITM.ybeta=1e-10 kat.ITM.ybeta=1.0e-10
kat.ETM.ybeta=0.0 kat.ETM.ybeta=0.0
t3=compute_gravity_tilt(kat) t3=compute_gravity_tilt(kat)
kat.ITM.ybeta=0.0 kat.ITM.ybeta=0.0
kat.ETM.ybeta=-1e-10 kat.ETM.ybeta=-1.0e-10
t4=compute_gravity_tilt(kat) t4=compute_gravity_tilt(kat)
print(" WFS1 ITM {0:.4} nrad".format(t1*1e9)) print(" WFS1 ITM {0:.4} nrad".format(t1*1e9))
print(" WFS2 ITM {0:.4} nrad".format(t3*1e9)) print(" WFS2 ITM {0:.4} nrad".format(t3*1e9))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment