Commit 079b10b9 authored by Andreas Freise's avatar Andreas Freise
Browse files

still trying pds.

parent c87e25eb
......@@ -51,21 +51,26 @@ class Detector(object) :
class photodiode(Detector):
class f(list):
class F:
def __init__(self, values=None):
print "tadaaaaaaaaaaaaaaa"
if values is None:
self.values = []
else:
self.values = values
def __getitem__(self,key):
def __len__(self):
return len(self.values)
def __getitem__(self, key):
# if key is of invalid type or value, the list values will raise the error
return self.values[key]
def __setitem__(self,key,value):
def __setitem__(self, key, value):
print "setting"
self.values[key] = SIfloat(value)
class phi(list):
class Phi():
def __init__(self, values=None):
print values
if values is None:
......@@ -85,8 +90,14 @@ class photodiode(Detector):
self.values[key] = value
else:
self.values[key] = SIfloat(value)
def append(self, value):
self.values.append(value)
@property
def f(self): return self.F('f', self.__f)
@f.setter
def f(self, key, value): self.__f[key]=value
def __init__(self, name, node, senstype=None, num_demods=0, demods=[]):
Detector.__init__(self, name, node)
if num_demods>2:
......@@ -94,14 +105,17 @@ class photodiode(Detector):
self.num_demods = num_demods
self.senstype = senstype
# every second element into f (starting at 1)
self.f(demods[::2])
# every second element into phi (starting at 2)
self.phi([1,2])
self.__f = self.F(demods[::2])
# Every second element into phi (starting at 2)
self.__phi = self.Phi()
for i in demods[1::2]:
self.phi.append(i)
self.__phi.append(i)
print self.__phi
print self.__phi[0]
@staticmethod
def parseFinesseText(text):
values = text.split(" ")
......
......@@ -138,14 +138,14 @@ class kat(object):
def parseCommands(self, commands):
blockComment = False
self.__currentTag= NO_BLOCK
if not (NO_BLOCK in self.__blocks):
self.__blocks[NO_BLOCK] = Block(NO_BLOCK)
commands=self.remove_comments(commands)
for line in commands.split("\n"):
#for line in commands:
if len(line.strip()) >= 2:
......@@ -193,14 +193,16 @@ class kat(object):
obj = pykat.components.space.parseFinesseText(line)
elif(first == "l"):
obj = pykat.components.laser.parseFinesseText(line)
elif(first == "xaxis" or first == "x2axis" or first == "xaxis*" or first == "x2axis*"):
obj = pykat.commands.xaxis.parseFinesseText(line)
elif(first[0:2] == "pd"):
obj = pykat.detectors.photodiode.parseFinesseText(line)
elif(first == "xaxis" or first == "x2axis" or first == "xaxis*" or first == "x2axis*"):
obj = pykat.commands.xaxis.parseFinesseText(line)
else:
print "Parsing `{0}` into pykat object not implemented yet, added as extra line.".format(line)
obj = line
# manually add the line to the block contents
self.__blocks[self.__currentTag].contents.append(line)
print obj
if not isinstance(obj, str):
self.add(obj)
......
Supports Markdown
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