def set_to_dm_limits(ptt_list, limit=5.):
    """
    Check that the values for piston, tip, and tilt are not exceeding the hardware
    limit and reset to limit if limit is exceeded. These limits are the same as what
    the IrisAO GUI has set.

    :param ppt_list: list, of tuples existing of piston, tip, tilt, values for each
                     segment in a pupil, in DM units
    :param limit: float, in DM units. Default = 5.
    :return: list of tuples of the piston, tip, tilt values in DM units for each segment listed
             such that none of the values exceed the limit
    """
    updated = [tuple(min(i, limit) for i in ptt) for ptt in ptt_list]

    return updated