from typing import List


def group_consecutives(vals: List[float], step=1):
    """
    Function to group all consecutive values in a list together. The primary purpose of this
    is to split concatenated spectra that are given in a single list of frequencies
    into individual windows.
    
    Parameters
    ----------
    vals : list
        List of floats to be split
    step : int, optional
        [description], by default 1
    
    Returns
    -------
    [type]
        [description]
    """
    run = []
    result = [run]
    expect = None
    for v in vals:
        if (v == expect) or (expect is None):
            run.append(v)
        else:
            run = [v]
            result.append(run)
        expect = v + step
    return result