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

removing files which are now included in master.py

parent 7ee3b949
No related branches found
No related tags found
No related merge requests found
import copy
import sys
import scipy.optimize
from pykat import finesse
def run(tmpkat):
kat = copy.deepcopy(tmpkat)
code_det = """
pd1 PDrefl_q 9M 90 nWFS1
%scale 2 PDrefl_q
"""
kat.parseKatCode(code_det)
kat.noxaxis= True
# function for root finding
def PD_q_test(x):
kat.PDrefl_q.phi[0]=x
out = kat.run(printout=0,printerr=0)
print '\r root finding: function value %g ' % out.y,
sys.stdout.flush()
return out.y
# do root finding
xtol=1e-8
(result, info)=scipy.optimize.bisect(PD_q_test,80.0,100.0, xtol=xtol, maxiter=500, full_output=True)
print ""
if info.converged:
p_phase=result-90.0
q_phase=result
print " Root has been found:"
print " p_phase %8f" % (p_phase)
print " q_phase %8f" % (q_phase)
print " (%d iterations, %g tolerance)" % (info.iterations, xtol)
return (p_phase, q_phase)
else:
raise Exception("Root has not been found")
import copy
from pykat import finesse
def run(tmpkat):
kat = copy.deepcopy(tmpkat)
code1 = """
ad EOM_up 9M nEOM1
ad EOM_low -9M nEOM1
pd cav_pow nITM2
ad cav_c 0 nITM2
ad WFS1_u 9M nWFS1
ad WFS1_l -9M nWFS1
ad WFS1_c 0 nWFS1
ad WFS2_u 9M nWFS2
ad WFS2_l -9M nWFS2
ad WFS2_c 0 nWFS2
noxaxis
"""
kat.parseKatCode(code1)
out = kat.run(printout=0,printerr=0)
code1 = code1.split("\n")
for i in range(len(out.y)):
print " %8s: %.4e" % (out.ylabels[i], out.y[i])
import copy
import sys
import scipy.optimize
def run(tmpkat):
kat = copy.deepcopy(tmpkat)
code1 = """
ad carr2 0 nITM1*
ad carr3 0 nITM2
yaxis deg
"""
kat.parseKatCode(code1)
kat.noxaxis = True
# function for root finding
def carrier_resonance(x):
kat.ETM.phi=x
out = kat.run(printout=0,printerr=0)
phase = (out.y[0]-out.y[1]-90)%360-180
print '\r root finding: function value %g ' % phase ,
sys.stdout.flush()
return phase
# do root finding
xtol=1e-8
(result, info)=scipy.optimize.bisect(carrier_resonance,0.0,40.0, xtol=xtol, maxiter=500, full_output=True)
print ""
if info.converged:
print " Root has been found:"
print " ETM phi %8f" % (result)
print " (%d iterations, %g tolerance)" % (info.iterations, xtol)
return result
else:
raise Exception(" Root has not been found")
if __name__=="__main__":
run()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment