def reorder_array(array, old_ids, new_ids):
    """Reorders a numpy array based on two lists of ids.
    The old_ids contains the ids of the elements currently in array.
    new_ids is the desired order. Elements and sizes must match!
    """
    if type(old_ids) not in [list, tuple]:
        old_ids = list(old_ids)  # Needs to have the index method
    permut = [old_ids.index(ni) for ni in new_ids]
    return array[permut]