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


Python logger.info方法代码示例

本文整理汇总了Python中logger.info方法的典型用法代码示例。如果您正苦于以下问题:Python logger.info方法的具体用法?Python logger.info怎么用?Python logger.info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在logger的用法示例。


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

示例1: add_point

# 需要导入模块: import logger [as 别名]
# 或者: from logger import info [as 别名]
def add_point(self,x,y,z):
    """
    Add point object to model, if the name already exists, an exception will be raised.
    if a point in same location exists, the name of the point will be returned.
    
    param:
        x,y,z: float-like, coordinates in SI.
        [name]: str, name, optional.
    return:
        str, the new point's name.
    """
    try:
        pt=Point()
        pt.x=x
        pt.y=y
        pt.z=z
        pt.uuid=str(uuid.uuid1())
        pt.name=pt.uuid
        self.session.add(pt)
        return pt.name
    except Exception as e:
        logger.info(str(e))
        self.session.rollback()
        return False 
开发者ID:zhuoju36,项目名称:StructEngPy,代码行数:26,代码来源:point.py

示例2: set_point_coordinate

# 需要导入模块: import logger [as 别名]
# 或者: from logger import info [as 别名]
def set_point_coordinate(self,name,x,y,z):
    """
    Set point coordinate.
    if a point in same location exists, the name of the point will be returned.
            
    param:
        x,y,z: float-like, coordinates in current unit.
        [name]: str, name, optional.
    return:
        str, the new point's name.
    """
    try:
        pt=self.session.query(Point).filter_by(name=name).first()
        if pt is None:
            raise Exception("Point doesn't exists.")
        scale=self.scale()
        pt.x=x*scale['L']
        pt.y=y*scale['L']
        pt.z=z*scale['L']
        self.session.add(pt)
        return True
    except Exception as e:
        logger.info(str(e))
        self.session.rollback()
        return False 
开发者ID:zhuoju36,项目名称:StructEngPy,代码行数:27,代码来源:point.py

示例3: get_point_coordinate

# 需要导入模块: import logger [as 别名]
# 或者: from logger import info [as 别名]
def get_point_coordinate(self,name):
    """
    Get point coordinate.
            
    param:
        name: str, name, optional.
    return:
        status of success, and tuple of point's coordinate if or None if failed.
    """
    try:
        pt=self.session.query(Point).filter_by(name=name).first()
        if pt is None:
            raise Exception("Point doesn't exists.")
        scale=self.scale()
        x=pt.x/scale['L']
        y=pt.y/scale['L']
        z=pt.z/scale['L']
        return x,y,z
    except Exception as e:
        logger.info(str(e))
        self.session.rollback()
        return None 
开发者ID:zhuoju36,项目名称:StructEngPy,代码行数:24,代码来源:point.py

示例4: add_material_quick

# 需要导入模块: import logger [as 别名]
# 或者: from logger import info [as 别名]
def add_material_quick(self,code):
    """
    Add material to model with code, if the name already exists, an exception will be raised

    param:
        category: str, concrete, steel, wood or alumium
        code: str, code of material.
    return:
        boolean, status of success.
    """
    try:
        if code=='Q345':
            self.add_material(name=code,rho=7850,mat_type='isoelastic',E=2.06e11,mu=0.3)
    except Exception as e:
        logger.info(str(e))
        self.session.rollback()
        return False 
开发者ID:zhuoju36,项目名称:StructEngPy,代码行数:19,代码来源:material.py

示例5: set_project_name

# 需要导入模块: import logger [as 别名]
# 或者: from logger import info [as 别名]
def set_project_name(self,name):
    """
    params:
        name: str, project name, no more than 32 chars
    return:
        status of success.
    """
    try:
        assert(type(name)==str and len(name)<32)
        config=self.session.query(Config).first()
        config.project_name=name
        self.session.add(config)
        return True
    except Exception as e:
        logger.info(str(e))
        self.session.rollback()
        return False 
开发者ID:zhuoju36,项目名称:StructEngPy,代码行数:19,代码来源:project.py

示例6: set_author

# 需要导入模块: import logger [as 别名]
# 或者: from logger import info [as 别名]
def set_author(self,author):
    """
    params:
        author: str, project name, no more than 32 chars
    return:
        status of success.
    """
    try:
        assert(type(author)==str and len(author)<32)
        config=self.session.query(Config).first()
        config.author=author
        self.session.add(config)
        return True
    except Exception as e:
        logger.info(str(e))
        self.session.rollback()
        return False 
开发者ID:zhuoju36,项目名称:StructEngPy,代码行数:19,代码来源:project.py

示例7: set_unit

