def sleep_onset_latency(predictions):
    """
    Calculates sleep onset latency on an array of sleep/wake predictions in one minute epochs. This corresponds to the
    total number of minutes awake before the first sleep period.

    Parameters
    ----------
    predictions : array-like
        Binary sleep/wake predictions. Awake encoded as 1 and sleep as 0.

    Returns
    -------
    sol : int
        Total number of minutes spent awake before the first sleep period.

    """
    first_sleep_epoch = predictions.argmin()
    sol = predictions[0:first_sleep_epoch].sum()
    return int(sol)