Пример #1
0
    def setValue(self, value=''):
        '''
        Sets the value for a parameter!
        
        The behaviour of this function is dependent on the parameter.isComplex switch
        If isComplex is true all values need to be converted to zeroComplex. 
        If isComplex is false value should only have a real part 
        '''

        # Do this if NO complex values are wanted
        if not parameter.isComplex:
            if type(value) == complex or type(value) == zeroComplex:
                self["value"] = value.real
            else:
                self["value"] = value

        # Do this if complex values are wanted
        else:
            try:
                self["value"] = zeroComplex(value)
            except ValueError:
                self.log.error(
                    "VAMPzero Complex: Could not transfer the value for %s to zeroComplex Type. Value is: %s" % (
                        self.longName, str(value)))

        return self["value"]
Пример #2
0
    def setValue(self, value=''):
        '''
        Sets the value for a parameter!
        
        The behaviour of this function is dependent on the parameter.isComplex switch
        If isComplex is true all values need to be converted to zeroComplex. 
        If isComplex is false value should only have a real part 
        '''

        # Do this if NO complex values are wanted
        if not parameter.isComplex:
            if type(value) == complex or type(value) == zeroComplex:
                self["value"] = value.real
            else:
                self["value"] = value

        # Do this if complex values are wanted
        else:
            try:
                self["value"] = zeroComplex(value)
            except ValueError:
                self.log.error(
                    "VAMPzero Complex: Could not transfer the value for %s to zeroComplex Type. Value is: %s"
                    % (self.longName, str(value)))

        return self["value"]
Пример #3
0
 def complexify(self):
     '''
     Tries to convert the own value to a zeroComplex value
     is necessary for the complex-step calculation of the sensitivities
     '''
     try:
         self["value"] = zeroComplex(self["value"])
         parameter.isComplex = True
     except ValueError:
         self.log.debug("VAMPzero COMPLEX: could not convert %s to zeroComplex, value is: %s" % (
             self.longName, str(self["value"])))
         return False
Пример #4
0
 def complexify(self):
     '''
     Tries to convert the own value to a zeroComplex value
     is necessary for the complex-step calculation of the sensitivities
     '''
     try:
         self["value"] = zeroComplex(self["value"])
         parameter.isComplex = True
     except ValueError:
         self.log.debug(
             "VAMPzero COMPLEX: could not convert %s to zeroComplex, value is: %s"
             % (self.longName, str(self["value"])))
         return False