def initialize(self, filepath): try: if (not os.path.exists(filepath)): filepath = "../" + filepath xmldoc = minidom.parse(filepath) pNode = xmldoc.childNodes[0] for node in pNode.childNodes: if node.nodeType == node.ELEMENT_NODE: c = Parameter() for node_param in node.childNodes: if (node_param.nodeType == node_param.ELEMENT_NODE): if (node_param.localName == "type"): c.set_type(node_param.firstChild.data) if (node_param.localName == "value"): c.set_value(node_param.firstChild.data) if (node_param.localName == "min_value"): c.set_min_value(node_param.firstChild.data) if (node_param.localName == "max_value"): c.set_max_value(node_param.firstChild.data) if (node_param.localName == "index"): c.set_index(node_param.firstChild.data) if (node_param.localName == "name"): c.set_name(node_param.firstChild.data) if (node_param.localName == "gap"): c.set_gap(node_param.firstChild.data) try: self.assign_parameter(c) self.__numParams += 1 values = 1 + int(round((c.get_max_value() - c.get_min_value()) / c.get_gap())) self.__maxRange = max(values, self.__maxRange) except Exception, e: traceback.print_tb(sys.exc_info()[2]) u.logger.warning("Problem calculating max range: " + str(e)) pass u.logger.debug("Number of parameters " + str(self.__numParams) + "(" + str(len(self.__params)) + ")")