示例#1
0
    def getval(self):
        """Calculates the value from the data supplied in the xml file.

        Either reads the string from the input file as an array of numbers,
        or as a string specifying either a file name or a single value.
        """

        value = super(InputInitBase, self).fetch()
        if self.mode.fetch() == "manual":
            if "[" in value and "]" in value:  # value appears to be a list
                if self._storageclass is float:
                    value = io_xml.read_array(np.float, value)
                else:
                    value = io_xml.read_list(value)
            else:
                value = io_xml.read_type(self._storageclass, value)
        else:
            value = str(value)  # typically this will be a no-op
        return value
示例#2
0
    def getval(self):
        """Calculates the value from the data supplied in the xml file.

        Either reads the string from the input file as an array of numbers,
        or as a string specifying either a file name or a single value.
        """

        value = super(InputInitBase, self).fetch()
        if self.mode.fetch() == "manual":
            if '[' in value and ']' in value:  # value appears to be a list
                if self._storageclass is float:
                    value = io_xml.read_array(np.float, value)
                else:
                    value = io_xml.read_list(value)
            else:
                value = io_xml.read_type(self._storageclass, value)
        else:
            value = str(value)  # typically this will be a no-op
        return value