Commit 4547bf69 authored by Andreas Freise's avatar Andreas Freise
Browse files

adding pdtype as variable of the pd object.

parent d7210aa5
......@@ -81,12 +81,13 @@ class Detector(object) :
class pd(Detector):
def __init__(self, name, num_demods, node_name, senstype=None, alternate_beam=False, **kwargs):
def __init__(self, name, num_demods, node_name, senstype=None, alternate_beam=False, pdtype=None, **kwargs):
Detector.__init__(self, name, node_name)
self.__num_demods = num_demods
self.__senstype = senstype
self.__alternate_beam = alternate_beam
self.__pdtype = pdtype
# create the parameters for all 5 demodulations regardless
# of how many the user specifies. Later we add properties to
# those which correspond to the number of demodulations
......@@ -121,6 +122,11 @@ class pd(Detector):
self.__senstype = value
@property
def pdtype(self): return self.__pdtype
@pdtype.setter
def pdtype(self, value): self.__pdtype = value
@property
def num_demods(self): return self.__num_demods
@num_demods.setter
def num_demods(self, value):
......@@ -305,6 +311,9 @@ class photodiode(Detector):
if self.scale != None and self.scale !='':
rtn.append("scale {1} {0}".format(self.name, self.scale))
if self.pdtype != None:
rtn.append("pdtype {1} {0}".format(self.name, self.pdtype))
if self.noplot:
rtn.append("noplot {0}".format(self.name))
......
......@@ -282,6 +282,8 @@ class kat(object):
after_process.append(line)
elif(first == "scale"):
after_process.append(line)
elif(first == "pdtype"):
after_process.append(line)
elif(first == "noxaxis"):
self.noxaxis = True
elif(first == "phase"):
......@@ -339,6 +341,16 @@ class kat(object):
self.scale = SIfloat(v[1])
else:
raise pkex.BasePyKatException("scale command `{0}` is incorrect.".format(text))
elif (first == "pdtype"):
v = line.split(" ")
if len(v) == 3:
component_name = v[1]
if component_name in self.__detectors :
self.__detectors[component_name].type = v[2]
else:
raise pkex.BasePyKatException("pdtype command `{0}` refers to non-existing detector".format(text))
else:
raise pkex.BasePyKatException("pdtype command `{0}` is incorrect.".format(text))
......
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