@verbose
    def apply_function(self, fun, picks, dtype, n_jobs, *args, **kwargs):
        _check_preload(self, 'raw.apply_function')
        if picks is None:
            picks = _pick_data_channels(self.info, exclude=[],
                                        with_ref_meg=False)

        if not callable(fun):
            raise ValueError('fun needs to be a function')

        data_in = self._data
        if dtype is not None and dtype != self._data.dtype:
            self._data = self._data.astype(dtype)

        if n_jobs == 1:
            # modify data inplace to save memory
            for idx in picks:
                self._data[idx, :] = _check_fun(fun, data_in[idx, :],
                                                *args, **kwargs)
        else:
            # use parallel function
            parallel, p_fun, _ = parallel_func(_check_fun, n_jobs)
            data_picks_new = parallel(p_fun(fun, data_in[p], *args, **kwargs)
                                      for p in picks)
            for pp, p in enumerate(picks):
                self._data[p, :] = data_picks_new[pp]
Apply a function to a subset of channels.
dataset/ETHPy150Open mne-tools/mne-python/mne/io/base.py/_BaseRaw.apply_function