# 需要导入模块: import logger [as 别名]
# 或者: from logger import info [as 别名]
def set_unit(self,unit):
    """
    params:
        unit: str, should be 'N_m_C','N_mm_C','kN_m_C' or 'kN_mm_C'
    return:
        status of success.
    """
    try:
        assert(unit in ['N_m_C','N_mm_C','kN_m_C','kN_mm_C'])
        config=self.session.query(Config).first()
        config.unit=unit
        self.session.add(config)
        return True
    except Exception as e:
        logger.info(str(e))
        self.session.rollback()
        return False 
开发者ID:zhuoju36,项目名称:StructEngPy,代码行数:19,代码来源:project.py

示例8: set_description

# 需要导入模块: import logger [as 别名]
# 或者: from logger import info [as 别名]
def set_description(self,text):
    """
    params:
        text: str, description.
    return:
        status of success.
    """
    try:
        assert(type(text)==str)
        config=self.session.query(Config).first()
        config.description=text
        self.session.add(config)
        return True
    except Exception as e:
        logger.info(str(e))
        self.session.rollback()
        return False 
开发者ID:zhuoju36,项目名称:StructEngPy,代码行数:19,代码来源:project.py

示例9: set_frame_section

# 需要导入模块: import logger [as 别名]
# 或者: from logger import info [as 别名]
def set_frame_section(self,frame,section):
    """
    Assign a frame section to a frame.
    
    params:
        frame: str, name of frame.
        section: str, name of section.
    """
    try:
        frm=self.session.query(Frame).filter_by(name=frame).first()
        if frm is None:
            raise Exception("Frame doesn't exists.")
        frm.section_name=section
        self.session.add(frm)
        return True
    except Exception as e:
        logger.info(str(e))
        self.session.rollback()
        return False 
开发者ID:zhuoju36,项目名称:StructEngPy,代码行数:21,代码来源:frame.py

示例10: set_frame_load_temperature

# 需要导入模块: import logger [as 别名]
# 或者: from logger import info [as 别名]
def set_frame_load_temperature(self,frame,loadcase,temperature):
    """
    params:
        frame: str, name of frame.
        loadcase: str, name of loadcase. 
        temperature: float, temperature in 1-1 axis.
    return:
        status of success.
    """
    try:
        frm=self.session.query(Frame).filter_by(name=frame).first()
        if frm is None:
            raise Exception("Frame doesn't exists.")
        ld=self.session.query(FrameLoadTemperature).filter_by(frame_name=frame,loadcase_name=loadcase).first()
        if ld is None:
            ld=FrameLoadTemperature()
        ld.frame_name=frame
        ld.loadcase_name=loadcase
        ld.T=temperature
        self.session.add(ld)
        return True
    except Exception as e:
        logger.info(str(e))
        self.session.rollback()
        return False 
开发者ID:zhuoju36,项目名称:StructEngPy,代码行数:27,代码来源:frame.py

示例11: get_frame_end_names

# 需要导入模块: import logger [as 别名]
# 或者: from logger import info [as 别名]
def get_frame_end_names(self,frame):
    """
    params:
        frame: str, name of frame.
    return:
        two point names as frames start and end if successful or None if failed
    """
    try:
        frm=self.session.query(Frame).filter_by(name=frame).first()
        if frm is None:
            raise Exception("Frame doesn't exists.")
        return frm.pt0.name,frm.pt1.name
    except Exception as e:
        logger.info(str(e))
        self.session.rollback()
        return None 
开发者ID:zhuoju36,项目名称:StructEngPy,代码行数:18,代码来源:frame.py

示例12: solve_modal

# 需要导入模块: import logger [as 别名]
# 或者: from logger import info [as 别名]
def solve_modal(model,k:int):
    """
    Solve eigen mode of the MDOF system
    
    params:
        model: FEModel.
        k: number of modes to extract.
    """
    K_,M_=model.K_,model.M_
    if k>model.DOF:
        logger.info('Warning: the modal number to extract is larger than the system DOFs, only %d modes are available'%model.DOF)
        k=model.DOF
    omega2s,modes = sl.eigsh(K_,k,M_,sigma=0,which='LM')
    delta = modes/np.sum(modes,axis=0)
    model.is_solved=True
    model.mode_=delta
    model.omega_=np.sqrt(omega2s).reshape((k,1)) 
开发者ID:zhuoju36,项目名称:StructEngPy,代码行数:19,代码来源:dynamic.py

示例13: setup_param_noise

