• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python nengo.log函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_log_to_console

def test_log_to_console():
    nengo.log(path=None)
    assert logging.root.getEffectiveLevel() == logging.WARNING
    assert nengo.utils.logging.console_handler in logging.root.handlers
    n_handlers = len(logging.root.handlers)
    nengo.log('debug', path=None)
    assert logging.root.getEffectiveLevel() == logging.DEBUG
    assert len(logging.root.handlers) == n_handlers
    logging.root.handlers.remove(nengo.utils.logging.console_handler)
开发者ID:4n6strider,项目名称:nengo,代码行数:9,代码来源:test_logging.py


示例2: test_log_to_console

def test_log_to_console():
    logging.shutdown()
    reload(logging)
    nengo.log(debug=False, path=None)
    assert logging.root.getEffectiveLevel() == logging.WARNING
    assert len(logging.root.handlers) == 1
    handler = logging.root.handlers[0]
    assert isinstance(handler, logging.StreamHandler)
    assert handler.formatter == nengo.utils.logging.console_formatter
    nengo.log(debug=True, path=None)
    assert logging.root.getEffectiveLevel() == logging.DEBUG
    assert len(logging.root.handlers) == 1
开发者ID:Dartonw,项目名称:nengo,代码行数:12,代码来源:test_logging.py


示例3: test_log_to_file

def test_log_to_file(tmpdir):
    tmpfile = str(tmpdir.join("log.txt"))
    nengo.log(path=tmpfile)
    n_handlers = len(logging.root.handlers)
    handler = logging.root.handlers[-1]
    assert logging.root.getEffectiveLevel() == logging.WARNING
    assert isinstance(handler, logging.FileHandler)
    assert handler.baseFilename == tmpfile
    nengo.log('debug', path=tmpfile)
    assert logging.root.getEffectiveLevel() == logging.DEBUG
    assert len(logging.root.handlers) == n_handlers
    logging.root.handlers.remove(handler)
开发者ID:4n6strider,项目名称:nengo,代码行数:12,代码来源:test_logging.py


示例4: test_log_to_file

def test_log_to_file(tmpdir):
    logging.shutdown()
    reload(logging)
    tmpfile = str(tmpdir.join("log.txt"))
    nengo.log(debug=False, path=tmpfile)
    assert logging.root.getEffectiveLevel() == logging.WARNING
    assert len(logging.root.handlers) == 1
    handler = logging.root.handlers[0]
    assert isinstance(handler, logging.FileHandler)
    assert handler.formatter == nengo.utils.logging.file_formatter
    nengo.log(debug=True, path=tmpfile)
    assert logging.root.getEffectiveLevel() == logging.DEBUG
    assert len(logging.root.handlers) == 1
开发者ID:Dartonw,项目名称:nengo,代码行数:13,代码来源:test_logging.py


示例5: none_function

    # returns None
    def none_function(t):
        pass

    model2 = nengo.Network()
    with model2:
        nengo.Node(output=none_function)

    sim = nengo.Simulator(model2)
    sim.run(1)


def test_scalar(Simulator):
    model = nengo.Network()
    with model:
        a = nengo.Node(output=1)
        b = nengo.Ensemble(nengo.LIF(100), dimensions=1)
        nengo.Connection(a, b)
        ap = nengo.Probe(a)
        bp = nengo.Probe(b)

    sim = nengo.Simulator(model)
    sim.run(1)
    assert sim.data[ap].shape == (1000, 1)
    assert sim.data[bp].shape == (1000, 1)


if __name__ == "__main__":
    nengo.log(debug=True)
    pytest.main([__file__, '-v'])
开发者ID:ZeitgeberH,项目名称:nengo,代码行数:30,代码来源:test_node.py


示例6: TestBasalGanglia

import nengo
from nengo.tests.helpers import SimulatorTestCase, unittest


class TestBasalGanglia(SimulatorTestCase):
    def test_basic(self):
        model = nengo.Model('test_basalganglia_basic')

        with model:
            bg = nengo.networks.BasalGanglia(dimensions=5, label='BG')
            input = nengo.Node([0.8, 0.4, 0.4, 0.4, 0.4], label='input')
            nengo.Connection(input, bg.input)
            p = nengo.Probe(bg.output, 'output')

        sim = self.Simulator(model)
        sim.run(0.2)

        output = np.mean(sim.data(p)[50:], axis=0)

        self.assertGreater(output[0], -0.15)
        self.assertLess(output[1], -0.8)
        self.assertLess(output[2], -0.8)
        self.assertLess(output[3], -0.8)
        self.assertLess(output[4], -0.8)


if __name__ == "__main__":
    nengo.log(debug=True, path='log.txt')
    unittest.main()
开发者ID:bptripp,项目名称:nengo,代码行数:29,代码来源:test_networks_basalganglia.py


示例7: hist_dist

from collections import OrderedDict

import matplotlib.pyplot as plt
import numpy as np
import nengo
nengo.log(level='info')
import nengo_extras

from run_core import load_network, SoftLIFRate, round_layer


def hist_dist(hist, edges):
    p = np.zeros(edges.size, dtype=float)
    p[1:-1] = hist[:-1] + hist[1:]
    p /= p.sum()
    return nengo.dists.PDF(edges, p)


def build_layer(layer, inputs, data, hist=None, pt=None):
    assert isinstance(inputs, list)
    assert len(layer.get('inputs', [])) == len(inputs)
    name = layer['name']

    if layer['type'] == 'cost.logreg':
        labels, probs = inputs
        return probs

        # pt = params['presentation_time']
        # nlabels, nprobs = layer['numInputs']
        # assert nlabels == 1
开发者ID:hunse,项目名称:cuda-convnet2,代码行数:30,代码来源:run_nengo.py


示例8: open

        with open(decoder_file) as f:
            dt = 0.001
            synapse = 0.01
            self.decoders = np.asarray([[float(x) / (1 - np.exp(-dt / synapse)) for x in line.split()]
                                        for line in f.readlines()])
            # note: dividing by filter to undo the filter that will be applied
            # when the decoders are set

    def __call__(self, A, Y, rng=None):
        return self.decoders, []

SEED = 1
rng = random.Random()
rng.seed(SEED)

nengo.log()

pong_game = PongGame(["computer", "computer"], seed=SEED)

l_rate = 5e-5
discount = 0.97

#d_file = os.path.join("data", "decoders_%s_%s_%s.txt" % (l_rate, discount, SEED))
d_file = os.path.join("data", "decoders_best.txt")
d_solve = decoder_setter(d_file)
#d_solve = nengo.decoders.lstsq_L2nz

with nengo.Network() as net:
    p0 = DecoderPongPlayer(0, pong_game, opposite=True, noise=None)
    p1 = rl_pongplayer.RLPongPlayer(1, pong_game, decoder_solver=d_solve,
                                    l_rate=l_rate, discount=discount, rng=rng)
开发者ID:JeniaJitsev,项目名称:pong-RL,代码行数:31,代码来源:nengo_pong.py


示例9:

import logging
import argparse
import numpy as np
import time
import os

import nengo
import nengo_mpi
from nengo_mpi.partition import metis_partitioner, work_balanced_partitioner
from nengo_mpi.partition import random_partitioner, EnsembleArraySplitter
from utils import write_to_csv

logger = logging.getLogger(__name__)
nengo.log(debug=False)

parser = argparse.ArgumentParser(description="A grid network.")

parser.add_argument(
    '--ns', type=int, default=1,
    help='Number of streams in the network.')

parser.add_argument(
    '--sl', type=int, default=1,
    help='Length of each stream.')

parser.add_argument(
    '-d', type=int, default=1,
    help='Number of dimensions in each neural ensemble.')

parser.add_argument(
    '--npd', type=int, default=50,
开发者ID:adityagilra,项目名称:nengo_mpi,代码行数:31,代码来源:grid.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python signal.SignalDict类代码示例发布时间:2022-05-27
下一篇:
Python nemoa.log函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap