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

Python ioutils.get_log_config函数代码示例

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

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



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

示例1: test_file_overwriting

    def test_file_overwriting(self):
        self.traj.f_store()

        with ptcompat.open_file(self.filename, mode='r') as file:
            nchildren = len(file.root._v_children)
            self.assertTrue(nchildren > 0)

        env2 = Environment(filename=self.filename,
                           log_config=get_log_config())
        traj2 = env2.v_trajectory
        traj2.f_store()

        self.assertTrue(os.path.exists(self.filename))

        with ptcompat.open_file(self.filename, mode='r') as file:
            nchildren = len(file.root._v_children)
            self.assertTrue(nchildren > 1)

        env3 = Environment(filename=self.filename, overwrite_file=True,
                           log_config=get_log_config())

        self.assertFalse(os.path.exists(self.filename))

        env2.f_disable_logging()
        env3.f_disable_logging()
开发者ID:MehmetTimur,项目名称:pypet,代码行数:25,代码来源:environment_test.py


示例2: test_hdf5_store_load_parameter

    def test_hdf5_store_load_parameter(self):
        traj_name = make_trajectory_name(self)
        file_name = make_temp_dir(os.path.join('brian2', 'tests', 'hdf5', 'test_%s.hdf5' % traj_name))
        env = Environment(trajectory=traj_name, filename=file_name, log_config=get_log_config(),
                            dynamic_imports=[Brian2Parameter], add_time=False, storage_service=HDF5StorageService)
        traj = env.v_trajectory
        traj.v_standard_parameter = Brian2Parameter
        traj.f_add_parameter('brian2.single.millivolts', 10*mvolt, comment='single value')

        #traj.f_add_parameter('brian2.array.millivolts', [11, 12]*mvolt, comment='array')
        #traj.f_add_parameter('mV1', 42.0*mV)
        #traj.f_add_parameter('ampere1', 1*mA)
        #traj.f_add_parameter('integer', 16)
        #traj.f_add_parameter('kHz05', 0.5*kHz)
        #traj.f_add_parameter('nested_array', np.array([[6.,7.,8.],[9.,10.,11.]]) * ms)
        #traj.f_add_parameter('b2a', np.array([1., 2.]) * mV)

        # We also need to check if explorations work with hdf5 store!
        #explore_dict = {'ampere1': [1*mA, 2*mA, 3*mA],
        #                'integer': [42,43,44],
        #                'b2a': [np.array([1., 2.]) * mV, np.array([1., 4.]) * mV,
        #                       np.array([1., 2.]) * mV]}
        #traj.f_explore(explore_dict)

        traj.f_store()

        traj2 = load_trajectory(filename=file_name, name=traj_name, dynamic_imports=[Brian2Parameter],
                                load_data=2)
        self.compare_trajectories(traj, traj2)
开发者ID:SmokinCaterpillar,项目名称:pypet,代码行数:29,代码来源:hdf5_brian2_test.py


示例3: make_environment_mp

    def make_environment_mp(self, idx, filename):
        #self.filename = '../../experiments/tests/HDF5/test.hdf5'
        self.logfolder = make_temp_dir(os.path.join('experiments',
                                                      'tests',
                                                      'Log'))
        self.cnt_folder = make_temp_dir(os.path.join('experiments',
                                                      'tests',
                                                      'cnt'))
        trajname = 'Test%d' % idx + '_' + make_trajectory_name(self)

        env = Environment(trajectory=trajname,
                          dynamic_imports=[CustomParameter],
                          filename=filename,
                          file_title=trajname,
                          log_stdout=False,
                          purge_duplicate_comments=False,
                          log_config=get_log_config(),
                          continuable=True,
                          continue_folder=self.cnt_folder,
                          delete_continue=False,
                          multiproc=True,
                          use_pool=True,
                          ncores=4)

        self.envs.append(env)
        self.trajs.append( env.v_trajectory)
开发者ID:MehmetTimur,项目名称:pypet,代码行数:26,代码来源:removal_and_continue_test.py


示例4: make_environment

    def make_environment(self, idx, filename):



        #self.filename = '../../experiments/tests/HDF5/test.hdf5'
        self.logfolder = make_temp_dir(os.path.join('experiments',
                                                     'tests',
                                                     'Log'))
        self.cnt_folder = make_temp_dir(os.path.join('experiments','tests','cnt'))
        trajname = 'Test%d' % idx + '_' + make_trajectory_name(self)

        env = Environment(trajectory=trajname,
                          filename=filename,
                          file_title=trajname,
                          log_stdout=False,

                          log_config=get_log_config(),
                          continuable=True,
                          continue_folder=self.cnt_folder,
                          delete_continue=False,
                          large_overview_tables=True)


        self.envs.append(env)
        self.trajs.append( env.v_trajectory)
开发者ID:henribunting,项目名称:pypet,代码行数:25,代码来源:removal_and_continue_test.py


示例5: test_expand_after_reload

    def test_expand_after_reload(self):

        self.traj.f_add_parameter('TEST', 'test_expand_after_reload')
        ###Explore
        self.explore(self.traj)

        self.make_run()

        traj_name = self.traj.v_name


        self.env = Environment(trajectory=self.traj,
                          log_stdout=False,
                          log_config=get_log_config())

        self.traj = self.env.v_trajectory

        self.traj.f_load(name=traj_name)
        self.traj.res.f_remove()
        self.traj.dpar.f_remove()

        self.expand()

        get_root_logger().info('\n $$$$$$$$$$$$ Second Run $$$$$$$$$$ \n')
        self.make_run()

        newtraj = self.load_trajectory(trajectory_name=self.traj.v_name,as_new=False)
        self.traj.f_load_skeleton()
        self.traj.f_load_items(self.traj.f_to_dict().keys(), only_empties=True)

        self.compare_trajectories(self.traj, newtraj)
开发者ID:MehmetTimur,项目名称:pypet,代码行数:31,代码来源:environment_test.py


示例6: setUp

    def setUp(self):
        self.set_mode()

        self.filename = make_temp_dir(os.path.join('experiments','tests','HDF5','sort_tests.hdf5'))

        self.trajname = make_trajectory_name(self)

        env = Environment(trajectory=self.trajname,filename=self.filename,
                          file_title=self.trajname,
                          log_stdout=self.log_stdout,
                          log_config=get_log_config() if self.log_config else None,
                          multiproc=self.multiproc,
                          wrap_mode=self.mode,
                          ncores=self.ncores,
                          use_pool=self.use_pool,
                          use_scoop=self.use_scoop,
                          port=self.port,
                          freeze_input=self.freeze_input,)

        traj = env.v_trajectory


        traj.v_standard_parameter=Parameter

        traj.f_add_parameter('x',0)
        traj.f_add_parameter('y',0)

        self.env=env
        self.traj=traj
开发者ID:MehmetTimur,项目名称:pypet,代码行数:29,代码来源:environment_test.py


示例7: setUp

    def setUp(self):
        env = Environment(trajectory='Test_'+repr(time.time()).replace('.','_'),
                          filename=make_temp_dir(os.path.join(
                              'experiments',
                              'tests',
                              'briantests',
                              'HDF5',
                               'briantest.hdf5')),
                          file_title='test',
                          log_config=get_log_config(),
                          dynamic_imports=['pypet.brian.parameter.BrianParameter',
                                                        BrianMonitorResult],
                          multiproc=False)

        traj = env.v_trajectory

        #env._set_standard_storage()
        #env._hdf5_queue_writer._hdf5storageservice = LazyStorageService()
        traj = env.v_trajectory
        #traj.set_storage_service(LazyStorageService())

        add_params(traj)
        #traj.mode='Parallel'


        traj.f_explore(cartesian_product({traj.f_get('N').v_full_name:[50,60],
                               traj.f_get('tauw').v_full_name:[30*ms,40*ms]}))

        self.traj = traj

        self.env = env
        self.traj = traj
开发者ID:MehmetTimur,项目名称:pypet,代码行数:32,代码来源:brian_full_network_test.py


示例8: test_maximum_overview_size

    def test_maximum_overview_size(self):

        filename = make_temp_dir('maxisze.hdf5')

        env = Environment(trajectory='Testmigrate', filename=filename,

                          log_config=get_log_config())

        traj = env.v_trajectory
        for irun in range(pypetconstants.HDF5_MAX_OVERVIEW_TABLE_LENGTH):
            traj.f_add_parameter('f%d.x' % irun, 5)

        traj.f_store()


        store = ptcompat.open_file(filename, mode='r+')
        table = ptcompat.get_child(store.root,traj.v_name).overview.parameters_overview
        self.assertEquals(table.nrows, pypetconstants.HDF5_MAX_OVERVIEW_TABLE_LENGTH)
        store.close()

        for irun in range(pypetconstants.HDF5_MAX_OVERVIEW_TABLE_LENGTH,
                  2*pypetconstants.HDF5_MAX_OVERVIEW_TABLE_LENGTH):
            traj.f_add_parameter('f%d.x' % irun, 5)

        traj.f_store()

        store = ptcompat.open_file(filename, mode='r+')
        table = ptcompat.get_child(store.root,traj.v_name).overview.parameters_overview
        self.assertEquals(table.nrows, pypetconstants.HDF5_MAX_OVERVIEW_TABLE_LENGTH)
        store.close()

        env.f_disable_logging()
开发者ID:henribunting,项目名称:pypet,代码行数:32,代码来源:storage_test.py


示例9: test_hdf5_store_load_monitorresult

    def test_hdf5_store_load_monitorresult(self):
        traj_name = make_trajectory_name(self)
        file_name = make_temp_dir(os.path.join('brian2', 'tests', 'hdf5', 'test_%s.hdf5' % traj_name))
        env = Environment(trajectory=traj_name, filename=file_name, log_config=get_log_config(),
                            dynamic_imports=[Brian2MonitorResult], add_time=False, storage_service=HDF5StorageService)
        traj = env.v_trajectory
        traj.v_standard_result = Brian2MonitorResult
        traj.f_add_result('brian2.single.millivolts_single_a', 10*mvolt, comment='single value a')

        traj.f_add_result('brian2.single.millivolts_single_c', 11*mvolt, comment='single value b')

        traj.f_add_result('brian2.array.millivolts_array_a', [11, 12]*mvolt, comment='array')
        traj.f_add_result('mV1', 42.0*mV)
        # results can hold much more than a single data item:
        traj.f_add_result('ampere1', 1*mA, 44, test=300*mV, test2=[1,2,3],
                          test3=np.array([1,2,3])*mA, comment='Result keeping track of many things')
        traj.f_add_result('integer', 16)
        traj.f_add_result('kHz05', 0.5*kHz)
        traj.f_add_result('nested_array', np.array([[6.,7.,8.],[9.,10.,11.]]) * ms)
        traj.f_add_result('b2a', np.array([1., 2.]) * mV)


        traj.f_store()

        traj2 = load_trajectory(filename=file_name, name=traj_name, dynamic_imports=[Brian2MonitorResult], load_data=2)

        #traj._logger.error('traj :'+str(traj))
        #traj._logger.error('traj2:'+str(traj2))
        self.compare_trajectories(traj, traj2)
开发者ID:SmokinCaterpillar,项目名称:pypet,代码行数:29,代码来源:hdf5_brian2_test.py


示例10: test_logging_stdout

    def test_logging_stdout(self):
        filename = 'teststdoutlog.hdf5'
        filename = make_temp_dir(filename)
        folder = make_temp_dir('logs')
        env = Environment(trajectory=make_trajectory_name(self),
                          filename=filename, log_config=get_log_config(),
                          # log_levels=logging.CRITICAL, # needed for the test
                          log_stdout=('STDOUT', 50), #log_folder=folder
                          )

        env.f_run(log_error)
        traj = env.v_traj
        path = get_log_path(traj)

        mainstr = 'sTdOuTLoGGinG'
        print(mainstr)
        env.f_disable_logging()

        mainfilename = os.path.join(path, 'LOG.txt')
        with open(mainfilename, mode='r') as mainf:
            full_text = mainf.read()

        self.assertTrue(mainstr in full_text)
        self.assertTrue('4444444' not in full_text)
        self.assertTrue('DEBUG' not in full_text)
开发者ID:MehmetTimur,项目名称:pypet,代码行数:25,代码来源:logging_test.py


示例11: test_without_pre_run

    def test_without_pre_run(self):
        runner = NetworkRunner()
        components = [TheNeurons(), TheConnection(), TheSimulation()]
        analyser = [TheMonitors()]
        nm = NetworkManager(network_runner=runner, component_list=components,
                            analyser_list=analyser)


        env = Environment(trajectory='Test_'+repr(time.time()).replace('.','_'),
                          filename=make_temp_dir(os.path.join(
                              'experiments',
                              'tests',
                              'briantests',
                              'HDF5',
                               'briantest.hdf5')),
                          file_title='test',
                          log_config=get_log_config(),
                          dynamic_imports=['pypet.brian2.parameter.BrianParameter',
                                                        BrianMonitorResult, BrianResult],
                          multiproc=True,
                          ncores=2)
        traj = env.v_traj
        nm.add_parameters(traj)
        traj.f_explore({'v01': [11*mV, 13*mV]})
        env.f_run(nm.run_network)
        self.check_data(traj)
开发者ID:femtotrader,项目名称:pypet,代码行数:26,代码来源:network_test.py


示例12: test_time_display_of_loading

    def test_time_display_of_loading(self):
        filename = make_temp_dir('sloooow.hdf5')
        env = Environment(trajectory='traj', add_time=True, filename=filename,
                          log_stdout=False,
                          log_config=get_log_config(),
                          dynamic_imports=SlowResult,
                          display_time=0.1)
        traj = env.v_traj
        res=traj.f_add_result(SlowResult, 'iii', 42, 43, comment='llk')
        traj.f_store()
        service_logger = traj.v_storage_service._logger
        root = logging.getLogger('pypet')
        old_level = root.level
        service_logger.setLevel(logging.INFO)
        root.setLevel(logging.INFO)

        traj.f_load(load_data=3)
        service_logger.setLevel(old_level)
        root.setLevel(old_level)

        path = get_log_path(traj)
        mainfilename = os.path.join(path, 'LOG.txt')
        with open(mainfilename, mode='r') as mainf:
            full_text = mainf.read()
            self.assertTrue('nodes/s)' in full_text)

        env.f_disable_logging()
开发者ID:MehmetTimur,项目名称:pypet,代码行数:27,代码来源:environment_test.py


示例13: test_pickling

 def test_pickling(self):
     manager = LoggingManager(log_config=get_log_config(), log_stdout=True,
                              trajectory=FakeTraj())
     manager.check_log_config()
     manager.make_logging_handlers_and_tools()
     dump = pickle.dumps(manager)
     new_manager = pickle.loads(dump)
     manager.finalize()
开发者ID:henribunting,项目名称:pypet,代码行数:8,代码来源:pypetlogging_test.py


示例14: _make_env

 def _make_env(self, idx):
    return Environment(trajectory=self.trajname+str(idx),filename=self.filename,
                       file_title=self.trajname,
                       log_stdout=False,
                       log_config=get_log_config(),
                       multiproc=self.multiproc,
                       wrap_mode=self.mode,
                       ncores=self.ncores)
开发者ID:MehmetTimur,项目名称:pypet,代码行数:8,代码来源:merge_analysis.py


示例15: test_fail_on_wrong_kwarg

 def test_fail_on_wrong_kwarg(self):
     with self.assertRaises(ValueError):
         filename = 'testsfail.hdf5'
         env = Environment(filename=make_temp_dir(filename),
                       log_stdout=True,
                       log_config=get_log_config(),
                       logger_names=('STDERROR', 'STDOUT'),
                       foo='bar')
开发者ID:henribunting,项目名称:pypet,代码行数:8,代码来源:storage_test.py


示例16: setUp

    def setUp(self):
        self.set_mode()
        self.logfolder = make_temp_dir(os.path.join('experiments',
                                                      'tests',
                                                      'Log'))

        random.seed()
        self.trajname = make_trajectory_name(self)
        self.filename = make_temp_dir(os.path.join('experiments',
                                                    'tests',
                                                    'HDF5',
                                                    'test%s.hdf5' % self.trajname))

        env = Environment(trajectory=self.trajname, filename=self.filename,
                          file_title=self.trajname,
                          log_stdout=self.log_stdout,
                          log_config=get_log_config(),
                          results_per_run=5,
                          wildcard_functions=self.wildcard_functions,
                          derived_parameters_per_run=5,
                          multiproc=self.multiproc,
                          ncores=self.ncores,
                          wrap_mode=self.mode,
                          use_pool=self.use_pool,
                          gc_interval=self.gc_interval,
                          freeze_input=self.freeze_input,
                          fletcher32=self.fletcher32,
                          complevel=self.complevel,
                          complib=self.complib,
                          shuffle=self.shuffle,
                          pandas_append=self.pandas_append,
                          pandas_format=self.pandas_format,
                          encoding=self.encoding,
                          niceness=self.niceness,
                          use_scoop=self.use_scoop,
                          port=self.port,
                          add_time=self.add_time,
                          timeout=self.timeout,
                          graceful_exit=self.graceful_exit)

        traj = env.v_trajectory

        traj.v_standard_parameter=Parameter

        ## Create some parameters
        self.param_dict={}
        create_param_dict(self.param_dict)
        ### Add some parameter:
        add_params(traj,self.param_dict)

        #remember the trajectory and the environment
        self.traj = traj
        self.env = env
开发者ID:femtotrader,项目名称:pypet,代码行数:53,代码来源:environment_test.py


示例17: make_environment

    def make_environment(self, idx, filename, **kwargs):

        #self.filename = make_temp_dir('experiments/tests/HDF5/test.hdf5')
        logfolder = make_temp_dir(os.path.join('experiments','tests','Log'))
        trajname = make_trajectory_name(self) + '__' +str(idx) +'_'

        env = Environment(trajectory=trajname,filename=filename, file_title=trajname,
                          log_stdout=False,
                          large_overview_tables=True, log_config=get_log_config(),
                          **kwargs)


        self.envs.append(env)
        self.trajs.append( env.v_trajectory)
开发者ID:henribunting,项目名称:pypet,代码行数:14,代码来源:merge_test.py


示例18: set_mode

 def set_mode(self):
     self.mode = Dummy()
     self.mode.wrap_mode = 'LOCK'
     self.mode.multiproc = False
     self.mode.ncores = 1
     self.mode.use_pool=True
     self.mode.pandas_format='fixed'
     self.mode.pandas_append=False
     self.mode.complib = 'blosc'
     self.mode.complevel=9
     self.mode.shuffle=True
     self.mode.fletcher32 = False
     self.mode.encoding = 'utf8'
     self.mode.log_stdout=False
     self.mode.log_config=get_log_config()
开发者ID:MehmetTimur,项目名称:pypet,代码行数:15,代码来源:logging_test.py


示例19: setUp

    def setUp(self):
        self.set_mode()

        logging.basicConfig(level=logging.ERROR)


        self.logfolder = make_temp_dir(os.path.join('experiments',
                                                      'tests',
                                                      'Log'))

        random.seed()
        self.trajname = make_trajectory_name(self)
        self.filename = make_temp_dir(os.path.join('experiments',
                                                    'tests',
                                                    'HDF5',
                                                    'test%s.hdf5' % self.trajname))

        env = Environment(trajectory=self.trajname, filename=self.filename,
                          file_title=self.trajname,
                          log_stdout=self.log_stdout,

                          log_config=get_log_config(),
                          results_per_run=5,
                          derived_parameters_per_run=5,
                          multiproc=self.multiproc,
                          ncores=self.ncores,
                          wrap_mode=self.mode,
                          use_pool=self.use_pool,
                          fletcher32=self.fletcher32,
                          complevel=self.complevel,
                          complib=self.complib,
                          shuffle=self.shuffle,
                          pandas_append=self.pandas_append,
                          pandas_format=self.pandas_format,
                          encoding=self.encoding)

        traj = env.v_trajectory

        traj.v_standard_parameter=Parameter

        ## Create some parameters
        create_link_params(traj)
        ### Add some parameter:
        explore_params(traj)

        #remember the trajectory and the environment
        self.traj = traj
        self.env = env
开发者ID:SmokinCaterpillar,项目名称:pypet,代码行数:48,代码来源:link_test.py


示例20: test_full_store

    def test_full_store(self):
        filename = make_temp_dir('full_store.hdf5')
        with Environment(filename=filename,
                         log_config=get_log_config()) as env:

            traj = env.v_trajectory

            traj.par.x = Parameter('x', 3, 'jj')

            traj.f_explore({'x': [1,2,3]})

            env.f_run(add_one_particular_item, True)

            traj = load_trajectory(index=-1, filename=filename)

            self.assertTrue('hi' in traj)
开发者ID:femtotrader,项目名称:pypet,代码行数:16,代码来源:environment_test.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python ioutils.get_root_logger函数代码示例发布时间:2022-05-27
下一篇:
Python pypet.Trajectory类代码示例发布时间: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