本文整理汇总了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()
示例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)