def _read_w(filename):
 with open(filename, 'rb', buffering=0) as fid:
  fid.read(2)
  vertices_n = int(_read_3(fid))
  vertices = np.zeros(vertices_n, dtype=np.int32)
  data = np.zeros(vertices_n, dtype=np.float32)
  for i in range(vertices_n):
   vertices[i] = _read_3(fid)
   data[i] = np.fromfile(fid, dtype='>f4', count=1)[0]
  w = dict()
  w['vertices'] = vertices
  w['data'] = data
 return w

def _read_w ( filename ) : with open ( filename , 'rb' , buffering = 0 ) as fid : fid . read ( 2 ) vertices_n = int ( _read_3 ( fid ) ) vertices = np . zeros ( vertices_n , dtype = np . int32 ) data = np . zeros ( vertices_n , dtype = np . float32 ) for i in range ( vertices_n ) : vertices [ i ] = _read_3 ( fid ) data [ i ] = np . fromfile ( fid , dtype = '>f4' , count = 1 ) [ 0 ] w = dict ( ) w [ 'vertices' ] = vertices w [ 'data' ] = data return w
read a w file .