def compute_response_integral(X, stim_frames):
    """
    Compute the integrated/summed response over all stimulus frames

    Arguments:
        X (array): dF/F of size (trials, time frames, boutons)
        stim_frames (array): time frames w/ stimulus
    Returns:
        Xint (array): summed dF/F during stim frames, size (trials, boutons)
    """
    assert len(stim_frames) > 0
    assert stim_frames[0] > 0
    assert stim_frames[-1] < X.shape[1]
    return X[:,stim_frames].sum(1)