def edges_iter(self, trg_gids, src_network=None, trg_network=None): matching_edge_tables = self.__edges_tables if trg_network is not None: matching_edge_tables = [ et for et in self.__edges_tables if et.target_network == trg_network ] if src_network is not None: matching_edge_tables = [ et for et in matching_edge_tables if et.source_network == src_network ] for edge_type_table in matching_edge_tables: et_df = edge_type_table.to_dataframe() et_df = et_df[et_df['target_node_id'].isin(trg_gids)] if len(et_df) == 0: continue edge_type_props = edge_type_table.edge_type_properties for row in et_df.to_dict(orient='records'): yield Edge(src_gid=row['source_node_id'], trg_gid=row['target_node_id'], edge_type_props=edge_type_props, syn_props=row)
def edges_iter(self, trg_gids, src_network=None, trg_network=None): matching_edge_tables = self.__edges_tables if trg_network is not None: matching_edge_tables = [ et for et in self.__edges_tables if et['target_network'] == trg_network ] if src_network is not None: matching_edge_tables = [ et for et in matching_edge_tables if et['source_network'] == src_network ] for trg_gid in trg_gids: for ets in matching_edge_tables: syn_table = ets['syn_table'] if syn_table.has_target(trg_gid): for src_id, nsyns in syn_table.trg_itr(trg_gid): if ets['params']: synapses = [{} for _ in range(nsyns)] for param_name, param_table in ets['params'].items( ): for i, val in enumerate(param_table[src_id, trg_gid]): synapses[i][param_name] = val for syn_prop in synapses: yield Edge(src_gid=src_id, trg_gid=trg_gid, edge_type_props=ets['edge_types'], syn_props=syn_prop) else: yield Edge(src_gid=src_id, trg_gid=trg_gid, edge_type_props=ets['edge_types'], syn_props={'nsyns': nsyns})