ftag.labeller ============= .. py:module:: ftag.labeller Classes ------- .. autoapisummary:: ftag.labeller.Labeller Module Contents --------------- .. py:class:: Labeller Defines a labelling scheme. Classes are assigned integer labels in [0, ..., n] based on pre-defined selections. .. attribute:: labels The labels to be use. :type: LabelContainer | list[str | Label] .. attribute:: require_labels Whether to require that all objects are labelled. :type: bool .. py:attribute:: labels :type: ftag.labels.LabelContainer | list[str | ftag.labels.Label] .. py:attribute:: require_labels :type: bool :value: True .. py:method:: __post_init__() -> None .. py:property:: variables :type: list[str] Returns the variables used for labelling. :returns: The variables used for labelling. :rtype: list[str] .. py:method:: get_labels(array: numpy.ndarray) -> numpy.ndarray Returns the labels for the given array. :param array: The array to label. :type array: np.ndarray :returns: The labels for the given array. :rtype: np.ndarray :raises ValueError: If the `require_labels` attribute is set to `True` and some objects were not labelled. .. py:method:: add_labels(array: numpy.ndarray, label_name: str = 'labels') -> numpy.ndarray Adds the labels to the given array. :param array: The array to label. :type array: np.ndarray :param label_name: The name of the label column. :type label_name: str :returns: The array with the labels added. :rtype: np.ndarray :raises ValueError: If the `require_labels` attribute is set to `False`.