@verbose
    def _read_segment_file(self, data, idx, fi, start, stop, cals, mult):
        n_channels = self.info['nchan'] - 1  # Stim channel already read.
        channel_offset = self._raw_extras[0]['channel_offset']
        baselines = self._raw_extras[0]['baselines']
        stim_ch = self._raw_extras[0]['stim_channel']
        n_bytes = 2
        sel = np.arange(n_channels + 1)[idx]
        chunk_size = channel_offset * n_channels  # Size of chunks in file.
        # The data is divided into blocks of samples / channel.
        # channel_offset determines the amount of successive samples.
        # Here we use sample offset to align the data because start can be in
        # the middle of these blocks.
        data_left = (stop - start) * n_channels
        # Read up to 100 MB of data at a time, block_size is in data samples
        block_size = ((int(100e6) // 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))
                # In case channel offset and start time do not align perfectly,
                # extra sample sets are read here to cover the desired time
                # window. The whole (up to 100 MB) block is read at once and
                # then reshaped to (n_channels, n_samples).
                extra_samps = chunk_size if (s_offset != 0 or n_samps %
                                             channel_offset != 0) else 0
                if s_offset >= (channel_offset / 2):  # Extend at the end.
                    extra_samps += chunk_size
                count = n_samps // channel_offset * chunk_size + extra_samps
                n_chunks = count // chunk_size
                samps = np.fromfile(fid, dtype='<i2', count=count)
                samps = samps.reshape((n_chunks, n_channels, channel_offset),
                                      order='C')
                # Intermediate shaping to chunk sizes.
                block = np.zeros((n_channels + 1, channel_offset * n_chunks))
                for set_idx, row in enumerate(samps):  # Final shape.
                    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)
Tests checking lambda alias existence when the lambda alias already exists
dataset/ETHPy150Open mne-tools/mne-python/mne/io/cnt/cnt.py/RawCNT._read_segment_file--crossover with--dataset/ETHPy150Open saltstack/salt/tests/unit/modules/boto_lambda_test.py/BotoLambdaAliasTestCase.test_that_when_checking_if_an_alias_exists_and_the_alias_exists_the_alias_exists_method_returns_true