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


Python Log.add_group方法代码示例

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


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

示例1: main

# 需要导入模块: from sfepy.base.log import Log [as 别名]
# 或者: from sfepy.base.log.Log import add_group [as 别名]
def main():
    cwd = os.path.split(os.path.join(os.getcwd(), __file__))[0]

    log = Log(
        (["sin(x)", "cos(x)"], ["exp(x)"]),
        yscales=["linear", "log"],
        xlabels=["angle", None],
        ylabels=[None, "a function"],
        log_filename=os.path.join(cwd, "live_plot.log"),
    )
    log2 = Log(
        [["x^3"]],
        yscales=["linear"],
        xlabels=["x"],
        ylabels=["a cubic function"],
        log_filename=os.path.join(cwd, "live_plot2.log"),
    )

    added = 0
    for x in nm.linspace(0, 4.0 * nm.pi, 200):
        output("x: ", x)

        if x < (2.0 * nm.pi):
            log(nm.sin(x), nm.cos(x), nm.exp(x), x=[x, None])

        else:
            if added:
                log(nm.sin(x), nm.cos(x), nm.exp(x), x ** 2, x=[x, None, x])
            else:
                log.plot_vlines(color="r", linewidth=2)
                log.add_group(["x^2"], "linear", "new x", "square", formats=["%+g"])
            added += 1

        if (added == 20) or (added == 50):
            log.plot_vlines([2], color="g", linewidth=2)

        log2(x * x * x, x=[x])

    print log
    print log2
    pause()

    log(finished=True)
    log2(finished=True)
开发者ID:rosendo100,项目名称:sfepy,代码行数:46,代码来源:live_plot.py

示例2: main

# 需要导入模块: from sfepy.base.log import Log [as 别名]
# 或者: from sfepy.base.log.Log import add_group [as 别名]
def main():
    cwd = os.path.split(os.path.join(os.getcwd(), __file__))[0]

    log = Log((['sin(x) + i sin(x**2)', 'cos(x)'], ['exp(x)']),
              yscales=['linear', 'log'],
              xlabels=['angle', None], ylabels=[None, 'a function'],
              log_filename=os.path.join(cwd, 'live_plot.log'))
    log2 = Log([['x^3']],
               yscales=['linear'],
               xlabels=['x'], ylabels=['a cubic function'],
               aggregate=50, sleep=0.05,
               log_filename=os.path.join(cwd, 'live_plot2.log'),
               formats=[['{:.5e}']])

    added = 0
    for x in nm.linspace(0, 4.0 * nm.pi, 200):
        output('x: ', x)

        if x < (2.0 * nm.pi):
            log(nm.sin(x)+1j*nm.sin(x**2), nm.cos(x), nm.exp(x), x=[x, None])

        else:
            if added:
                log(nm.sin(x)+1j*nm.sin(x**2), nm.cos(x), nm.exp(x), x**2,
                    x=[x, None, x])
            else:
                log.plot_vlines(color='r', linewidth=2)
                log.add_group(['x^2'], yscale='linear', xlabel='new x',
                              ylabel='square', formats=['%+g'])
            added += 1

        if (added == 20) or (added == 50):
            log.plot_vlines([2], color='g', linewidth=2)

        log2(x*x*x, x=[x])

    print(log)
    print(log2)
    pause()

    log(finished=True)
    log2(finished=True)
开发者ID:rc,项目名称:sfepy,代码行数:44,代码来源:live_plot.py


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