def read_channels(self, fid):
bones = [[] for i in self.vertices]<EOL>num_channels = <NUM_LIT:0><EOL>for vertex in self.vertices:<EOL><INDENT>num_channels = num_channels + len(vertex.meta['<STR_LIT>'])<EOL><DEDENT>lin = self.read_line(fid)<EOL>while lin != '<STR_LIT>':<EOL><INDENT>lin = self.read_line(fid)<EOL>if lin == '<STR_LIT>':<EOL><INDENT>raise ValueError('<STR_LIT>' + fid.name)<EOL><DEDENT><DEDENT>counter = <NUM_LIT:0><EOL>lin = self.read_line(fid)<EOL>while lin:<EOL><INDENT>parts = lin.split()<EOL>if len(parts)==<NUM_LIT:1>:<EOL><INDENT>frame_no = int(parts[<NUM_LIT:0>])<EOL>if frame_no:<EOL><INDENT>counter += <NUM_LIT:1><EOL>if counter != frame_no:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT><DEDENT>else:<EOL><INDENT>ind = self.get_index_by_name(parts[<NUM_LIT:0>])<EOL>bones[ind].append(np.array([float(channel) for channel in parts[<NUM_LIT:1>:]]))<EOL><DEDENT>lin = self.read_line(fid)<EOL><DEDENT>num_frames = counter<EOL>channels = np.zeros((num_frames, num_channels))<EOL>end_val = <NUM_LIT:0><EOL>for i in range(len(self.vertices)):<EOL><INDENT>vertex = self.vertices[i]<EOL>if len(vertex.meta['<STR_LIT>'])><NUM_LIT:0>:                <EOL><INDENT>start_val = end_val<EOL>end_val = end_val + len(vertex.meta['<STR_LIT>'])<EOL>for j in range(num_frames):<EOL><INDENT>channels[j, start_val:end_val] = bones[i][j]<EOL><DEDENT><DEDENT>self.resolve_indices(i, start_val)<EOL><DEDENT>self.smooth_angle_channels(channels)<EOL>return channels<EOL>
Read channels from an acclaim file.