当前位置: 首页>>代码示例>>Python>>正文


Python Globals.LOGGER类代码示例

本文整理汇总了Python中fullrmc.Globals.LOGGER的典型用法代码示例。如果您正苦于以下问题:Python LOGGER类的具体用法?Python LOGGER怎么用?Python LOGGER使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了LOGGER类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: compute_chi_square

 def compute_chi_square(self, data):
     """ 
     Compute the chi square of data not satisfying constraint conditions. 
     
     :Parameters:
         #. data (numpy.array): The constraint value data to compute chiSquare.
         
     :Returns:
         #. chiSquare (number): The calculated chiSquare multiplied by the contribution factor of the constraint.
     """
     # compute difference
     chiSquare = 0.0
     number = 0
     for k, val in data.items():
         if val < PRECISION:
             continue
         number += 1
         el1, el2 = k.split("intermd_")[1].split("-")
         dist = self.__pairsDistance[el1][el2]
         diff = dist-val
         assert diff>0 , LOGGER.error("difference must be positive. %.6f is found for val:%.6f and minimumDistance: %.6f. Try recomputing constraint data using 'compute_data' method"%(diff, val, dist))
         assert diff<=dist, LOGGER.error("difference must be smaller than minimum distance. %.6f is found for val:%.6f and minimumDistance: %.6f .Try recomputing constraint data using 'compute_data' method"%(diff, val, dist))
         # normalize to make it between 0 and 1
         chiSquare += (diff/dist)**2
     # normalize
     #if number:
     #    chiSquare /= number
     return FLOAT_TYPE(chiSquare)
开发者ID:youssefaoun,项目名称:fullrmc,代码行数:28,代码来源:DistanceConstraints.py

示例2: set_center

 def set_center(self, center):
     """
     Sets center value.
     
     :Parameters:
        #. center (dict): The center value dictionary. Must have a single key and this can only be 'fixed' or 'indexes'.
           If key is fixed, value must be a list or a numpy.array of a point coordinates such as [X,Y,Z]
           If key is indexes, value must be a list or a numpy array of indexes.
     """
     assert isinstance(center, dict), LOGGER.error("center must be a dictionary")
     assert len(center) == 1, LOGGER.error("center must have a single key")       
     key = center.keys()[0]
     val = center[key]
     assert isinstance(val, (list,set,tuple,np.ndarray)), LOGGER.error("center value must be a list")
     if isinstance(val, np.ndarray):
         assert len(val.shape) == 1, LOGGER.error("center value must have a single dimension")
     assert len(val)>0, LOGGER.error("center value must be a non-zero list.")
     for v in val:
         assert is_number(v), LOGGER.error("center value item must be numbers") 
     if key == "fixed":
         self.__mustCompute = False
         assert len(val) == 3, LOGGER.error("fixed center must have exactly 3 elements corresponding to X,Y and Z coordinates of the center point.")
         val = np.array([FLOAT_TYPE(v) for v in val], dtype=FLOAT_TYPE)
     elif key == "indexes":
         self.__mustCompute = True
         for v in val:
             assert is_integer(v), LOGGER.error("indexes center items be integers")
         val =  np.array([INT_TYPE(v) for v in val], dtype=INT_TYPE)
         for v in val:
             assert v>=0, LOGGER.error("indexes center items be positive integers")            
     else:
         self.__mustCompute = None
         raise Exception(LOGGER.error("center key must be either 'fixed' or 'indexes'"))        
     # set center
     self.__center = {key:val}
开发者ID:youssefaoun,项目名称:fullrmc,代码行数:35,代码来源:Translations.py

示例3: set_weighting

 def set_weighting(self, weighting):
     """
     Sets elements weighting. It must a valid entry of pdbParser atoms database
     
     :Parameters:
         #. weighting (string): The elements weighting.
     """
     assert is_element_property(weighting),LOGGER.error( "weighting is not a valid pdbParser atoms database entry")
     assert weighting != "atomicFormFactor", LOGGER.error("atomicFormFactor weighting is not allowed")
     self.__weighting = weighting
