def get_epochs_given_midtimes_and_period(<EOL>t_mid,<EOL>period,<EOL>err_t_mid=None,<EOL>t0_fixed=None,<EOL>t0_percentile=None,<EOL>verbose=False<EOL>):
kwargarr = np.array([isinstance(err_t_mid,np.ndarray),<EOL>t0_fixed,<EOL>t0_percentile])<EOL>if not _single_true(kwargarr) and not np.all(~kwargarr.astype(bool)):<EOL><INDENT>raise AssertionError(<EOL>'<STR_LIT>')<EOL><DEDENT>t_mid = t_mid[np.isfinite(t_mid)]<EOL>N_midtimes = len(t_mid)<EOL>if t0_fixed:<EOL><INDENT>t0 = t0_fixed<EOL><DEDENT>elif isinstance(err_t_mid,np.ndarray):<EOL><INDENT>t0_avg = np.average(t_mid, weights=<NUM_LIT:1>/err_t_mid**<NUM_LIT:2>)<EOL>t0_options = np.arange(min(t_mid), max(t_mid)+period, period)<EOL>t0 = t0_options[np.argmin(np.abs(t0_options - t0_avg))]<EOL><DEDENT>else:<EOL><INDENT>if not t0_percentile:<EOL><INDENT>if N_midtimes % <NUM_LIT:2> == <NUM_LIT:1>:<EOL><INDENT>t0 = np.median(t_mid)<EOL><DEDENT>else:<EOL><INDENT>t0 = t_mid[int(N_midtimes/<NUM_LIT:2>)]<EOL><DEDENT><DEDENT>else:<EOL><INDENT>t0 = np.sort(t_mid)[int(N_midtimes*t0_percentile/<NUM_LIT:100>)]<EOL><DEDENT><DEDENT>epoch = (t_mid - t0)/period<EOL>int_epoch = np.round(epoch, <NUM_LIT:0>)<EOL>if verbose:<EOL><INDENT>LOGINFO('<STR_LIT>')<EOL>LOGINFO('<STR_LIT>'.format(repr(epoch)))<EOL>LOGINFO('<STR_LIT>')<EOL>LOGINFO('<STR_LIT>'.format(repr(int_epoch)))<EOL><DEDENT>return int_epoch, t0<EOL>
This calculates the future epochs for a transit, given a period and a
    starting epoch

    The equation used is::

        t_mid = period*epoch + t0

    Default behavior if no kwargs are used is to define `t0` as the median
    finite time of the passed `t_mid` array.

    Only one of `err_t_mid` or `t0_fixed` should be passed.

    Parameters
    ----------

    t_mid : np.array
        A np.array of transit mid-time measurements

    period : float
        The period used to calculate epochs, per the equation above. For typical
        use cases, a period precise to ~1e-5 days is sufficient to get correct
        epochs.

    err_t_mid : None or np.array
        If provided, contains the errors of the transit mid-time
        measurements. The zero-point epoch is then set equal to the average of
        the transit times, weighted as `1/err_t_mid^2` . This minimizes the
        covariance between the transit epoch and the period (e.g., Gibson et
        al. 2013). For standard O-C analysis this is the best method.

    t0_fixed : None or float:
        If provided, use this t0 as the starting epoch. (Overrides all others).

    t0_percentile : None or float
        If provided, use this percentile of `t_mid` to define `t0`.

    Returns
    -------

    tuple
        This is the of the form `(integer_epoch_array, t0)`.
        `integer_epoch_array` is an array of integer epochs (float-type),
        of length equal to the number of *finite* mid-times passed.