def read_data(self, file_handle):
self._verify_assumptions()<EOL>text = self.annotation<EOL>if (self._data_start > self._file_size) or (self._data_end > self._file_size):<EOL><INDENT>raise ValueError(u'<STR_LIT>'<EOL>u'<STR_LIT>'.format(self.path))<EOL><DEDENT>num_events = text['<STR_LIT>']  <EOL>num_pars = text['<STR_LIT>']  <EOL>if text['<STR_LIT>'].strip() == '<STR_LIT>' or text['<STR_LIT>'].strip() == '<STR_LIT>':<EOL><INDENT>endian = '<STR_LIT:<>'<EOL><DEDENT>elif text['<STR_LIT>'].strip() == '<STR_LIT>' or text['<STR_LIT>'].strip() == '<STR_LIT>':<EOL><INDENT>endian = '<STR_LIT:>>'<EOL><DEDENT>else:<EOL><INDENT>msg = '<STR_LIT>'.format(text['<STR_LIT>'])<EOL>raise ParserFeatureNotImplementedError(msg)<EOL><DEDENT>conversion_dict = {'<STR_LIT:F>': '<STR_LIT:f>', '<STR_LIT:D>': '<STR_LIT:f>', '<STR_LIT:I>': '<STR_LIT:u>'}<EOL>if text['<STR_LIT>'] not in conversion_dict.keys():<EOL><INDENT>raise ParserFeatureNotImplementedError('<STR_LIT>'<EOL>'<STR_LIT>'.format(text['<STR_LIT>']))<EOL><DEDENT>bytes_per_par_list = [int(text['<STR_LIT>'.format(i)] / <NUM_LIT:8>) for i in self.channel_numbers]<EOL>par_numeric_type_list = [<EOL>'<STR_LIT>'.format(endian=endian,<EOL>type=conversion_dict[text['<STR_LIT>']],<EOL>size=bytes_per_par)<EOL>for bytes_per_par in bytes_per_par_list<EOL>]<EOL>file_handle.seek(self._data_start, <NUM_LIT:0>)  <EOL>if len(set(par_numeric_type_list)) > <NUM_LIT:1>:<EOL><INDENT>dtype = '<STR_LIT:U+002C>'.join(par_numeric_type_list)<EOL>data = fromfile(file_handle, dtype, num_events)<EOL>names = self.get_channel_names()<EOL>if six.PY2:<EOL><INDENT>encoded_names = [name.encode('<STR_LIT:ascii>', errors='<STR_LIT:replace>') for name in names]<EOL><DEDENT>else:  <EOL><INDENT>encoded_names = [name for name in names]<EOL><DEDENT>data.dtype.names = tuple(encoded_names)<EOL><DEDENT>else:<EOL><INDENT>dtype = par_numeric_type_list[<NUM_LIT:0>]<EOL>data = fromfile(file_handle, dtype, num_events * num_pars)<EOL>data = data.reshape((num_events, num_pars))<EOL><DEDENT>native_code = '<STR_LIT:<>' if (sys.byteorder == '<STR_LIT>') else '<STR_LIT:>>'<EOL>if endian != native_code:<EOL><INDENT>data = data.byteswap().newbyteorder()<EOL><DEDENT>self._data = data<EOL>
Read the DATA segment of the FCS file.