开发者ID:youssefaoun,项目名称:fullrmc,代码行数:10,代码来源:PairDistributionConstraints.py

示例4: set_angle

 def set_angle(self, angle):
     """
     Sets the tolerance maximum angle.
     
     :Parameters:
         #. angle (number): The maximum tolerance angle in degrees between a generated translation vector and the pre-defined axis.        
     """
     assert is_number(angle), LOGGER.error("angle must be numbers")
     assert angle>0, LOGGER.error("angle must be positive")
     assert angle<=360, LOGGER.error("angle must be smaller than 360")
     self.__angle = FLOAT_TYPE(angle)*PI/FLOAT_TYPE(180.)
开发者ID:youssefaoun,项目名称:fullrmc,代码行数:11,代码来源:Translations.py

示例5: set_amplitude

 def set_amplitude(self, amplitude):
     """
     Sets maximum translation vector allowed amplitude.
     
     :Parameters:
         #. amplitude (number): the maximum allowed translation vector amplitude.
     """
     assert is_number(amplitude), LOGGER.error("Translation amplitude must be a number")
     amplitude = float(amplitude)
     assert amplitude>0, LOGGER.error("Translation amplitude must be bigger than 0")
     self.__amplitude = FLOAT_TYPE(amplitude)
开发者ID:youssefaoun,项目名称:fullrmc,代码行数:11,代码来源:Agitations.py

示例6: set_default_minimum_distance

 def set_default_minimum_distance(self, defaultMinDistance):
     """ 
     Sets the default intermolecular minimum distance. 
     
     :Parameters:
         #. defaultMinDistance (number): The default minimum distance.
     """
     assert is_number(defaultMinDistance), LOGGER.error("defaultMinDistance must be a number")
     defaultMinDistance = FLOAT_TYPE(defaultMinDistance)
     assert defaultMinDistance>=0, LOGGER.error("defaultMinDistance must be positive")
     self.__defaultMinDistance = defaultMinDistance
开发者ID:youssefaoun,项目名称:fullrmc,代码行数:11,代码来源:DistanceConstraints.py

示例7: get_constraint_original_value

 def get_constraint_original_value(self):
     """
     Compute all partial Pair Distribution Functions (PDFs). 
     
     :Returns:
         #. PDFs (dictionary): The PDFs dictionnary, where keys are the element wise intra and inter molecular PDFs and values are the computed PDFs.
     """
     if self.originalData is None:
         LOGGER.warn("originalData must be computed first using 'compute_data' method.")
         return {}
     return self._get_constraint_value(self.originalData)
开发者ID:youssefaoun,项目名称:fullrmc,代码行数:11,代码来源:PairDistributionConstraints.py

示例8: set_maximum_offset_angle

 def set_maximum_offset_angle(self, maximumOffsetAngle):
     """
     Sets the maximum offset angle allowed.
     
     :Parameters:
         #. maximumOffsetAngle (number): The maximum offset angle in degrees between groupAxis and orientationAxis in degrees.
     """
     assert is_number(maximumOffsetAngle), LOGGER.error("maximumOffsetAngle must be a number")
     maximumOffsetAngle = float(maximumOffsetAngle)
     assert maximumOffsetAngle>0, LOGGER.error("maximumOffsetAngle must be bigger than 0 deg.")
     assert maximumOffsetAngle<180, LOGGER.error("maximumOffsetAngle must be smaller than 180 deg.")
     # convert to radian and store amplitude
     self.__maximumOffsetAngle = FLOAT_TYPE(PI*maximumOffsetAngle/180.)
开发者ID:youssefaoun,项目名称:fullrmc,代码行数:13,代码来源:Rotations.py

