'Read a chunk of raw data.'

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

    si = self._raw_extras[fi]
    offset = 0
    (trial_start_idx, r_lims, d_lims) = _blk_read_lims(start, stop, int(si['block_size']))
    with open(self._filenames[fi], 'rb') as fid:
        for bi in range(len(r_lims)):
            samp_offset = ((bi + trial_start_idx) * si['res4_nsamp'])
            n_read = min((si['n_samp_tot'] - samp_offset), si['block_size'])
            pos = CTF.HEADER_SIZE
            pos += ((samp_offset * si['n_chan']) * 4)
            fid.seek(pos, 0)
            this_data = np.fromfile(fid, '>i4', count=(si['n_chan'] * n_read))
            this_data.shape = (si['n_chan'], n_read)
            this_data = this_data[:, r_lims[(bi, 0)]:r_lims[(bi, 1)]]
            data_view = data[:, d_lims[(bi, 0)]:d_lims[(bi, 1)]]
            _mult_cal_one(data_view, this_data, idx, cals, mult)
            offset += n_read
