def drop_non_active_basis_functions(basis):
    """Remove all basis functions with no eci value and reindex the basis
    in a sequential order. New field is entered to remember what the old
    index used to be

    Parameters
    ----------
    basis : json (eci.json file content)

    Returns
    -------
    json

    """

    active_cf=[cf for cf in basis["cluster_functions"] if "eci" in cf]
    basis["cluster_functions"]=active_cf

    #reindex basis functions...
    for ix,cf in enumerate(basis["cluster_functions"]):
        old_ix=cf["linear_function_index"]
        cf["reindexed_from"]=old_ix
        cf["linear_function_index"]=ix

    return basis