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


Python Trajectory.f_get_from_runs方法代码示例

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


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

示例1: main

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

    filename = os.path.join('hdf5', 'Clustered_Network.hdf5')
    # If we pass a filename to the trajectory a new HDF5StorageService will
    # be automatically created
    traj = Trajectory(filename=filename,
                    dynamically_imported_classes=[BrianMonitorResult,
                                                  BrianParameter])

    # Let's create and fake environment to enable logging:
    env = Environment(traj, do_single_runs=False)


    # Load the trajectory, but onyl laod the skeleton of the results
    traj.f_load(index=-1, load_parameters=2, load_derived_parameters=2, load_results=1)

    # Find the result instances related to the fano factor
    fano_dict = traj.f_get_from_runs('mean_fano_factor', fast_access=False)

    # Load the data of the fano factor results
    ffs = fano_dict.values()
    traj.f_load_items(ffs)

    # Extract all values and R_ee values for each run
    ffs_values = [x.f_get() for x in ffs]
    Rees = traj.f_get('R_ee').f_get_range()

    # Plot average fano factor as a function of R_ee
    plt.plot(Rees, ffs_values)
    plt.xlabel('R_ee')
    plt.ylabel('Avg. Fano Factor')
    plt.show()

    # Finally disable logging and close all log-files
    env.disable_logging()
开发者ID:MehmetTimur,项目名称:pypet,代码行数:37,代码来源:plotff.py

示例2: test_find_in_all_runs_with_links

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

        traj = Trajectory()

        traj.f_add_parameter('FloatParam')
        traj.par.FloatParam=4.0
        self.explore_dict = {'FloatParam':[1.0,1.1,1.2,1.3]}
        traj.f_explore(self.explore_dict)

        self.assertTrue(len(traj) == 4)

        traj.f_add_result('results.runs.run_00000000.sub.resulttest', 42)
        traj.f_add_result('results.runs.run_00000001.sub.resulttest', 43)
        traj.f_add_result('results.runs.run_00000002.sub.resulttest', 44)

        traj.f_add_result('results.runs.run_00000002.sub.resulttest2', 42)
        traj.f_add_result('results.runs.run_00000003.sub.resulttest2', 43)

        traj.f_add_derived_parameter('derived_parameters.runs.run_00000002.testing', 44)

        res_dict = traj.f_get_from_runs('resulttest', fast_access=True)

        self.assertTrue(len(res_dict)==3)
        self.assertTrue(res_dict['run_00000001']==43)
        self.assertTrue('run_00000003' not in res_dict)

        res_dict = traj.f_get_from_runs(name='sub.resulttest2', use_indices=True)

        self.assertTrue(len(res_dict)==2)
        self.assertTrue(res_dict[3] is traj.f_get('run_00000003.resulttest2'))
        self.assertTrue(1 not in res_dict)

        traj.res.runs.r_0.f_add_link('resulttest2', traj.r_1.f_get('resulttest'))

        res_dict = traj.f_get_from_runs(name='resulttest2', use_indices=True)

        self.assertTrue(len(res_dict)==3)
        self.assertTrue(res_dict[0] is traj.f_get('run_00000001.resulttest'))
        self.assertTrue(1 not in res_dict)

        res_dict = traj.f_get_from_runs(name='resulttest2', use_indices=True, with_links=False)

        self.assertTrue(len(res_dict)==2)
        self.assertTrue(0 not in res_dict)
        self.assertTrue(1 not in res_dict)
开发者ID:MehmetTimur,项目名称:pypet,代码行数:47,代码来源:link_test.py


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