當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。