def eda_EventRelated(epoch, event_length, window_post=4):
    """
    Extract event-related EDA and Skin Conductance Response (SCR).

    Parameters
    ----------
    epoch : pandas.DataFrame
        An epoch contains in the epochs dict returned by :function:`neurokit.create_epochs()` on dataframe returned by :function:`neurokit.bio_process()`. Index must range from -4s to +4s (relatively to event onset and end).
    event_length : int
        Event's length in seconds.
    window_post : float
        Post-stimulus window size (in seconds) to include eventual responses (usually 3 or 4).

    Returns
    ----------
    EDA_Response : dict
        Event-related EDA response features.

    Example
    ----------
    >>> import neurokit as nk
    >>> bio = nk.bio_process(ecg=data["ECG"], rsp=data["RSP"], eda=data["EDA"], sampling_rate=1000, add=data["Photosensor"])
    >>> df = bio["df"]
    >>> events = nk.find_events(df["Photosensor"], cut="lower")
    >>> epochs = nk.create_epochs(df, events["onsets"], duration=7, onset=-0.5)
    >>> for epoch in epochs:
    >>>     bio_response = nk.bio_EventRelated(epoch, event_length=4, window_post=3)

    Notes
    ----------
    **Looking for help**: *Experimental*: respiration artifacts correction needs to be implemented.

    *Details*

    - **EDA_Peak**: Max of EDA (in a window starting 1s after the stim onset) minus baseline.
    - **SCR_Amplitude**: Peak of SCR. If no SCR, returns NA.
    - **SCR_Magnitude**: Peak of SCR. If no SCR, returns 0.
    - **SCR_Amplitude_Log**: log of 1+amplitude.
    - **SCR_Magnitude_Log**: log of 1+magnitude.
    - **SCR_PeakTime**: Time of peak.
    - **SCR_Latency**: Time between stim onset and SCR onset.
    - **SCR_RiseTime**: Time between SCR onset and peak.
    - **SCR_Strength**: *Experimental*: peak divided by latency. Angle of the line between peak and onset.
    - **SCR_RecoveryTime**: Time between peak and recovery point (half of the amplitude).


    *Authors*

    - `Dominique Makowski <https://dominiquemakowski.github.io/>`_

    *Dependencies*

    - numpy
    - pandas

    *See Also*

    - https://www.biopac.com/wp-content/uploads/EDA-SCR-Analysis.pdf

    References
    -----------
    - Schneider, R., Schmidt, S., Binder, M., Schäfer, F., & Walach, H. (2003). Respiration-related artifacts in EDA recordings: introducing a standardized method to overcome multiple interpretations. Psychological reports, 93(3), 907-920.
    - Leiner, D., Fahr, A., & Früh, H. (2012). EDA positive change: A simple algorithm for electrodermal activity to measure general audience arousal during media exposure. Communication Methods and Measures, 6(4), 237-250.
    """
    # Initialization
    EDA_Response = {}
    window_end = event_length + window_post

    # Sanity check
    if epoch.index[-1]-event_length < 1:
        print("NeuroKit Warning: eda_EventRelated(): your epoch only lasts for about %.2f s post stimulus. You might lose some SCRs." %(epoch.index[-1]-event_length))


    # EDA Based
    # =================
    # This is a basic and bad model
    if "EDA_Filtered" in epoch.columns:
        baseline = epoch["EDA_Filtered"][0:1].min()
        eda_peak = epoch["EDA_Filtered"][1:window_end].max()
        EDA_Response["EDA_Peak"] = eda_peak - baseline


    # SCR Based
    # =================
    if "SCR_Onsets" in epoch.columns:
        # Computation
        peak_onset = epoch["SCR_Onsets"][1:window_end].idxmax()
        if pd.notnull(peak_onset):
            amplitude = epoch["SCR_Peaks"][peak_onset:window_end].max()
            peak_time = epoch["SCR_Peaks"][peak_onset:window_end].idxmax()

            if pd.isnull(amplitude):
                magnitude = 0
            else:
                magnitude = amplitude

            risetime = peak_time - peak_onset
            if risetime > 0:
                strength = magnitude/risetime
            else:
                strength = np.nan

            if pd.isnull(peak_time) is False:
                recovery = epoch["SCR_Recoveries"][peak_time:window_end].idxmax() - peak_time
            else:
                recovery = np.nan

        else:
            amplitude = np.nan
            magnitude = 0
            risetime = np.nan
            strength = np.nan
            peak_time = np.nan
            recovery = np.nan

        # Storage
        EDA_Response["SCR_Amplitude"] = amplitude
        EDA_Response["SCR_Magnitude"] = magnitude
        EDA_Response["SCR_Amplitude_Log"] = np.log(1+amplitude)
        EDA_Response["SCR_Magnitude_Log"] = np.log(1+magnitude)
        EDA_Response["SCR_Latency"] = peak_onset
        EDA_Response["SCR_PeakTime"] = peak_time
        EDA_Response["SCR_RiseTime"] = risetime
        EDA_Response["SCR_Strength"] = strength  # Experimental
        EDA_Response["SCR_RecoveryTime"] = recovery




    # Artifact Correction
    # ====================
    # TODO !!
    # Respiration artifacts
#    if "RSP_Filtered" in epoch.columns:
#        pass  # I Dunno, maybe with granger causality or something?


    return(EDA_Response)
Extract event-related EDA and Skin Conductance Response (SCR).

    Parameters
    ----------
    epoch : pandas.DataFrame
        An epoch contains in the epochs dict returned by :function:`neurokit.create_epochs()` on dataframe returned by :function:`neurokit.bio_process()`. Index must range from -4s to +4s (relatively to event onset and end).
    event_length : int
        Event's length in seconds.
    window_post : float
        Post-stimulus window size (in seconds) to include eventual responses (usually 3 or 4).

    Returns
    ----------
    EDA_Response : dict
        Event-related EDA response features.

    Example
    ----------
    >>> import neurokit as nk
    >>> bio = nk.bio_process(ecg=data["ECG"], rsp=data["RSP"], eda=data["EDA"], sampling_rate=1000, add=data["Photosensor"])
    >>> df = bio["df"]
    >>> events = nk.find_events(df["Photosensor"], cut="lower")
    >>> epochs = nk.create_epochs(df, events["onsets"], duration=7, onset=-0.5)
    >>> for epoch in epochs:
    >>>     bio_response = nk.bio_EventRelated(epoch, event_length=4, window_post=3)

    Notes
    ----------
    **Looking for help**: *Experimental*: respiration artifacts correction needs to be implemented.

    *Details*

    - **EDA_Peak**: Max of EDA (in a window starting 1s after the stim onset) minus baseline.
    - **SCR_Amplitude**: Peak of SCR. If no SCR, returns NA.
    - **SCR_Magnitude**: Peak of SCR. If no SCR, returns 0.
    - **SCR_Amplitude_Log**: log of 1+amplitude.
    - **SCR_Magnitude_Log**: log of 1+magnitude.
    - **SCR_PeakTime**: Time of peak.
    - **SCR_Latency**: Time between stim onset and SCR onset.
    - **SCR_RiseTime**: Time between SCR onset and peak.
    - **SCR_Strength**: *Experimental*: peak divided by latency. Angle of the line between peak and onset.
    - **SCR_RecoveryTime**: Time between peak and recovery point (half of the amplitude).


    *Authors*

    - `Dominique Makowski <https://dominiquemakowski.github.io/>`_

    *Dependencies*

    - numpy
    - pandas

    *See Also*

    - https://www.biopac.com/wp-content/uploads/EDA-SCR-Analysis.pdf

    References
    -----------
    - Schneider, R., Schmidt, S., Binder, M., Schäfer, F., & Walach, H. (2003). Respiration-related artifacts in EDA recordings: introducing a standardized method to overcome multiple interpretations. Psychological reports, 93(3), 907-920.
    - Leiner, D., Fahr, A., & Früh, H. (2012). EDA positive change: A simple algorithm for electrodermal activity to measure general audience arousal during media exposure. Communication Methods and Measures, 6(4), 237-250.