def make_profile_mask(ref_2d_profile, threshold=1e-3):
    """Build a mask of the trace based on the 2D profile reference file.

    :param ref_2d_profile: the 2d trace profile reference.
    :param threshold: threshold value for excluding pixels based on
        ref_2d_profile.
    
    :type ref_2d_profile: array[float]
    :type threshold: float

    :returns: bkg_mask - Masks pixels in the trace based on the 2d profile
        reference file.
    :rtype: array[bool]
    """

    bkg_mask = (ref_2d_profile > threshold)

    return bkg_mask