# AUTOGENERATED! DO NOT EDIT! File to edit: ../../notebooks/21_event.ipynb.

# %% auto 0
__all__ = ['get_event_data']

# %% ../../notebooks/21_event.ipynb 1
import xarray as xr

# %% ../../notebooks/21_event.ipynb 3
def get_event_data(
    event: dict, data: xr.DataArray, neighbor: int = 0
) -> xr.DataArray:
    duration = event["tstop"] - event["tstart"]
    offset = neighbor * duration
    temp_tstart = event["tstart"] - offset
    temp_tstop = event["tstop"] + offset

    return data.sel(time=slice(temp_tstart, temp_tstop))
