def find_protocol_file_xml_tree(self, filename=None):
        """

        """
        if filename is None:
            filename = toolbox_basic.find_protocol_file_path(self.path)
        self.protocol_file_xml_tree = toolbox_basic.get_xml_tree(filename)
Esempio n. 2
0
 def __init__(self, root_dir, find_protocol=True):
     self.root_dir = toolbox_basic.check_path(root_dir)
     if not find_protocol: return
     # Set up the space from the protocol file.
     protocol_path = toolbox_basic.find_protocol_file_path(self.root_dir)
     self.protocol_tree = toolbox_basic.get_xml_tree(protocol_path)
     space_params = self.protocol_tree.findall('./space/param')
     for param in space_params:
         name, text = param.attrib['name'], param.text
         if name == 'wrapping': self.wrapping = (text == 'true')
         elif name == 'length': self.side_length = int(float(text))
         elif name == 'nDims':  self.is_3d = (int(float(text)) == 3)
     marks = self.protocol_tree.findall('./mark')
     for mark in marks:
         for param in mark:
             if param.attrib['name'] == 'value':
                 value = int(param.text)
             if param.attrib['name'] == 'number':
                 number = int(param.text)
         if value == 2:
             self.consumers = number
         else:
             self.producers = number
     rs = self.protocol_tree.find("./process/param[@name='randomSeed']")
     self.random_seed = int(rs.text)