示例9: set_axis

 def set_axis(self, axis):
     """
     Sets the symmetry axis index to translate along.
     
     :Parameters:
         #. axis (integer): Must be 0,1 or 2 for respectively the main, secondary or tertiary symmetry axis
     """
     assert is_integer(axis), LOGGER.error("rotation symmetry axis must be an integer.")
     axis = INT_TYPE(axis)
     assert axis>=0, LOGGER.error("rotation symmetry axis must be positive.")
     assert axis<=2, LOGGER.error("rotation symmetry axis must be smaller or equal to 2.")
     # convert to radian and store amplitude
     self.__axis = axis
开发者ID:youssefaoun,项目名称:fullrmc,代码行数:13,代码来源:Translations.py

示例10: set_amplitude

 def set_amplitude(self, amplitude):
     """
     Sets maximum rotation angle in degrees and transforms it to rad.
     
     :Parameters:
         #. amplitude (number): the maximum allowed rotation angle in degrees.
            It must be strictly bigger than 0 and strictly smaller than 360.
     """
     assert is_number(amplitude), LOGGER.error("rotation amplitude must be a number")
     amplitude = float(amplitude)
     assert amplitude>0, LOGGER.error("rotation amplitude must be bigger than 0 deg.")
     assert amplitude<360, LOGGER.error("rotation amplitude must be smaller than 360 deg.")
     # convert to radian and store amplitude
     self.__amplitude = FLOAT_TYPE(PI*amplitude/180.)
开发者ID:youssefaoun,项目名称:fullrmc,代码行数:14,代码来源:Rotations.py

示例11: set_agitate

 def set_agitate(self, agitate):
     """
     Sets agitate tuple value.
     
     :Parameters:
         #. agitate (tuple): It's a tuple of two boolean values, at least one of them must be True.
            Whether to agitate the first atom, the second or both. This is useful to set an atom fixed while only 
            the other succumb the agitation to adjust the distance. For instance in a C-H group it can be useful and 
            logical to adjust the bond length by moving only the hydrogen atom along the bond direction.
     """
     assert isinstance(agitate, (list,tuple)), LOGGER.error("agitate must be a list or a tuple")
     assert len(agitate)==2, LOGGER.error("agitate must have 2 items")
     assert [isinstance(a,bool) for a in agitate]==[True,True], LOGGER.error("agitate items must be boolean")
     assert agitate[0] or agitate[1], LOGGER.error("agitate both items can't be False")
     self.__agitate = (agitate[0], agitate[1])     
开发者ID:youssefaoun,项目名称:fullrmc,代码行数:15,代码来源:Agitations.py

示例12: _runtime_initialize

 def _runtime_initialize(self):
     """   
     Automatically sets the selector order at the engine runtime.
     """
     assert self.engine is not None, LOGGER.error("engine must be set prior to calling _runtime_initialize")
     if self.__order is None:
         self.__order = np.array(range(len(self.engine.groups)), dtype=INT_TYPE)
         self.__initialize_selector__()
开发者ID:youssefaoun,项目名称:fullrmc,代码行数:8,代码来源:OrderedSelectors.py

示例13: set_limits

 def set_limits(self, limits):
     """
     Set the histogram computation limits.
     
     :Parameters:
         #. limits (None, tuple, list): The distance limits to compute the histograms and compute with the experimental data.
            If None, the limits will be automatically set the the min and max distance recorded in the experimental data.
            If not None, a tuple of minimum distance or None and maximum distance or None should be given.    
     """
     if limits is None:
         self.__limits = (None, None)
     else:
         assert isinstance(limits, (list, tuple)), LOGGER.error("limits must be None or a list")
         limits = list(limits)
         assert len(limits) == 2, LOGGER.error("limits list must have exactly two elements")
         if limits[0] is not None:
             assert is_number(limits[0]), LOGGER.error("if not None, the first limits element must be a number")
             limits[0] = FLOAT_TYPE(limits[0])
             assert is_number(limits[0]), LOGGER.error("if not None, the first limits element must be a positive number")
         if limits[1] is not None:
             assert is_number(limits[1]), LOGGER.error("if not None, the second limits element must be a number")
             limits[1] = FLOAT_TYPE(limits[1])
             assert is_number(limits[1]), LOGGER.error("if not None, the second limits element must be a positive number")
         if  limits[0] is not None and limits[1] is not None:
             assert limits[0]<limits[1], LOGGER.error("if not None, the first limits element must be smaller than the second limits element")
         self.__limits = (limits[0], limits[1])
     # get minimumDistance and maximumDistance indexes
     if self.__limits[0] is None:
         minDistIdx = 0
     else:
         minDistIdx = (np.abs(self.experimentalData[:,0]-self.__limits[0])).argmin()
     if self.__limits[1] is None:
         maxDistIdx = -1
     else:
         maxDistIdx =(np.abs(self.experimentalData[:,0]-self.__limits[1])).argmin()
     # set minimumDistance and maximumDistance 
     self.__minimumDistance = FLOAT_TYPE(self.experimentalData[minDistIdx,0] - self.__bin/2. )
     self.__maximumDistance = FLOAT_TYPE(self.experimentalData[maxDistIdx,0] + self.__bin/2. )
     # get histogram size    
     self.__histogramSize = INT_TYPE((self.__maximumDistance-self.__minimumDistance)/self.__bin)
     # get histogram edges
     self.__edges         = np.array([self.__minimumDistance+idx*self.__bin for idx in xrange(self.__histogramSize+1)], dtype=FLOAT_TYPE)       
     self.__shellsCenter  = (self.__edges[1:]+self.__edges[0:-1])/FLOAT_TYPE(2.)
     self.__shellsVolumes = FLOAT_TYPE(4.0)*PI*self.__shellsCenter*self.__shellsCenter*self.__bin 
     # set limits indexes for range
     if (minDistIdx == -1) or (minDistIdx == self.experimentalData.shape[0]):
         minDistIdx = self.experimentalData.shape[0]
     if (maxDistIdx == -1) or (maxDistIdx == self.experimentalData.shape[0]):
         maxDistIdx = self.experimentalData.shape[0]
     self.__experimentalDistances = self.experimentalData[minDistIdx:maxDistIdx+1,0]
     self.__experimentalPDF       = self.experimentalData[minDistIdx:maxDistIdx+1,1] 
     # check distances and shells
     for diff in self.__shellsCenter-self.__experimentalDistances:
         assert abs(diff)<=PRECISION, LOGGER.error("experimental data distances are not coherent")
     # reset constraint
     self.reset_constraint()
开发者ID:youssefaoun,项目名称:fullrmc,代码行数:56,代码来源:PairDistributionConstraints.py

示例14: set_symmetric

 def set_symmetric(self, symmetric):
     """
     Sets symmetric flag value.
     
     :Parameters:
         #. symmetric (bool): Whether to apply the same amplitude of translation on both atoms or not.         
     """
     assert isinstance(symmetric, bool), LOGGER.error("symmetric must be boolean")
     self.__symmetric = symmetric
开发者ID:youssefaoun,项目名称:fullrmc,代码行数:9,代码来源:Agitations.py

示例15: set_scale_factor

 def set_scale_factor(self, scaleFactor):
     """
     Sets the scale factor.
     
     :Parameters:
          #. scaleFactor (string): A normalization scale factor used to normalize the computed data to the experimental ones.
     """
     assert is_number(scaleFactor), LOGGER.error("scaleFactor must be a number")
     self.__scaleFactor = FLOAT_TYPE(scaleFactor)
开发者ID:youssefaoun,项目名称:fullrmc,代码行数:9,代码来源:PairDistributionConstraints.py


注:本文中的fullrmc.Globals.LOGGER类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。