In [1]:
import tables
import numpy as np
In [4]:
h5file = tables.open_file('tutorial.h5', mode = 'w', title = 'test file')
In [12]:
g = h5file.create_group('/', 'combinatorial_class','Combinatorial Class')
In [13]:
g
Out[13]:
In [14]:
table = h5file.create_group(g, 'topo_class','Topological Classes')
In [15]:
g2 = table
In [19]:
class State(tables.IsDescription):
game_number = tables.Int64Col()
game_hash_top = tables.Int64Col()
game_hash_bottom = tables.Int64Col()
red_car_end_a = tables.Int64Col()
is_goal_state = tables.Int64Col()
degree = tables.Int64Col()
In [21]:
tbl = h5file.create_table(g2,'game_states',State, 'Game State Example')
In [22]:
h5file
Out[22]:
In [23]:
state = tbl.row
In [25]:
for i in range(10):
state['game_number'] = i
state['degree'] = -1
state['game_hash_top'] = 2394723
state['game_hash_bottom'] = 2439233
state['is_goal_state'] = i%2
state['red_car_end_a'] = 16
state.append()
In [26]:
tbl.flush()
In [29]:
tbl2 = h5file.root.combinatorial_class.topo_class.game_states
In [30]:
tbl2
Out[30]:
In [33]:
for i in tbl2.iterrows():
print i
In [34]:
h5file.create_group('/','comb_class_2','Combinatorial Class - 1 car 0 trucks')
Out[34]:
In [35]:
h5file.create_group('/','comb_class_4','Combinatorial Class - 2 cars 0 trucks')
Out[35]:
In [41]:
h5file.create_group('/comb_class_2','topo_class_28372','Topologial Class')
Out[41]:
In [ ]: