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

starting to change methotds of LIGO to functions in ifo

parent 3e3cd3d7
No related branches found
No related tags found
No related merge requests found
Pipeline #
...@@ -59,9 +59,12 @@ class aLIGO(object): ...@@ -59,9 +59,12 @@ class aLIGO(object):
self.kat.loadKatFile(katfile) self.kat.loadKatFile(katfile)
self.rawBlocks.read(katfile) self.rawBlocks.read(katfile)
else: else:
"""
if _name not in names: # TODO different files not yet implemented if _name not in names: # TODO different files not yet implemented
printf("aLIGO name `{}' not recognised, must be 'default', 'LLO' or 'LHO'",_name) printf("aLIGO name `{}' not recognised, must be 'default', 'LLO' or 'LHO'",_name)
#print(data_path) """
if _name != "default":
printf("aLIGO name `{}' not recognised, using 'default'",_name)
self.kat.loadKatFile(self._data_path+"aLIGO.kat") self.kat.loadKatFile(self._data_path+"aLIGO.kat")
self.rawBlocks.read(self._data_path+"aLIGO.kat") self.rawBlocks.read(self._data_path+"aLIGO.kat")
...@@ -89,12 +92,12 @@ class aLIGO(object): ...@@ -89,12 +92,12 @@ class aLIGO(object):
if (5 * self.f1 != self.f2): if (5 * self.f1 != self.f2):
print(" ** Warning: modulation frequencies do not match: 5*f1!=f2") print(" ** Warning: modulation frequencies do not match: 5*f1!=f2")
# defining a dicotionary for the main mirror positions (tunings) # defining a dicotionary for the main mirror positions (tunings),
self.tunings = {} # keys should include maxtem, phase and all main optics names
self.tunings = self.get_tunings(self.kat) self.tunings = dict.fromkeys(["maxtem", "phase", "PRM", "ITMX", "ETMX", "ITMY", "ETMY", "BS", "SRM"])
self.tunings = get_tunings(self.kat, self.tunings)
self.compute_derived_lengths(self.kat) self.compute_derived_lengths(self.kat)
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# define ports and signals # define ports and signals
...@@ -129,7 +132,6 @@ class aLIGO(object): ...@@ -129,7 +132,6 @@ class aLIGO(object):
self.lockNames = None self.lockNames = None
@property @property
def DOFs(self): def DOFs(self):
return copy.copy(self.__DOFs) return copy.copy(self.__DOFs)
...@@ -181,7 +183,6 @@ put f1m f $mx1 ...@@ -181,7 +183,6 @@ put f1m f $mx1
plt.tight_layout() plt.tight_layout()
plt.show(block=0) plt.show(block=0)
def compute_derived_lengths(self, kat, verbose=False): def compute_derived_lengths(self, kat, verbose=False):
""" """
Compute derived length from individual space components. Compute derived length from individual space components.
...@@ -227,29 +228,8 @@ put f1m f $mx1 ...@@ -227,29 +228,8 @@ put f1m f $mx1
print("| f1 = {:11.8}, f2 = {:11.9} |".format(self.f1, self.f2)) print("| f1 = {:11.8}, f2 = {:11.9} |".format(self.f1, self.f2))
print(" `--------------------------------------------------'") print(" `--------------------------------------------------'")
def get_tunings(self, kat):
self.tunings["maxtem"] = kat.maxtem
self.tunings["PRM"] = kat.PRM.phi
self.tunings["ITMX"] = kat.ITMX.phi
self.tunings["ETMX"] = kat.ETMX.phi
self.tunings["ITMY"] = kat.ITMY.phi
self.tunings["ETMY"] = kat.ETMY.phi
self.tunings["BS"] = kat.BS.phi
self.tunings["SRM"] = kat.SRM.phi
return self.tunings
def set_tunings(self, kat, tunings):
kat.maxtem = tunings["maxtem"]
kat.PRM.phi = tunings["PRM"]
kat.ITMX.phi = tunings["ITMX"]
kat.ETMX.phi = tunings["ETMX"]
kat.ITMY.phi = tunings["ITMY"]
kat.ETMY.phi = tunings["ETMY"]
kat.BS.phi = tunings["BS"]
kat.SRM.phi = tunings["SRM"]
def apply_lock_feedback(self, kat, out): def apply_lock_feedback(self, kat, out):
tuning = self.get_tunings(kat) tuning = get_tunings(kat, self.tunings)
if "ETMX_lock" in out.ylabels: if "ETMX_lock" in out.ylabels:
tuning["ETMX"] += float(out["ETMX_lock"]) tuning["ETMX"] += float(out["ETMX_lock"])
else: else:
...@@ -271,7 +251,7 @@ put f1m f $mx1 ...@@ -271,7 +251,7 @@ put f1m f $mx1
tuning["SRM"] += float(out["SRCL_lock"]) tuning["SRM"] += float(out["SRCL_lock"])
else: else:
print(" ** Warning: could not find SRCL lock") print(" ** Warning: could not find SRCL lock")
self.set_tunings(kat, tuning) set_tunings(kat, tuning)
def pretune(self, _kat, pretune_precision=1.0e-4, verbose=False): def pretune(self, _kat, pretune_precision=1.0e-4, verbose=False):
...@@ -348,7 +328,7 @@ put f1m f $mx1 ...@@ -348,7 +328,7 @@ put f1m f $mx1
out = kat.run() out = kat.run()
Pin = float(kat.L0.P) Pin = float(kat.L0.P)
tunings = self.get_tunings(kat) tunings = get_tunings(kat, self.tunings)
_maxtemStr = "{:3}".format(tunings["maxtem"]) _maxtemStr = "{:3}".format(tunings["maxtem"])
if tunings["maxtem"] == -1: if tunings["maxtem"] == -1:
_maxtemStr="off" _maxtemStr="off"
...@@ -436,7 +416,7 @@ put f1m f $mx1 ...@@ -436,7 +416,7 @@ put f1m f $mx1
Displays error signals for a given kat file. Can also be used to plot multiple Displays error signals for a given kat file. Can also be used to plot multiple
DOF's error signals against each other for visualising any cross coupling. DOF's error signals against each other for visualising any cross coupling.
_kat: LIGO based kat object. _kat: LIGO-like kat object.
xlimits: Range of DOF to plot in degrees xlimits: Range of DOF to plot in degrees
DOFs: list, DOF names to compute. Default: DARM, CARM, PRCL, SRCL, MICH DOFs: list, DOF names to compute. Default: DARM, CARM, PRCL, SRCL, MICH
plotDOFs: list, DOF names to plot against each DOF. If None the same DOF as in DOFs is plotted. plotDOFs: list, DOF names to plot against each DOF. If None the same DOF as in DOFs is plotted.
...@@ -538,10 +518,10 @@ put f1m f $mx1 ...@@ -538,10 +518,10 @@ put f1m f $mx1
if DCoffset: if DCoffset:
self.DCoffset=DCoffset self.DCoffset=DCoffset
print("-- applying user-defined DC offset:") print("-- applying user-defined DC offset:")
pretuning = self.get_tunings(_kat) pretuning = get_tunings(_kat, self.tunings)
pretuning["ETMY"] += self.DCoffset pretuning["ETMY"] += self.DCoffset
pretuning["ETMX"] -= self.DCoffset pretuning["ETMX"] -= self.DCoffset
self.set_tunings(_kat, pretuning) set_tunings(_kat, pretuning)
kat = _kat.deepcopy() kat = _kat.deepcopy()
sigStr = self.AS_DC.signal(kat) sigStr = self.AS_DC.signal(kat)
signame = self.AS_DC.signal_name(kat) signame = self.AS_DC.signal_name(kat)
...@@ -562,10 +542,10 @@ put f1m f $mx1 ...@@ -562,10 +542,10 @@ put f1m f $mx1
print(" waste light in AS port of {:2} W".format(waste_light)) print(" waste light in AS port of {:2} W".format(waste_light))
kat_lock = _kat.deepcopy() kat_lock = _kat.deepcopy()
self.find_DC_offset(kat_lock, 2*waste_light) self.find_DC_offset(kat_lock, 2*waste_light)
pretuning = self.get_tunings(kat_lock) pretuning = get_tunings(kat_lock, self.tunings)
pretuning["ETMY"] += self.DC_offset pretuning["ETMY"] += self.DC_offset
pretuning["ETMX"] -= self.DC_offset pretuning["ETMX"] -= self.DC_offset
self.set_tunings(_kat, pretuning) set_tunings(_kat, pretuning)
self.DCoffset_meter = self.DCoffset / 360.0 * _kat.lambda0 self.DCoffset_meter = self.DCoffset / 360.0 * _kat.lambda0
vprint(verbose, " DCoffset = {:6.4} deg ({:6.4}m)".format(self.DCoffset, self.DCoffset_meter)) vprint(verbose, " DCoffset = {:6.4} deg ({:6.4}m)".format(self.DCoffset, self.DCoffset_meter))
vprint(verbose, " at dark port power: {:6.4}W".format(self.DCoffsetW)) vprint(verbose, " at dark port power: {:6.4}W".format(self.DCoffsetW))
...@@ -913,6 +893,41 @@ class port(object): ...@@ -913,6 +893,41 @@ class port(object):
else: else:
return "pd2 {} {} {} {} {} {}".format(name, self.f, phase, fsig, phase2, self.nodeName) return "pd2 {} {} {} {} {} {}".format(name, self.f, phase, fsig, phase2, self.nodeName)
#--------------------------------------------------------------------------------------------------
#--------------------------------------------------------------------------------------------------
#--------------------------------------------------------------------------------------------------
#--------------------------------------------------------------------------------------------------
def get_tunings(kat, tunings):
"""
returns the tunings of optical components and the corresponding values
for maxtem and phase
"""
keys = list(tunings.keys())
if "maxtem" in keys:
tunings["maxtem"] = kat.maxtem
keys.remove("maxtem")
if "phase" in keys:
tunings["phase"] = kat.phase
keys.remove("phase")
for comp in keys:
tunings[comp] = kat.components[comp].phi
return tunings
def set_tunings(kat, tunings):
"""
sets the tunings of optical components and the corresponding values
for maxtem and phase
"""
keys = list(tunings.keys())
if "maxtem" in keys:
kat.maxtem = tunings["maxtem"]
keys.remove("maxtem")
if "phase" in keys:
kat.phase = tunings["phase"]
keys.remove("phase")
for comp in keys:
kat.components[comp].phi = tunings[comp]
def scan_optics_string(_optics, _factors, _varName, linlog="lin", xlimits=[-100, 100], steps=200, axis=1,relative=False): def scan_optics_string(_optics, _factors, _varName, linlog="lin", xlimits=[-100, 100], steps=200, axis=1,relative=False):
optics=make_list_copy(_optics) optics=make_list_copy(_optics)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment