

def with_labels(self, labels=None):
    'A new landmark group that contains only the certain labels\n\n        Parameters\n        ----------\n        labels : `str` or `list` of `str`, optional\n            Labels that should be kept in the returned landmark group. If\n            ``None`` is passed, and if there is only one label on this group,\n            the label will be substituted automatically.\n\n        Returns\n        -------\n        landmark_group : :map:`LandmarkGroup`\n            A new landmark group with the same group label but containing only\n            the given label.\n        '
    if (labels is None):
        if (self.n_labels == 1):
            labels = self.labels
        else:
            raise ValueError('Cannot use None as there are {} labels'.format(self.n_labels))
    if isinstance(labels, str):
        labels = [labels]
    return self._new_group_with_only_labels(labels)

dataset/ETHPy150Open menpo/menpo/menpo/landmark/base.py LandmarkGroup.with_labels/original