def estimate_infectious_rate_constant(events,
                                      t_start,
                                      t_end,
                                      kernel_integral,
                                      count_events=None):
    """
    Returns estimation of infectious rate for given events on defined interval.
    The infectious is expected to be constant on given interval.

    :param events: array of event tuples containing (event_time, follower_cnt)
    :param t_start: time interval start
    :param t_end: time interval end
    :param kernel_integral: integral function of kernel function
    :param count_events: count of observed events in interval (used for time window approach)
    :return: estimated value for infectious rate
    """
    kernel_int = [
        fol_cnt * kernel_integral(t_start - event_time, t_end - event_time)
        for event_time, fol_cnt in events
    ]
    if count_events is not None:
        return count_events / sum(kernel_int)
    else:
        return (len(events)) / sum(kernel_int)