eelbrain.load.fiff.add_epochs

eelbrain.load.fiff.add_epochs(ds, tmin=- 0.1, tmax=0.6, baseline=None, decim=1, mult=1, proj=False, data=None, reject=None, exclude='bads', info=None, name='meg', raw=None, sensors=None, i_start='i_start', sysname=None, tstop=None)

Load epochs and add them to a dataset as NDVar.

Unless the reject argument is specified, ds is modified in place. With reject, a subset of ds is returned containing only those events for which data was loaded.

Parameters
  • ds (Dataset) – Dataset containing a variable which defines epoch cues (i_start) and to which the epochs are added.

  • tmin (scalar) – First sample to include in the epochs in seconds (Default is -0.1).

  • tmax (scalar) – Last sample to include in the epochs in seconds (Default 0.6; use tstop instead to specify index exclusive of last sample).

  • baseline ((float, float) | None) – Time interval for baseline correction. (tmin, tmax) tuple in seconds, or None to use all the data (e.g., (None, 0) uses all the data from the beginning of the epoch up to t = 0). Set to None for no baseline correction (default).

  • decim (int) – Downsample the data by this factor when importing. 1 means no downsampling. Note that this function does not low-pass filter the data. The data is downsampled by picking out every n-th sample (see Wikipedia).

  • mult (scalar) – multiply all data by a constant.

  • proj (bool) – mne.Epochs kwarg (subtract projections when loading data)

  • data ('eeg' | 'mag' | 'grad') – Which data channels data to include (default based on channels in data).

  • reject (None | scalar) – Threshold for rejecting epochs (peak to peak). Requires a for of mne-python which implements the Epochs.model[‘index’] variable.

  • exclude (list of string | str) – Channels to exclude (mne.pick_types() kwarg). If ‘bads’ (default), exclude channels in info[‘bads’]. If empty do not exclude any.

  • info (None | dict) – Entries for the ndvar’s info dict.

  • name (str) – name for the new NDVar.

  • raw (None | mne Raw) – Raw file providing the data; if None, ds.info['raw'] is used.

  • sensors (None | Sensor) – The default (None) reads the sensor locations from the fiff file. If the fiff file contains incorrect sensor locations, a different Sensor instance can be supplied through this kwarg.

  • i_start (str) – name of the variable containing the index of the events.

  • sysname (str) – Name of the sensor system to load sensor connectivity (e.g. ‘neuromag’, inferred automatically for KIT data converted with a recent version of MNE-Python).

  • tstop (scalar) – Alternative to tmax: While tmax specifies the last samples to include, tstop can be used to specify the epoch time excluding the last time point (i.e., standard Python/Eelbrain indexing convention). For example, at 100 Hz the epoch with tmin=-0.1, tmax=0.4 will have 51 samples, while the epoch specified with tmin=-0.1, tstop=0.4 will have 50 samples.

Returns

ds – Dataset containing the epochs. If no events are rejected, ds is the same object as the input ds argument, otherwise a copy of it.

Return type

Dataset