Exemplo n.º 1
0
    def __init__(self,
                 session,
                 value_dict,
                 max_neighbors=None,
                 max_distance=None):
        """Creates a Song (a set of attributes) that behaves like a dictionary:

        :param session: A Session objective (the session this song belongs to)
        :type session: :class:`munin.session.Session`
        :param value_dict: A mapping from the keys to the values you want to set.
        :type value_dict: Mapping
        :param max_neighbors: max. numbers of neighbor-distances to save.
        :type neighbor: positive int
        :param max_distance: The minimal distance for :func:`distance_add` -
                             You should try to keep this small (i.e. to only
                             filter 1.0 distances)
        :type max_distance: float
        """
        # Make sure the list is as long as the mask
        SessionMapping.__init__(self,
                                session,
                                input_dict=value_dict,
                                default_value=None)
        self._dist_dict = OrderedDict()
        self._reset_invariants()

        # Settings:
        self._max_neighbors = max_neighbors or session.config['max_neighbors']
        self._max_distance = max_distance or session.config['max_distance']
        self.uid = None
Exemplo n.º 2
0
    def __init__(self, session, value_dict, max_neighbors=None, max_distance=None):
        """Creates a Song (a set of attributes) that behaves like a dictionary:

        :param session: A Session objective (the session this song belongs to)
        :type session: :class:`munin.session.Session`
        :param value_dict: A mapping from the keys to the values you want to set.
        :type value_dict: Mapping
        :param max_neighbors: max. numbers of neighbor-distances to save.
        :type neighbor: positive int
        :param max_distance: The minimal distance for :func:`distance_add` -
                             You should try to keep this small (i.e. to only
                             filter 1.0 distances)
        :type max_distance: float
        """
        # Make sure the list is as long as the mask
        SessionMapping.__init__(
            self, session,
            input_dict=value_dict,
            default_value=None
        )
        self._dist_dict = OrderedDict()
        self._reset_invariants()

        # Settings:
        self._max_neighbors = max_neighbors or session.config['max_neighbors']
        self._max_distance = max_distance or session.config['max_distance']
        self.uid = None
Exemplo n.º 3
0
    def __init__(self, session, dist_dict):
        """A Distance saves the distances created by providers and boil it down
        to a single distance float by weighting the individual distances of each
        song's attributes and building the average of it.

        :param session: The session this distance belongs to. Only valid in it.
        :type session: Instance of :class:`munin.session.Session`
        :param dist_dict: A mapping to read the distance values from.
        :type dist_dict: mapping<str, float>
        """
        # Use only a list internally to save the values.
        # Keys are stored shared in the Session objective.
        SessionMapping.__init__(self, session, dist_dict, default_value=None)
        self.distance = session._weight(dist_dict)
Exemplo n.º 4
0
    def __init__(self, session, dist_dict):
        """A Distance saves the distances created by providers and boil it down
        to a single distance float by weighting the individual distances of each
        song's attributes and building the average of it.

        :param session: The session this distance belongs to. Only valid in it.
        :type session: Instance of :class:`munin.session.Session`
        :param dist_dict: A mapping to read the distance values from.
        :type dist_dict: mapping<str, float>
        """
        # Use only a list internally to save the values.
        # Keys are stored shared in the Session objective.
        SessionMapping.__init__(self, session, dist_dict, default_value=None)
        self.distance = session._weight(dist_dict)