本文整理汇总了Python中fullrmc.Globals.LOGGER.error方法的典型用法代码示例。如果您正苦于以下问题:Python LOGGER.error方法的具体用法?Python LOGGER.error怎么用?Python LOGGER.error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fullrmc.Globals.LOGGER
的用法示例。
在下文中一共展示了LOGGER.error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_center
# 需要导入模块: from fullrmc.Globals import LOGGER [as 别名]
# 或者: from fullrmc.Globals.LOGGER import error [as 别名]
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}
示例2: compute_chi_square
# 需要导入模块: from fullrmc.Globals import LOGGER [as 别名]
# 或者: from fullrmc.Globals.LOGGER import error [as 别名]
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)
示例3: set_weighting
# 需要导入模块: from fullrmc.Globals import LOGGER [as 别名]
# 或者: from fullrmc.Globals.LOGGER import error [as 别名]
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
示例4: set_amplitude
# 需要导入模块: from fullrmc.Globals import LOGGER [as 别名]
# 或者: from fullrmc.Globals.LOGGER import error [as 别名]
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)
示例5: set_angle
# 需要导入模块: from fullrmc.Globals import LOGGER [as 别名]
# 或者: from fullrmc.Globals.LOGGER import error [as 别名]
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.)
示例6: set_default_minimum_distance
# 需要导入模块: from fullrmc.Globals import LOGGER [as 别名]
# 或者: from fullrmc.Globals.LOGGER import error [as 别名]
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
示例7: set_axis
# 需要导入模块: from fullrmc.Globals import LOGGER [as 别名]
# 或者: from fullrmc.Globals.LOGGER import error [as 别名]
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
示例8: set_maximum_offset_angle
# 需要导入模块: from fullrmc.Globals import LOGGER [as 别名]
# 或者: from fullrmc.Globals.LOGGER import error [as 别名]
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.)
示例9: set_amplitude
# 需要导入模块: from fullrmc.Globals import LOGGER [as 别名]
# 或者: from fullrmc.Globals.LOGGER import error [as 别名]
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.)
示例10: set_agitate
# 需要导入模块: from fullrmc.Globals import LOGGER [as 别名]
# 或者: from fullrmc.Globals.LOGGER import error [as 别名]
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])
示例11: _runtime_initialize
# 需要导入模块: from fullrmc.Globals import LOGGER [as 别名]
# 或者: from fullrmc.Globals.LOGGER import error [as 别名]
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__()
示例12: set_limits
# 需要导入模块: from fullrmc.Globals import LOGGER [as 别名]
# 或者: from fullrmc.Globals.LOGGER import error [as 别名]
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()
示例13: set_symmetric
# 需要导入模块: from fullrmc.Globals import LOGGER [as 别名]
# 或者: from fullrmc.Globals.LOGGER import error [as 别名]
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
示例14: set_scale_factor
# 需要导入模块: from fullrmc.Globals import LOGGER [as 别名]
# 或者: from fullrmc.Globals.LOGGER import error [as 别名]
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)
示例15: set_generators_parameters
# 需要导入模块: from fullrmc.Globals import LOGGER [as 别名]
# 或者: from fullrmc.Globals.LOGGER import error [as 别名]
def set_generators_parameters(self, generatorsParams):
"""
Set move generators parameters.
#. generatorsParams (None, dict): The automatically created moves generators parameters.
If None is given, default parameters are used. If a dictionary is given, only two keys are allowed.
'TG' key is for TranslationTowardsCenterGenerator parameters and 'RG' key is
for RotationGenerator parameters. TranslationTowardsCenterGenerator amplitude parameter
is not the same for all groups but intelligently allowing certain groups to move more than
others according to damping parameter.
**Parameters are the following:**\n
* TG_amp = generatorsParams['TG']['amplitude']: Used for TranslationTowardsCenterGenerator amplitude parameters.
* TG_ang = generatorsParams['TG']['angle']: Used as TranslationTowardsCenterGenerator angle parameters.
* TG_dam = generatorsParams['TG']['damping']: Also used for TranslationTowardsCenterGenerator amplitude parameters.
* RG_ang = generatorsParams['RG']['amplitude']: Used as RotationGenerator angle parameters.
**Parameters are used as the following:**\n
* TG = TranslationTowardsCenterGenerator(center={"fixed":center}, amplitude=AMPLITUDE, angle=TG_ang)\n
Where TG_amp < AMPLITUDE < TG_amp.TG_dam
* RG = RotationGenerator(amplitude=RG_ang)
* MoveGeneratorCollector(collection=[TG,RG], randomize=True)
**NB: The parameters are not checked for errors until engine runtime.**
"""
if generatorsParams is None:
generatorsParams = {}
assert isinstance(generatorsParams, dict), LOGGER.error("generatorsParams must be a python dictionary")
newGenParams = {"TG":{"amplitude":0.1, "damping":0.1, "angle":90},
"RG":{"amplitude":10}}
# update TranslationTowardsCenterGenerator values
for gkey in newGenParams.keys():
if not generatorsParams.has_key(gkey):
continue
assert isinstance(generatorsParams[gkey], dict), LOGGER.error("generatorsParams value must be a python dictionary")
for key in newGenParams[gkey].keys():
newGenParams[gkey][key] = generatorsParams[gkey].get(key, newGenParams[gkey][key])
# check generatorsParams damping parameters
assert is_number(generatorsParams["TG"]["damping"]), LOGGER.error("generatorsParams['TG']['damping'] must be a number")
generatorsParams["TG"]["damping"] = FLOAT_TYPE(generatorsParams["TG"]["damping"])
assert generatorsParams["TG"]["damping"]>=0, LOGGER.error("generatorsParams['TG']['damping'] must be bigger than 0")
assert generatorsParams["TG"]["damping"]<=1, LOGGER.error("generatorsParams['TG']['damping'] must be smaller than 1")
# set generatorsParams
self.__generatorsParams = newGenParams