Skip to content
Snippets Groups Projects
Commit f7ac94bf authored by Anna Green's avatar Anna Green
Browse files

tune.py takes the pre-tuned DRMi kat file and adjusts it to lock in the 4 main...

tune.py takes the pre-tuned DRMi kat file and adjusts it to lock in the 4 main cases of PI 'builddown' modelling
parent f85f9fad
No related branches found
No related tags found
No related merge requests found
......@@ -13,10 +13,8 @@ def main():
kat.verbose=False
########################
# kat = LIGO1.kat
katfile = "DRMi"
basefile = "tuned/PI-"+katfile+".kat"
kat.loadKatFile(basefile)
# Blocks = LIGO1.rawBlocks
kat.loadKatFile("tuned/PI-DRMi.kat")
########################
kat.maxtem = 0#'off'
kat.phase = 2
......@@ -24,6 +22,14 @@ def main():
maxtem {0}
phase {1}
""".format(kat.maxtem, kat.phase)
#######################
#creating auxMICH port that works for non-recycled MICH monitoring
LIGO1.APOP_f2 = ifo.port("APOP_f2","nAPOP", LIGO1.f2, phase=13)
LIGO1.aMICH = ifo.DOF("aMICH", LIGO1.APOP_f2, "Q", ["ITMX", "ETMX", "ITMY", "ETMY"], [1,1,-1,-1], 100.0)
#######################
#for testing
dofs = [LIGO1.CARM, LIGO1.DARM, LIGO1.aMICH, LIGO1.PRCL, LIGO1.SRCL]
locks = [kat.ETMX_lock, kat.ETMY_lock, kat.MICH_lock, kat.ITMY_lock, kat.PRCL_lock, kat.SRCL_lock]
# #Making lock blocks
# ######################## #high masses to ensure TF calcs work in DRMi_tuning
......@@ -51,71 +57,105 @@ phase {1}
# Blocks.add("tunings",tune_code)
# Blocks.add("errsigs",err_code)
# Blocks.add("locks",lock_code)
# print("\n--------------------BLOCKS")
# print(Blocks)
# # print("\n--------------------BLOCKS")
# # print(Blocks)
# ################# save ######################
# ######## save ordinary kat file
# # kat.saveScript("tuned/PI-"+katfile+".kat")
# ######## save in blocks
# Blocks.write("tuned/PI-DRMi.kat")
# o = open("tuned/PI-DRMi.kat",'a')
# o.write(tuning_conditions)
# o.close()
### now *manually* edit the file to use aMICH as MICH_lock rather than MICH.
testing(kat,dofs,locks)
############### cut down #####################
# ######################## # DR --> PRMi
#removing kat lines
ifo.make_transparent(kat,["SRM","SRMAR"])
kat.SRCL_lock.enable=False
kat.SRCL_lock.enabled=False
#updating input power to match DRMi
sf = tt.Xpow(kat,printit=False)
sf = tt.Xpow(kat)#,printit=False)
kat.L0.P *= sf
#adjusting lock/errsig properties
kat.DARM_lock.gain *= 1 / 10.0
kat.POP_f2_Q.phase1 -= 10#60
#updating filename
katfile = "PRMi"
#kat.POP_f2_Q.phase1 -= 10#60
kat.APOP_f2.phase1 -= 10
# #updating filename
# katfile = "PRMi"
print("""
---------------------------------------------------
to make PRMi file from DRMi tuned case, set:
SRM, SRMAR transparent
remove SRCL lock commands and puts
kat.L0.P = {0}
kat.DARM_lock.gain = {1}
kat.POP_f2_Q.phase1 = {2}
---------------------------------------------------
""".format(kat.L0.P,kat.DARM_lock.gain,kat.POP_f2_Q.phase1))
# # ######################## # PR --> FPMi
# #removing kat lines
# ifo.make_transparent(kat,["PRM","PRMAR"])
# kat.PRCL_lock.enable=False
""".format(kat.L0.P,kat.DARM_lock.gain,kat.APOP_f2.phase1))
testing(kat,dofs[:-1],locks[:-1])
######################## # PR --> FPMi
#removing kat lines
ifo.make_transparent(kat,["PRM","PRMAR"])
kat.PRCL_lock.enabled=False
# kat.POP_f2_Q.remove()
# kat.parseCommands("pd1 POP_f2_Q 45497355.0 93.0 dump11")
kat.MICH_lock.accuracy*=0.01
kat.MICH_lock.gain*=10
# #updating input power to match DRMi
# sf = tt.Xpow(kat,printit=False)
# kat.L0.P *= sf
# #adjusting lock/errsig properties
# kat.DARM_lock.gain *= 1/2
# kat.CARM_lock.gain *= 1/10
# kat.MICH_lock.gain *=1e18
# #updating filename
# katfile = "FPMi"
# # ########## create block form
################# save ######################
######## save ordinary kat file
# kat.saveScript("tuned/PI-"+katfile+".kat")
######## save in blocks
# Blocks.write("tuned/PI-"+katfile+".kat")
# o = open("tuned/PI-"+katfile+".kat",'a')
# o.write(tuning_conditions)
# o.close()
sf = tt.Xpow(kat)#,printit=False)
kat.L0.P *= sf
print("""
---------------------------------------------------
to make FPMi file from PRMi tuned case, set:
PRM, PRMAR transparent
remove PRCL lock commands and puts
kat.L0.P = {0}
kat.MICH_lock.accuracy = {1}
kat.MICH_lock.gain = {2}
---------------------------------------------------
""".format(kat.L0.P,kat.MICH_lock.accuracy,kat.MICH_lock.gain))
testing(kat,dofs[:-2],locks[:-2],prc=False)
######################## # FPMi --> 1arm
ifo.make_transparent(kat,["ITMY","ITMYAR","ETMY","ETMYAR"])
kat.BS.setRTL(0.0,1.0,0.0) # set BS refl. for X arm?
sf = tt.Xpow(kat)#,printit=False)
kat.L0.P *= sf
kat.removeBlock('locks')
kat.parseCommands("""
%%% FTblock locks
###########################################################################
set CARM_err REFL_f1_I re
lock ETMX_lock $CARM_err 0.00039 0.00043
put* ETMX phi $ETMX_lock
noplot ETMX_lock
###########################################################################
%%% FTend locks
""")
kat.ITMX.phi = 0
kat.ETMX.phi = 0
# ################# tests #####################
test_kat = finesse.kat()
test_kat.loadKatFile("tuned/PI-PRMi.kat")
# test_kat = kat.deepcopy()
test_kat.verbose=True
dofs = [LIGO1.DARM, LIGO1.CARM, LIGO1.MICH, LIGO1.PRCL]#, LIGO1.SRCL]
locks = [test_kat.ETMX_lock, test_kat.ETMY_lock, test_kat.MICH_lock, test_kat.ITMY_lock, test_kat.PRCL_lock]#, test_kat.SRCL_lock]
prc = True
print("\n--------------KAT:")
print(test_kat)
# LIGO1.plot_error_signals(kat, xlimits=[-1e-2, 1e-2])
# tt.Xpow(test_kat)
xlim = 1e-1
tt.plot_errs(test_kat,dofs,xlimits=[-xlim, xlim])
tt.test_locks(test_kat,locks,PRC=prc)
print("""
---------------------------------------------------
to make 1arm file from FPMi tuned case, set:
"ITMY","ITMYAR","ETMY","ETMYAR" transparent
kat.L0.P = {0}
kat1.BS.setRTL(0.0,1.0,0.0) ---maybe?
remove "locks" block
replace with single ETMX lock based on CARM errsig
---------------------------------------------------
""".format(kat.L0.P))
testing(kat,dofs[0],locks[0],prc=False,opt="ITMX")
END = input('press enter to finish and close all plots')#to override auto-closing.
def testing(kat,dofs,locks,prc=True,xlim=1e-2,opt="BS"):
if not isinstance(dofs,list): dofs = [dofs]
if not isinstance(locks,list): locks = [locks]
tt.plot_errs(kat,dofs,xlimits=[-xlim, xlim])
tt.test_locks(kat,locks,PRC=prc,optic=opt)
if __name__ == '__main__':
main()
\ No newline at end of file
......@@ -56,7 +56,10 @@ def plot_errs(_kat,dofs=[LIGO1.DARM, LIGO1.CARM, LIGO1.PRCL, LIGO1.SRCL, LIGO1.M
idx=1
fig = plt.figure()
for d in dofs:
if len(dofs) != 1:
ax = fig.add_subplot(w,2,idx)
else:
ax = fig.add_subplot(1,1,1)
idx+=1
out = ifo.scan_DOF(kat, d, xlimits = np.multiply(d.scale,xlimits), relative = True)
ax.plot(out.x,out[d.signal_name(kat)])
......@@ -68,39 +71,45 @@ def plot_errs(_kat,dofs=[LIGO1.DARM, LIGO1.CARM, LIGO1.PRCL, LIGO1.SRCL, LIGO1.M
plt.show(block=0)
def test_locks(_kat,locks,PRC=False):
def test_locks(_kat,locks,PRC=False,optic="BS"):
# separated from DRMi_tuning
kat = _kat.deepcopy()
if PRC==True:
# check f1 resonance in PRC
kat = _kat.deepcopy()
LIGO1.check_f1_PRC_resonance(kat)
if optic =="BS":
# test lock with BS tuning
code = """
xaxis BS phi lin 0 2 100
yaxis abs
#showiterate -1
"""
else:
code = """
xaxis {0} phi lin 0 2 100
yaxis abs
#showiterate -1
""".format(optic)
kat.parseCommands(code)
out = kat.run()
plt.figure()
ifo.make_list_copy(locks)
for l in locks:
plt.plot(out.x,out[l.name], label=l.name)
plt.legend()
plt.xlabel(optic + " phi [deg]")
if len(locks) != 1:
plt.legend(loc=0)
else: plt.ylabel(str(locks[0].name))
plt.grid()
plt.show(block=0)
def DRMi_tuning(_kat):
# edited from Andreas' TestLIGO file
kat = _kat.deepcopy()
# BlockList = kat._kat__blocks
# if 'locks' in BlockList:
# kat.removeBlock('locks')
# if 'errsigs' in BlockList:
# kat.removeBlock('errsigs')
# if 'powers' in BlockList:
# kat.removeBlock('powers')
#creating auxMICH port that works for non-recycled MICH monitoring
LIGO1.APOP_f2 = ifo.port("APOP_f2","nAPOP", LIGO1.f2, phase=13)
LIGO1.aMICH = ifo.DOF("aMICH", LIGO1.APOP_f2, "Q", ["ITMX", "ETMX", "ITMY", "ETMY"], [1,1,-1,-1], 100.0)
#pretuning and DC offset
pretune(kat, verbose=True, debug=False)
LIGO1.pretune_status(kat)
......
......@@ -17,7 +17,7 @@
# http://iopscience.iop.org/article/10.1088/0264-9381/32/7/074001/meta#cqg507871s4-8
# - G. Billingsley. LIGO core optics reference page. https://galaxy.ligo. caltech.edu/optics/
#
# Anna Green, 28th November 2016
# Anna Green, Andreas Freise, 28th November 2016
#--------------------------------------------------------------------------
#
# References used for aLIGO parameters
......@@ -54,7 +54,7 @@
# Changes in file structure
# - removed length calculation fucntions for PRC and SRC sub-length
# and added length values into space components
# -
# - removed maxtem 4 command from HOMs block
#
# Naming changes
# - changed naming for thermal lens components
......@@ -62,6 +62,8 @@
# - changed naming of SRMHR to SRM and node names in SRM substrate
# - changed name of ITMHR to ITM and ETMHR to ETM
# - changed names of arm spaces from LXarm, LYarm to LX, LY
# - changed name of HOMs block to cavities
# - changed PR2 node4 name from dump11 to nAPOP (auxilliary POP)
#
#
#--------------------------------------------------------------------------
......@@ -99,7 +101,7 @@ attr PRM Rc 11.009
# Distance between PRM and PR2
s lp1 16.6107 nPRM2 nPR2a
# PR2
bs1 PR2 250u $Mloss 0 -0.79 nPR2a nPR2b nPOP dump11
bs1 PR2 250u $Mloss 0 -0.79 nPR2a nPR2b nPOP nAPOP
attr PR2 Rc -4.545
# Distance from PR2 to PR3
s lp2 16.1647 nPR2b nPR3a
......@@ -302,12 +304,14 @@ const phi_SRM -90.0012
pd AS_DC nSRM2
pd1 REFL_f1_I 9099471.0 101 nREFL
pd1 POP_f1_I 9099471.0 101 nPOP
pd1 POP_f2_Q 45497355.0 103.0 nPOP
#pd1 POP_f2_Q 45497355.0 103.0 nPOP
pd1 APOP_f2 45497355.0 103.0 nAPOP
pd1 REFL_f2_I 45497355.0 14 nREFL
noplot AS_DC
noplot REFL_f1_I
noplot POP_f1_I
noplot POP_f2_Q
#noplot POP_f2_Q
noplot APOP_f2
noplot REFL_f2_I
###########################################################################
%%% FTend errsigs
......@@ -317,14 +321,16 @@ noplot REFL_f2_I
set AS_f2_I_re AS_DC re
set CARM_err REFL_f1_I re
set PRCL_err POP_f1_I re
set MICH_err POP_f2_Q re
#set MICH_err POP_f2_Q re
set aMICH_err APOP_f2 re
set SRCL_err REFL_f2_I re
func DARM_err = $AS_f2_I_re - 1.56140670384883
lock DARM_lock $DARM_err 0.0035 0.0048
lock CARM_lock $CARM_err 0.00039 0.00043
lock PRCL_lock $PRCL_err -2.8 0.00012
lock MICH_lock $MICH_err 43 3.9e-05
#lock MICH_lock $MICH_err 43 3.9e-05
lock MICH_lock $aMICH_err 43 3.9e-05
lock SRCL_lock $SRCL_err 2.6 0.0016
noplot ITMY_lock
func ITMY_lock = (-1.0) * $MICH_lock
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment