def sort_trace(lof,powers):
    """Function that sorts traces organised with random pump powers
    Params:
    lof: List of files
    powers: List of powers in randomised order

    Returns:
        lof_s: Dictionary of sorted list of files, in order of lowest to highest power"""
    inds = sorted(zip(powers,range(len(powers))))
    s_inds = [s[1] for s in inds]

    lof_s ={}
    powers = sorted(powers)
    for i, k in zip(s_inds,powers):
        lof_s[k] = lof[i]
    return lof_s