File: rebuild_edge_index.py

package info (click to toggle)
bmtk 0.0%2Bgit20210109.8572664%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 74,876 kB
  • sloc: python: 24,853; javascript: 1,998; makefile: 34; sh: 16
file content (18 lines) | stat: -rw-r--r-- 694 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import h5py
import numpy as np

with h5py.File('network/lgn_v1_edges.h5', 'a') as h5:
    node_id_data = np.zeros((449, 2), dtype=np.uint64)
    ds = h5['edges/lgn_to_v1/indicies/target_to_source/node_id_to_range']
    node_id_data[0:449, :] = ds
    node_id_data[448,:] = [448, 448]

    #print node_id_data
    #ds.resize((449, 2))
    #ds[...] = node_id_data
    #ds.resize((449, 2))
    del h5['edges/lgn_to_v1/indicies/target_to_source/node_id_to_range']

    h5.create_dataset('edges/lgn_to_v1/indicies/target_to_source/node_id_to_range', data=node_id_data)
    #ary = np.array(h5['edges/lgn_to_v1/indicies/target_to_source/node_id_to_range'][...])
    #print np.append(ary, [[448, 449]])