'Read epochs data.
Returns
data : array, [channels x samples]
the data matrix (channels x samples).
times : array, [samples]
returns the time values corresponding to the samples.'

def _read_kit_data(self):

    epoch_length = self._raw_extras[0]['frame_length']
    n_epochs = self._raw_extras[0]['n_epochs']
    n_samples = self._raw_extras[0]['n_samples']
    filename = self._raw_extras[0]['filename']
    with open(filename, 'rb', buffering=0) as fid:
        data_offset = self._raw_extras[0]['data_offset']
        dtype = self._raw_extras[0]['dtype']
        fid.seek(data_offset)
        data_offset = unpack('i', fid.read(KIT.INT))[0]
        nchan = self._raw_extras[0]['nchan']
        count = (n_samples * nchan)
        fid.seek(data_offset)
        data = np.fromfile(fid, dtype=dtype, count=count)
        data = data.reshape((n_samples, nchan))
    n_sens = self._raw_extras[0]['n_sens']
    sensor_gain = np.copy(self._raw_extras[0]['sensor_gain'])
    sensor_gain[:n_sens] = (sensor_gain[:n_sens] / self._raw_extras[0]['amp_gain'])
    conv_factor = np.array(((KIT.VOLTAGE_RANGE / self._raw_extras[0]['DYNAMIC_RANGE']) * sensor_gain), ndmin=2)
    data = (conv_factor * data)
    data = data.T
    data = data.reshape((nchan, n_epochs, epoch_length))
    data = data.transpose((1, 0, 2))
    return data
