Commit 9b828b8c authored by Daniel Brown's avatar Daniel Brown

Fixing beamtrace error. Changing the complete LIGO files to have one single...

Fixing beamtrace error. Changing the complete LIGO files to have one single ITM lens in each rather than two as we will just have a single function that computes the overall lens. Tried fixing the param object to work more like a float too when dividing with it.
parent d043d1ac
......@@ -3284,13 +3284,13 @@ class kat(object):
z = data[from_node]['z'] # starting distance
_z = np.arange(0, L, dz) # Distance to propagate
g = np.rad2deg(q.gouy(_z + q.z)) # gouy phase accumulated along this space
g = np.rad2deg(q.gouy(_z)) # gouy phase accumulated along this space
# want to plot accumulated gouy phase so need to use
# a reference from where it started
_g = gouy + g - gouy_ref
w = q.beamsize(_z + q.z)
w = q.beamsize(_z)
w /= pykat.SI[w_scale]
w_max = max(w_max, w.max())
......@@ -3352,7 +3352,7 @@ class kat(object):
funcs = []
def _wz(z0, q):
return lambda x: q.beamsize(x - z0 + q.z)
return lambda x: q.beamsize(x - z0)
for comp, (from_node, to_node) in zip(data['components'], data['nodes']):
if data[comp]['is_space']:
......@@ -3397,12 +3397,12 @@ class kat(object):
q = data[from_node]['q']
z = data[from_node]['z']
_z = np.linspace(0, L, 1000)
g = np.rad2deg(q.gouy(_z+q.z))
g = np.rad2deg(q.gouy(_z))
# want to plot accumulated gouy phase so need to use
# a reference from where it started
_g = gouy + np.rad2deg(q.gouy(_z + q.z)) - gouy_ref
w = q.beamsize(_z + q.z)/pykat.SI[w_scale]
_g = gouy + np.rad2deg(q.gouy(_z)) - gouy_ref
w = q.beamsize(_z)/pykat.SI[w_scale]
w_max = max(w_max, w.max())
g_max = max(g_max, _g.max())
......
......@@ -741,7 +741,8 @@ def assert_aligo_ifo_kat(kat):
if not isinstance(kat.IFO, ALIGO_IFO):
raise pkex.BasePyKatException("\033[91mkat file is not an ALIGO_IFO compatiable kat\033[0m")
def make_kat(name="design", katfile=None, verbose = False, debug=False, use_RF_DARM_lock=False, keepComments=False, preserveConstants=False):
def make_kat(name="design", katfile=None, verbose = False, debug=False, use_RF_DARM_lock=False,
keepComments=False, preserveConstants=False):
"""
Returns a kat object and fills in the kat.IFO property for storing
the associated interferometer data.
......@@ -789,7 +790,8 @@ def make_kat(name="design", katfile=None, verbose = False, debug=False, use_RF_D
kat.IFO.rawBlocks.read(katfile)
else:
if name not in names:
pkex.printWarning("aLIGO name `{}' not recognised, options are {}, using default 'design'".format(name, names))
pkex.printWarning("aLIGO name `{}' not recognised, options are {}, "
"using default 'design'".format(name, names))
katkile = os.path.join(kat.IFO._data_path, name+".kat")
......@@ -862,19 +864,18 @@ def make_kat(name="design", katfile=None, verbose = False, debug=False, use_RF_D
kat.IFO._preALSX = DOF(kat.IFO, "ALSX", kat.IFO.POW_X, "", "ETMX", 1, 1.0, sigtype="z")
kat.IFO._preALSY = DOF(kat.IFO, "ALSY", kat.IFO.POW_Y, "", "ETMY", 1, 1.0, sigtype="z")
# control scheme as in [1] Table C.1. Due to Finesse
# conventions, the overall factor for all but PRCL are multiplied by -1
# compared to the LIGO defintion, to match the same defintion.
kat.IFO.PRCL = DOF(kat.IFO, "PRCL", kat.IFO.POP_f1, "I", "PRM", 1, 100.0, sigtype="z")
kat.IFO.MICH = DOF(kat.IFO, "MICH", kat.IFO.POP_f2, "Q", ["ITMX", "ETMX", "ITMY", "ETMY"], [-0.5,-0.5,0.5,0.5], 100.0, sigtype="z")
kat.IFO.CARM = DOF(kat.IFO, "CARM", kat.IFO.REFL_f1, "I", ["ETMX", "ETMY"], [-1, -1], 1.5, sigtype="z")
if use_RF_DARM_lock:
kat.IFO.DARM = DOF(kat.IFO, "DARM", kat.IFO.AS_f2, "Q", ["ETMX", "ETMY"], [-1,1], 1.0, sigtype="z")
kat.IFO.DARM = DOF(kat.IFO, "DARM", kat.IFO.AS_f2, "Q", ["ETMX", "ETMY"], [-1,1], 1.0, sigtype="z")
else:
kat.IFO.DARM = DOF(kat.IFO, "DARM", kat.IFO.AS_DC, "", ["ETMX", "ETMY"], [-1,1], 1.0, sigtype="z")
kat.IFO.DARM = DOF(kat.IFO, "DARM", kat.IFO.AS_DC, "", ["ETMX", "ETMY"], [-1,1], 1.0, sigtype="z")
kat.IFO.SRCL = DOF(kat.IFO, "SRCL", kat.IFO.REFL_f2, "I", "SRM", -1, 1e2, sigtype="z")
kat.IFO.DARM_h = DOF(kat.IFO, "DARM_h", None, "", ["LY", "LX"], [-1,1], 1.0, sigtype="phase")
......
......@@ -230,11 +230,8 @@ bs2 BSAR2 50u 0 0 29.195 nBSi4 dump15 nSRBS dump16
# Distance from beam splitter to Y arm input mirror
s ly1 5.0126 nYBS nITMY1a
# Thermal lens correction
lens ITMY_therm $TLY_f nITMY1a nITM_th1
s ITMY_th1 0 nITM_th1 nITM_th2
lens ITMY_lens $SLY_f nITM_th2 nITM_th3
s ITMY_th2 0 nITM_th3 nITMY1
lens ITMY_lens $SLY_f nITMY1a nITMY1b
s sITMY_th2 0 nITMY1b nITMY1
# Y arm input mirror
m2 ITMYAR 0 20u 0 nITMY1 nITMYs1
......@@ -262,11 +259,8 @@ attr ITMY mass 40
# Distance from beam splitter to X arm input mirror
s lx1 4.993 nXBS nITMX1a
# Thermal lens correction
lens ITMX_therm $TLX_f nITMX1a nITMX_th1
s ITMX_th1 0 nITMX_th1 nITMX_th2
lens ITMX_lens $SLX_f nITMX_th2 nITMX_th3
s ITMX_th2 0 nITMX_th3 nITMX1
lens ITMX_lens $SLX_f nITMX1a nITMX1b
s sITMX_th2 0 nITMX1b nITMX1
# X arm input mirror
m2 ITMXAR 0 20u 0 nITMX1 nITMXs1
......@@ -338,7 +332,7 @@ dbs FI2 nFI2a nFI2b nFI2c nFI2d
s sFI_OM1 2.9339 nFI2c nOM1a
# OM1
bs1 OM1 800u $Mloss 0 2.251 nOM1a nOM1b dump21 dump22 # T is set for high power; Loss is a guess
bs1 OM1 800u $Mloss 0 2.251 nOM1a nOM1b nOM1c dump22 # T is set for high power; Loss is a guess
attr OM1 Rc 4.6
# Distance OM1 --> OM2
......
......@@ -128,7 +128,7 @@ class BeamParam(object):
if z is None:
z = self.z
else:
z = np.array(z)
z = np.array(z+self.z)
if wavelength is None:
wavelength = self.wavelength
......
......@@ -345,6 +345,12 @@ class Param(putable, putter):
def __rsub__(self, a):
return (a) - self.value
def __truediv__(self, a):
return self.value / (a)
def __itruediv__(self, a):
return self.value / complex(a)
def __div__(self, a):
return self.value / (a)
......
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