def wake_after_sleep_onset(predictions):
    """
    Calculates number of minutes awake after first sleep period on an array of sleep/wake predictions in one minute
    epochs. Value is exclusive of the last wake period after sleep.

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

    Returns
    -------
    waso : int
        Total number of minutes spent awake after the first sleep period.

    """
    first_sleep_epoch = predictions.argmin()
    last_sleep_epoch = predictions[::-1].argmin()
    waso = predictions[first_sleep_epoch : -1 - last_sleep_epoch]
    waso = waso.sum()

    return int(waso)