plaid.containers.features.scalars ================================= .. py:module:: plaid.containers.features.scalars .. autoapi-nested-parse:: Module for implementing collections of features within a Sample. Classes ------- .. autoapisummary:: plaid.containers.features.scalars.SampleScalars Module Contents --------------- .. py:class:: SampleScalars(scalars: Optional[dict[str, plaid.types.Scalar]]) A container for scalar features within a Sample. Provides dict-like operations for adding, retrieving, and removing scalars. Names must be unique and may not contain the character ``/``. :param scalars: a dict containing the pairs of (name, value) for each scalar in the `Sample`. :type scalars: dict[str, Scalar], optional .. py:attribute:: data :type: dict[str, plaid.types.Scalar] .. py:method:: add(name: str, value: plaid.types.Scalar) -> None Add a scalar value to a dictionary. :param name: The name of the scalar value. :type name: str :param value: The scalar value to add or update in the dictionary. :type value: Scalar .. py:method:: remove(name: str) -> plaid.types.Scalar Delete a scalar value from the dictionary. :param name: The name of the scalar value to be deleted. :type name: str :raises KeyError: Raised when there is no scalar / there is no scalar with the provided name. :returns: The value of the deleted scalar. :rtype: Scalar .. py:method:: get(name: str) -> Optional[plaid.types.Scalar] Retrieve a scalar value associated with the given name. :param name: The name of the scalar value to retrieve. :type name: str :returns: The scalar value associated with the given name, or None if the name is not found. :rtype: Scalar or None .. py:method:: get_names() -> list[str] Get a set of scalar names available in the object. :returns: A set containing the names of the available scalars. :rtype: list[str]