Commit 8134ae9e authored by Daniel Brown's avatar Daniel Brown
Browse files

fixing senstype error for qshot, altering parseCommands so that commands can...

fixing senstype error for qshot, altering parseCommands so that commands can be parsed into a particular block
parent 5acb7b08
...@@ -729,7 +729,7 @@ class qnoised(pd): ...@@ -729,7 +729,7 @@ class qnoised(pd):
class qshot(pd): class qshot(pd):
def __init__(self, name, num_demods, node_name, alternate_beam=False, **kwargs): def __init__(self, name, num_demods, node_name, alternate_beam=False, **kwargs):
super(qshot, self).__init__(name, num_demods, node_name, alternate_beam=alternate_beam, pdtype=None, senstype=None, **kwargs) super(qshot, self).__init__(name, num_demods, node_name, alternate_beam=alternate_beam, pdtype=None, **kwargs)
@pd.pdtype.setter @pd.pdtype.setter
def pdtype(self, value): def pdtype(self, value):
......
...@@ -689,8 +689,16 @@ class kat(object): ...@@ -689,8 +689,16 @@ class kat(object):
del self.__blocks[name] del self.__blocks[name]
def parseCommands(self, commands, blocks=None): def parseCommands(self, commands, blocks=None, addToBlock=None):
try: try:
if addToBlock is not None and blocks is not None:
raise pkex.BasePyKatException("When parsing commands you cannot set both blocks and addToBlock arguments")
# Create a new block if one asked for isn't present
if addToBlock is not None:
if addToBlock not in self.__blocks:
self.__blocks[addToBlock] = Block(addToBlock)
blockComment = False blockComment = False
commands=self.remove_comments(commands) commands=self.remove_comments(commands)
...@@ -706,24 +714,27 @@ class kat(object): ...@@ -706,24 +714,27 @@ class kat(object):
# Looking for block start or end # Looking for block start or end
values = line.split() values = line.split()
if values[0] == "%%%":
if values[1] == "FTblock":
newTag = values[2]
if self.__currentTag != None and self.__currentTag != NO_BLOCK: if addToBlock is None:
warnings.warn("found block {0} before block {1} ended".format(newTag, self.__currentTag)) if values[0] == "%%%":
if values[1] == "FTblock":
newTag = values[2]
if self.__currentTag != None and self.__currentTag != NO_BLOCK:
warnings.warn("found block {0} before block {1} ended".format(newTag, self.__currentTag))
if newTag in self.__blocks: if newTag in self.__blocks:
raise pkex.BasePyKatException("Block `{0}` has already been read".format(newTag)) raise pkex.BasePyKatException("Block `{0}` has already been read".format(newTag))
self.__blocks[newTag] = Block(newTag) # create new list to store all references to components in block self.__blocks[newTag] = Block(newTag) # create new list to store all references to components in block
self.__currentTag = newTag self.__currentTag = newTag
if values[1] == "FTend": if values[1] == "FTend":
self.__currentTag = NO_BLOCK self.__currentTag = NO_BLOCK
continue continue
else:
self.__currentTag = addToBlock
# only include listed blocks, if we have specfied them # only include listed blocks, if we have specfied them
if blocks != None and self.__currentTag not in blocks: if blocks != None and self.__currentTag not in blocks:
...@@ -775,6 +786,7 @@ class kat(object): ...@@ -775,6 +786,7 @@ class kat(object):
elif(first == "qnoised" or first == "qnoisedS" or first == "qnoisedN"): elif(first == "qnoised" or first == "qnoisedS" or first == "qnoisedN"):
obj = pykat.detectors.qnoised.parseFinesseText(line) obj = pykat.detectors.qnoised.parseFinesseText(line)
elif(first == "xaxis" or first == "xaxis*"): elif(first == "xaxis" or first == "xaxis*"):
self.noxaxis = False
obj = pykat.commands.xaxis.parseFinesseText(line) obj = pykat.commands.xaxis.parseFinesseText(line)
elif(first[0:2] == "hd"): elif(first[0:2] == "hd"):
obj = pykat.detectors.hd.parseFinesseText(line) obj = pykat.detectors.hd.parseFinesseText(line)
......
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