Skip to content
Snippets Groups Projects
Commit ad7ef75a authored by Daniel Brown's avatar Daniel Brown
Browse files

fixing loss parsing/inputs and fixing rsub on Param and gaussbeam

parent 553f88ea
No related branches found
No related tags found
No related merge requests found
......@@ -159,7 +159,7 @@ class AbstractMirrorComponent(Component):
super(AbstractMirrorComponent, self).__init__(name)
if (L != None and R != None and T != None) and SIfloat(R)+SIfloat(T)+SIfloat(L) != 1:
raise pkex.BasePyKatException('L+R+T must equal 1 if all are specified')
raise pkex.BasePyKatException('L+R+T must equal 1 if all are specified at {0}'.format(self.name))
elif (R != None and L is None and T != None):
L = 1- (SIfloat(R)+SIfloat(T))
elif (R is None and L != None and T != None):
......@@ -320,18 +320,15 @@ class beamSplitter(AbstractMirrorComponent):
if len(values[0])==2:
values.pop(0) # remove initial value
return beamSplitter(values[0], values[5], values[6], values[7], values[8], values[1], values[2], values[3], values[4])
else:
if values[0][2]=="1":
return beamSplitter(values[0], values[5], values[6], values[7], values[8], values[1], values[2], None, values[3], values[4])
elif values[0][2]=="1":
values.pop(0) # remove initial value
return beamSplitter(values[0], values[5], values[6],
values[7], values[8], 1.0 - SIfloat(values[1]) -
SIfloat(values[2]), values[1], values[3], values[4])
values[7], values[8], None, values[1], values[2], values[3], values[4])
else:
values.pop(0) # remove initial value
return beamSplitter(values[0], values[5], values[6],
values[7], values[8], values[1], 1.0 -
SIfloat(values[1]) - SIfloat(values[2]), values[3],
values[7], values[8], values[1], None, values[3],
values[4])
def getFinesseText(self):
......
......@@ -507,11 +507,11 @@ class kat(object):
if component_name in self.__detectors :
self.__detectors[component_name].scale = SIfloat(v[1])
else:
raise pkex.BasePyKatException("scale command `{0}` refers to non-existing output".format(text))
raise pkex.BasePyKatException("scale command `{0}` refers to non-existing output".format(component_name))
elif len(values) == 2:
self.scale = SIfloat(v[1])
else:
raise pkex.BasePyKatException("scale command `{0}` is incorrect.".format(text))
raise pkex.BasePyKatException("scale command `{0}` is incorrect.".format(line))
elif (first == "pdtype"):
v = line.split()
if len(v) == 3:
......@@ -519,9 +519,9 @@ class kat(object):
if component_name in self.__detectors :
self.__detectors[component_name].pdtype = v[2]
else:
raise pkex.BasePyKatException("pdtype command `{0}` refers to non-existing detector".format(text))
raise pkex.BasePyKatException("pdtype command `{0}` refers to non-existing detector".format(component_name))
else:
raise pkex.BasePyKatException("pdtype command `{0}` is incorrect.".format(text))
raise pkex.BasePyKatException("pdtype command `{0}` is incorrect.".format(line))
self.__currentTag = NO_BLOCK
......
......@@ -138,7 +138,8 @@ class Param(putable, putter):
def __isub__(self, a):
return self.value - (a)
__rsub__ = __sub__
def __rsub__(self, a):
return (a) - self.value
def __div__(self, a):
return self.value / (a)
......
......@@ -117,7 +117,8 @@ class gauss_param(object):
self.__q -= complex(a)
return self
__rsub__ = __sub__
def __rsub__(self, a):
return gauss_param(self.__lambda, self.__nr, complex(a) - self.__q)
def __div__(self, a):
return gauss_param(self.__lambda, self.__nr, self.__q / complex(a))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment