

def _new_group_with_only_labels(self, labels):
    '\n        Deal with changing indices when you add and remove points. In this case\n        we only deal with building a new dataset that keeps masks.\n\n        Parameters\n        ----------\n        labels : list of `string`\n            List of strings of the labels to keep\n\n        Returns\n        -------\n        lmark_group : :map:`LandmarkGroup`\n            The new landmark group with only the requested labels.\n        '
    set_difference = set(labels).difference(self.labels)
    if (len(set_difference) > 0):
        raise ValueError('Labels {0} do not exist in the landmark group. Available labels are: {1}'.format(list(set_difference), self.labels))
    masks_to_keep = [self._labels_to_masks[l] for l in labels if (l in self._labels_to_masks)]
    overlap = (np.sum(masks_to_keep, axis=0) > 0)
    masks_to_keep = [l[overlap] for l in masks_to_keep]
    return LandmarkGroup(self._pointcloud.from_mask(set_difference), OrderedDict(zip(labels, masks_to_keep)))

dataset/ETHPy150Open menpo/menpo/menpo/landmark/base.py LandmarkGroup._new_group_with_only_labels/VarMisuse@121/340 `overlap`->`set_difference`