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

improving pretuning script

parent 9ae075ec
Branches
No related tags found
No related merge requests found
......@@ -42,7 +42,7 @@ def main():
kat.ITMX.mass = 1e9
kat.ITMY.mass = 1e9
kat.verbose = False
kat.maxtem = "off"
kat.maxtem = 4# "off"
kat.phase = 2
#----------------------------------------------------------
......@@ -62,20 +62,24 @@ def main():
LIGO1.plot_error_signals(kat, xlimits=[-1e-2, 1e-2])
#----------------------------------------------------------
"""
kat_lock = prepare_locks(kat, verbose=True)
kat_lock.saveScript("locks.kat")
"""
kat_lock = finesse.kat(tempdir=".",tempname="test")
kat_lock.verbose = False
kat_lock.loadKatFile("locks.kat")
# run once
"""
print("-----------------------------------------------------")
print(" run once:")
kat_lock.noxaxis = True
kat_lock.verbose = True
out = kat_lock.run()
LIGO1.apply_lock_feedback(kat_lock, out)
LIGO1.apply_lock_feedback(kat, out)
print("-----------------------------------------------------")
print(" test locks with BS:")
kat_check = kat_lock.deepcopy()
# test lock with BS tuning
code = """
......@@ -92,33 +96,43 @@ def main():
plt.legend()
plt.show()
# check f1 resonance in PRC
kat_check = kat_lock.deepcopy()
LIGO1.check_f1_PRC_resonance(kat_check)
print("-----------------------------------------------------")
print(" check f1 resonance in PRC")
#kat_check = kat_lock.deepcopy()
#LIGO1.check_f1_PRC_resonance(kat_check)
print("-----------------------------------------------------")
print(" writing file")
baseBlocks = LIGO1.rawBlocks
header_code = baseBlocks.blocks["header"]
baseBlocks.remove(["tunings", "errsigs", "powers", "locks", "header"])
kat_code1 = LIGO1.generate_tuning_block(kat)
kat_code2 = LIGO1.generate_errsig_block(kat)
LIGO1.generate_locks(kat)
kat_code3 = LIGO1.generate_lock_block(kat)
kat_code1 = LIGO1.generate_tuning_block(kat_check)
kat_code2 = LIGO1.generate_errsig_block(kat_check)
kat_code3 = LIGO1.generate_lock_block(kat_check)
import datetime
strtoday = datetime.datetime.now()
pre_code1 = "# Pretuned with ifo.py (PyKat) on"+ strtoday.strftime("%d.%m.%Y %H:%M:%S")
pre_code1 = "# Pretuned with ifo.py (PyKat) on"+ strtoday.strftime("%d.%m.%Y %H:%M:%S")+"\n"
tunings = LIGO1.get_tunings(kat)
_maxtemStr = "{:3}".format(tunings["maxtem"])
_maxtemStr = "{}".format(tunings["maxtem"])
if tunings["maxtem"] == -1:
_maxtemStr="off"
pre_code2 = "# tuned for maxtem = {}, phase = {:2}".format(_maxtemStr, int(kat_check.phase))
pre_code2 = "# tuned for maxtem = {}, phase = {:2}\n".format(_maxtemStr, int(kat_check.phase))
header_code = header_code+pre_code1
header_code = header_code+pre_code2
header_code = header_code+"#--------------------------------------------------------------------------"
print(kat_code1)
print(kat_code2)
print(kat_code3)
baseBlocks = LIGO1.rawBlocks
baseBlocks.remove(["tunings", "errsigs", "locks"])
#baseBlocks.remove("tunings")
#baseBlocks.remove("errsigs")
#baseBlocks.remove("locks")
baseBlocks.add('header', header_code)
baseBlocks.add('tuning', kat_code1)
baseBlocks.write("mytest.kat")
baseBlocks.ordering.remove('header')
baseBlocks.ordering.insert(0, 'header')
baseBlocks.ordering.remove('NO_BLOCK')
baseBlocks.ordering.append('NO_BLOCK')
baseBlocks.write("LIGO_pretuned_maxtem_{}.kat".format(_maxtemStr))
print("---------------------------------------------------------------------")
......@@ -159,7 +173,7 @@ def prepare_locks(_kat, DCoffset=None, verbose=False):
code = LIGO1.generate_errsig_block(kat, noplot=True)
kat.parseCommands(code)
#code = LIGO1.generate_lock_block(kat, _accuracies = [1e-5, 1e-5, 1e-5, 1e-5, 1e-5])
code = LIGO1.generate_locks(kat, verbose=True)
LIGO1.generate_locks(kat, verbose=True)
code = LIGO1.generate_lock_block(kat, verbose=True)
kat.parseCommands(code)
return kat
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment