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


Python Trajectory.v_idx方法代码示例

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


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

示例1: test_links_according_to_run

# 需要导入模块: from pypet import Trajectory [as 别名]
# 或者: from pypet.Trajectory import v_idx [as 别名]
    def test_links_according_to_run(self):

        traj = Trajectory()

        traj.f_add_parameter('test.hi', 44)
        traj.f_explore({'hi': [1,2,3]})

        traj.f_add_parameter_group('test.test.test2')
        traj.f_add_parameter_group('test2')
        traj.test2.f_add_link('test', traj.test)

        traj.v_idx = 1
开发者ID:MehmetTimur,项目名称:pypet,代码行数:14,代码来源:link_test.py

示例2: test_file_renaming

# 需要导入模块: from pypet import Trajectory [as 别名]
# 或者: from pypet.Trajectory import v_idx [as 别名]
 def test_file_renaming(self):
     traj_name = 'test'
     traj = Trajectory('test', add_time=False)
     traj.f_add_parameter('x', 42)
     traj.f_explore({'x': [1,2,3]})
     rename_string = '$traj_$set_$run'
     solution_1 = 'test_run_set_ALL_run_ALL'
     solution_2 = 'test_run_set_00000_run_00000000'
     renaming_1 = rename_log_file(rename_string, traj)
     self.assertEqual(renaming_1, solution_1)
     traj.v_idx = 0
     renaming_2 = rename_log_file(rename_string, traj)
     self.assertEqual(renaming_2, solution_2)
开发者ID:MehmetTimur,项目名称:pypet,代码行数:15,代码来源:logging_test.py

示例3: test_get_all_not_links

# 需要导入模块: from pypet import Trajectory [as 别名]
# 或者: from pypet.Trajectory import v_idx [as 别名]
    def test_get_all_not_links(self):

        traj = Trajectory()

        traj.f_add_parameter('test.hi', 44)
        traj.f_explore({'hi': [1,2,3]})

        traj.f_add_parameter_group('test.test.test2')
        traj.f_add_parameter_group('test2')
        traj.test2.f_add_link('test', traj.test)

        nodes = traj.f_get_all('par.test')

        self.assertTrue(len(nodes) == 2)

        nodes = traj.f_get_all('par.test', shortcuts=False)

        self.assertTrue(len(nodes) == 1)

        traj.f_set_crun(0)

        traj.f_add_group('f.$.h')
        traj.f_add_group('f.$.g.h')
        traj.f_add_group('f.$.i')
        traj.crun.i.f_add_link('h', traj.crun.h)

        nodes = traj.f_get_all('$.h')

        self.assertTrue(len(nodes)==2)

        nodes = traj.f_get_all('h')

        self.assertTrue(len(nodes)==2)

        traj.v_idx = -1

        nodes = traj.f_get_all('h')

        self.assertTrue(len(nodes)==2)
开发者ID:MehmetTimur,项目名称:pypet,代码行数:41,代码来源:link_test.py

示例4: main

# 需要导入模块: from pypet import Trajectory [as 别名]
# 或者: from pypet.Trajectory import v_idx [as 别名]
def main():

    # This time we don't need an environment since we just going to look
    # at data in the trajectory
    traj = Trajectory('FiringRate', add_time=False)

    # Let's load the trajectory from the file
    # Only load the parameters, we will load the results on the fly as we need them
    filename = os.path.join('hdf5', 'FiringRate.hdf5')
    traj.f_load(load_parameters=2, load_derived_parameters=0, load_results=0,
                load_other_data=0, filename=filename)

    # We'll simply use auto loading so all data will be loaded when needed.
    traj.v_auto_load = True

    rates_frame = traj.res.summary.firing_rates.rates_frame
    # Here we load the data automatically on the fly

    plt.figure()
    plt.subplot(2,1,1)
    #Let's iterate through the columns and plot the different firing rates :
    for tau_ref, I_col in rates_frame.iteritems():
        plt.plot(I_col.index, I_col, label='Avg. Rate for tau_ref=%s' % str(tau_ref))

    # Label the plot
    plt.xlabel('I')
    plt.ylabel('f[Hz]')
    plt.title('Firing as a function of input current `I`')
    plt.legend(loc='best')

    # Also let's plot an example run, how about run 13 ?
    example_run = 13

    traj.v_idx = example_run # We make the trajectory behave as a single run container.
    # This short statement has two major effects:
    # a) all explored parameters are set to the value of run 13,
    # b) if there are tree nodes with names other than the current run aka `run_00000013`
    # they are simply ignored, if we use the `$` sign or the `crun` statement,
    # these are translated into `run_00000013`.

    # Get the example data
    example_I = traj.I
    example_tau_ref = traj.tau_ref
    example_V = traj.results.neuron.crun.V # Here crun stands for run_00000013

    # We need the time step...
    dt = traj.dt
    # ...to create an x-axis for the plot
    dt_array = [irun * dt for irun in range(len(example_V))]

    # And plot the development of V over time,
    # Since this is rather repetitive, we only
    # plot the first eighth of it.
    plt.subplot(2,1,2)
    plt.plot(dt_array, example_V)
    plt.xlim((0, dt*len(example_V)/8))

    # Label the axis
    plt.xlabel('t[ms]')
    plt.ylabel('V')
    plt.title('Example of development of V for I=%s, tau_ref=%s in run %d' %
              (str(example_I), str(example_tau_ref), traj.v_idx))

    # And let's take a look at it
    plt.show()

    # Finally revoke the `traj.v_idx=13` statement and set everything back to normal.
    # Since our analysis is done here, we could skip that, but it is always a good idea
    # to do that.
    traj.f_restore_default()
开发者ID:MehmetTimur,项目名称:pypet,代码行数:72,代码来源:analysis.py


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