'Take a chunk of raw data, multiply by mult or cals, and store.'

@verbose
def _read_segment_file(self, data, idx, fi, start, stop, cals, mult):

    n_channels = (self.info['nchan'] - 1)
    channel_offset = self._raw_extras[0]['channel_offset']
    baselines = self._raw_extras[0]['baselines']
    stim_ch = self._raw_extras[0]['stim_channel']
    n_bytes = self._raw_extras[0]['n_bytes']
    dtype = ('<i4' if (n_bytes == 4) else '<i2')
    sel = np.arange((n_channels + 1))[idx]
    chunk_size = (channel_offset * n_channels)
    data_left = ((stop - start) * n_channels)
    block_size = (((int(100000000.0) // n_bytes) // chunk_size) * chunk_size)
    block_size = min(data_left, block_size)
    s_offset = (start % channel_offset)
    with open(self._filenames[fi], 'rb', buffering=0) as fid:
        fid.seek((900 + (n_channels * (75 + ((start - s_offset) * n_bytes)))))
        for sample_start in (np.arange(0, data_left, block_size) // n_channels):
            sample_stop = (sample_start + min(((block_size // n_channels), ((data_left // n_channels) - sample_start))))
            n_samps = (sample_stop - sample_start)
            data_ = np.empty(((n_channels + 1), n_samps))
            extra_samps = (chunk_size if ((s_offset != 0) or ((n_samps % channel_offset) != 0)) else 0)
            if (s_offset >= (channel_offset / 2)):
                extra_samps += chunk_size
            count = (((n_samps // channel_offset) * chunk_size) + extra_samps)
            n_chunks = (count // chunk_size)
            samps = np.fromfile(fid, dtype=dtype, count=count)
            samps = samps.reshape((n_chunks, n_channels, channel_offset), order='C')
            block = np.zeros(((n_channels + 1), (channel_offset * n_chunks)))
            for (set_idx, row) in enumerate(samps):
                block_slice = slice((set_idx * channel_offset), ((set_idx + 1) * channel_offset))
                block[:(-1), block_slice] = row
            block = block[sel, s_offset:(n_samps + s_offset)]
            data_[sel] = block
            data_[(-1)] = stim_ch[(start + sample_start):(start + sample_stop)]
            data_[sel] -= baselines[sel][:, None]
            _mult_cal_one(data[:, sample_start:sample_stop], data_, idx, cals, mult=None)
