本文整理汇总了Python中pypet.trajectory.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
的用法示例。
在下文中一共展示了Trajectory.f_get_from_runs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from pypet.trajectory import Trajectory [as 别名]
# 或者: from pypet.trajectory.Trajectory import f_get_from_runs [as 别名]
def main():
folder = 'experiments/example_11/HDF5/'
filename = 'Clustered_Network.hdf5'
filename = os.path.join(folder, filename)
# If we pass a filename to the trajectory a new HDF5StorageService will
# be automatically created
traj = Trajectory(filename=filename,
dynamically_imported_classes=[BrianDurationParameter,
BrianMonitorResult,
BrianParameter])
# Let's create and fake environment to enable logging:
Environment(traj, do_single_runs=False)
# Load the trajectory, but onyl laod the skeleton of the results
traj.f_load(index=0, # Change if you do not want to load the very first trajectory
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()
示例2: TrajectoryTest
# 需要导入模块: from pypet.trajectory import Trajectory [as 别名]
# 或者: from pypet.trajectory.Trajectory import f_get_from_runs [as 别名]
#.........这里部分代码省略.........
# def test_iter_dfs_as_run(self):
#
# self.traj.f_add_result('results.run_00000000.resulttest', 42)
# self.traj.f_add_result('results.run_00000001.resulttest', 43)
#
# self.traj.f_as_run('run_00000001')
#
# prev_node = None
#
# x= [x for x in self.traj.f_iter_nodes(recursive=True, search_strategy='DFS')]
#
# for node in self.traj.f_iter_nodes(recursive=True, search_strategy='DFS'):
# self.assertTrue('run_00000000' not in node.v_full_name)
#
# if not prev_node is None:
# if not prev_node.v_is_leaf and len(prev_node._children) > 0:
# self.assertTrue(node.v_name in prev_node._children)
#
# prev_node = node
def test_find_in_all_runs(self):
self.traj.f_add_result('results.runs.run_00000000.sub.resulttest', 42)
self.traj.f_add_result('results.runs.run_00000001.sub.resulttest', 43)
self.traj.f_add_result('results.runs.run_00000002.sub.resulttest', 44)
self.traj.f_add_result('results.runs.run_00000002.sub.resulttest2', 42)
self.traj.f_add_result('results.runs.run_00000003.sub.resulttest2', 43)
self.traj.f_add_derived_parameter('derived_parameters.runs.run_00000002.testing', 44)
res_dict = self.traj.f_get_from_runs('kkkkkkdjfoiuref')
self.assertTrue(len(res_dict)==0)
res_dict = self.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 = self.traj.f_get_from_runs(name='sub.resulttest2', use_indices=True)
self.assertTrue(len(res_dict)==2)
self.assertTrue(res_dict[3]is self.traj.f_get('run_00000003.resulttest2'))
self.assertTrue(1 not in res_dict)
res_dict = self.traj.f_get_from_runs(name='testing', where='derived_parameters')
self.assertTrue(len(res_dict)==1)
self.traj.f_add_result('results.runs.run_00000002.sub.sub.sub.sub.resulttest2', 444)
self.traj.f_add_result('results.runs.run_00000002.sub.sub.sub.resulttest2', 444)
with self.assertRaises(pex.NotUniqueNodeError):
self.traj.f_get_from_runs('sub.sub.resulttest2', backwards_search=True)
with self.assertRaises(ValueError):
self.traj.f_get_from_runs('test', where='Portland')
def test_illegal_namings(self):
self.traj=Trajectory('resulttest2')
with self.assertRaises(ValueError):