crop_empty_data

crop_empty_data(raw: Raw, bound: str = 'boundary', start_pad: str = '10s', end_pad: str = '10s') Raw[source][source]

Crops out long stretches of data with no events.

Takes raw instance with annotated events and crops the instance so that the raw file starts at start_pad before the first event and stops an amount of time in seconds given by end_pad after the last event.

Parameters:
  • raw (mne.io.Raw) – The raw file to crop.

  • bound (str, optional) – The annotation description to use as a boundary, by default ‘boundary’

  • start_pad (str, optional) – The amount of time to pad the start of the file, by default “10s”

  • end_pad (str, optional) – The amount of time to pad the end of the file, by default “10s”

Returns:

The cropped raw file.

Return type:

mne.io.Raw

Examples

>>> import mne
>>> from ieeg.io import raw_from_layout
>>> bids_root = mne.datasets.epilepsy_ecog.data_path(verbose=False)
>>> layout = BIDSLayout(bids_root)
>>> raw = raw_from_layout(layout, subject="pt1", preload=True,
... extension=".vhdr", verbose=False)
Reading 0 ... 269079  =      0.000 ...   269.079 secs...
>>> cropped = crop_empty_data(raw, 'onset')
>>> cropped.times[0], cropped.times[-1]
(0.0, 104.94)