# 需要导入模块: import logger [as 别名]
# 或者: from logger import info [as 别名]
def setup_param_noise(self, normalized_obs0):
        assert self.param_noise is not None

        # Configure perturbed actor.
        param_noise_actor = copy(self.actor)
        param_noise_actor.name = 'param_noise_actor'
        self.perturbed_actor_tf = param_noise_actor(normalized_obs0)
        logger.info('setting up param noise')
        self.perturb_policy_ops = get_perturbed_actor_updates(self.actor, param_noise_actor, self.param_noise_stddev)

        # Configure separate copy for stddev adoption.
        adaptive_param_noise_actor = copy(self.actor)
        adaptive_param_noise_actor.name = 'adaptive_param_noise_actor'
        adaptive_actor_tf = adaptive_param_noise_actor(normalized_obs0)
        self.perturb_adaptive_policy_ops = get_perturbed_actor_updates(self.actor, adaptive_param_noise_actor, self.param_noise_stddev)
        self.adaptive_policy_distance = tf.sqrt(tf.reduce_mean(tf.square(self.actor_tf - adaptive_actor_tf))) 
开发者ID:quantumiracle,项目名称:Reinforcement_Learning_for_Traffic_Light_Control,代码行数:18,代码来源:ddpg_learner.py

示例14: setup_critic_optimizer

# 需要导入模块: import logger [as 别名]
# 或者: from logger import info [as 别名]
def setup_critic_optimizer(self):
        logger.info('setting up critic optimizer')
        normalized_critic_target_tf = tf.clip_by_value(normalize(self.critic_target, self.ret_rms), self.return_range[0], self.return_range[1])
        self.critic_loss = tf.reduce_mean(tf.square(self.normalized_critic_tf - normalized_critic_target_tf))
        if self.critic_l2_reg > 0.:
            critic_reg_vars = [var for var in self.critic.trainable_vars if 'kernel' in var.name and 'output' not in var.name]
            for var in critic_reg_vars:
                logger.info('  regularizing: {}'.format(var.name))
            logger.info('  applying l2 regularization with {}'.format(self.critic_l2_reg))
            critic_reg = tc.layers.apply_regularization(
                tc.layers.l2_regularizer(self.critic_l2_reg),
                weights_list=critic_reg_vars
            )
            self.critic_loss += critic_reg
        critic_shapes = [var.get_shape().as_list() for var in self.critic.trainable_vars]
        critic_nb_params = sum([reduce(lambda x, y: x * y, shape) for shape in critic_shapes])
        logger.info('  critic shapes: {}'.format(critic_shapes))
        logger.info('  critic params: {}'.format(critic_nb_params))
        self.critic_grads = U.flatgrad(self.critic_loss, self.critic.trainable_vars, clip_norm=self.clip_norm)
        self.critic_optimizer = MpiAdam(var_list=self.critic.trainable_vars,
            beta1=0.9, beta2=0.999, epsilon=1e-08) 
开发者ID:quantumiracle,项目名称:Reinforcement_Learning_for_Traffic_Light_Control,代码行数:23,代码来源:ddpg_learner.py

示例15: saveModelParams

# 需要导入模块: import logger [as 别名]
# 或者: from logger import info [as 别名]
def saveModelParams(epoch, runningResults, netG, netD):
    results = {'DLoss': [], 'GLoss': [], 'DScore': [], 'GScore': [], 'PSNR': [], 'SSIM': []}

    # Save model parameters
    torch.save(netG.state_dict(), 'weights/netG_epoch_%d_%d.pth' % (UPSCALE_FACTOR, epoch))
    torch.save(netD.state_dict(), 'weights/netD_epoch_%d_%d.pth' % (UPSCALE_FACTOR, epoch))

    logger.info("Checkpoint saved to {}".format('weights/netG_epoch_%d_%d.pth' % (UPSCALE_FACTOR, epoch)))
    logger.info("Checkpoint saved to {}".format('weights/netD_epoch_%d_%d.pth' % (UPSCALE_FACTOR, epoch)))

    # Save Loss\Scores\PSNR\SSIM
    results['DLoss'].append(runningResults['DLoss'] / runningResults['batchSize'])
    results['GLoss'].append(runningResults['GLoss'] / runningResults['batchSize'])
    results['DScore'].append(runningResults['DScore'] / runningResults['batchSize'])
    results['GScore'].append(runningResults['GScore'] / runningResults['batchSize'])
    #results['PSNR'].append(validationResults['PSNR'])
    #results['SSIM'].append(validationResults['SSIM'])

    if epoch % 1 == 0 and epoch != 0:
        out_path = 'statistics/'
        data_frame = pd.DataFrame(data={'DLoss': results['DLoss'], 'GLoss': results['GLoss'], 'DScore': results['DScore'],
                                  'GScore': results['GScore']},#, 'PSNR': results['PSNR'], 'SSIM': results['SSIM']},
                                  index=range(1, epoch + 1))
        data_frame.to_csv(out_path + 'iSeeBetter_' + str(UPSCALE_FACTOR) + '_Train_Results.csv', index_label='Epoch') 
开发者ID:amanchadha,项目名称:iSeeBetter,代码行数:26,代码来源:iSeeBetterTrain.py


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