Commit 3b286d5c authored by Andreas Freise's avatar Andreas Freise

removing duplocate setup function, fixing error when maxtem has not been set for pretune

parent 86d00da5
......@@ -1117,62 +1117,6 @@ def pretune_SRCL(_kat, verbose=False, debug=False):
deg = (out.x[SRCL_metric.argmin()] % 360) - 180
IFO.preSRCL.apply_tuning(-deg)
def setup(base, old=True, DC_offset_pm=20, verbose=False):
"""
Runs a preparation routine to produce a LIGO model at a resonable operating point.
This uses the pretune2 and pretune_SRCL methods which allow you
"""
assert_aligo_ifo_kat(base)
base = base.deepcopy()
base.verbose = False
base.removeBlock('locks', False)
base.removeBlock('errsigs', False)
base.removeBlock('powers', False)
base.phase = 2
base.IFO.fix_mirrors()
kat = base.deepcopy()
kat.IFO.remove_modulators()
if old:
pretune(kat,pretune_precision=1e-3, verbose=verbose)
else:
pretune_2(kat, pretune_precision=1e-3, verbose=verbose)
# Apply the tunings to our base kat file
base.IFO.apply_tunings(kat.IFO.get_tunings())
base.IFO.adjust_PRC_length(verbose=verbose)
if verbose:
pretune_status(base)
base.IFO.lengths_status()
# Set DC offset and plot
DCoffset = DC_offset_pm*1e-12 / base.lambda0 * 180.0
base.IFO.set_DC_offset(DCoffset=DCoffset, verbose=verbose)
if not old:
pretune_SRCL(base, verbose=verbose)
errsigs_cmds = base.IFO.add_errsigs_block()
# Generates a dictionary of the lock values to use
locks = generate_locks(base, verbose=verbose)
# Takes these values and then generates the commands and adds them to
# the lock block of the kat
lock_cmds = base.IFO.add_locks_block(locks, verbose=verbose)
base.SRCL_lock.accuracy /= 10
return base
......@@ -1195,7 +1139,7 @@ def pretune_status(_kat):
tunings = kat.IFO.get_tunings()
if tunings['keys']["maxtem"] == -1:
if tunings['keys']["maxtem"] is None or tunings['keys']["maxtem"] == -1:
_maxtemStr="off"
else:
_maxtemStr = "{:3}".format(tunings['keys']["maxtem"])
......@@ -1349,7 +1293,7 @@ def generate_locks(kat, gainsAdjustment = [0.5, 0.005, 1.0, 0.5, 0.025],
return data
def setup(base, DC_offset_pm=20, verbose=False, debug=False):
def setup(_base, DC_offset_pm=20, verbose=False, debug=False):
"""
Runs a preparation routine to produce a LIGO model at a resonable operating point.
......@@ -1362,9 +1306,9 @@ def setup(base, DC_offset_pm=20, verbose=False, debug=False):
# Will change later when this works with the
old = True
assert_aligo_ifo_kat(base)
assert_aligo_ifo_kat(_base)
base = base.deepcopy()
base = _base.deepcopy()
base.verbose = False
base.removeBlock('locks', False)
......@@ -1390,6 +1334,7 @@ def setup(base, DC_offset_pm=20, verbose=False, debug=False):
if not old:
_pretune_PRCL(base, verbose=verbose, debug=debug)
# Set DC offset
DCoffset = DC_offset_pm*1e-12 / base.lambda0 * 180.0
base.IFO.set_DC_offset(DCoffset=DCoffset, verbose=verbose)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment