Пример #1
0
    def remove_from_index(self, uids):
        """
        Partially remove descriptors from this index associated with the given
        UIDs.

        :param uids: Iterable of UIDs of descriptors to remove from this index.
        :type uids: collections.Iterable[collections.Hashable]

        :raises ValueError: No data available in the given iterable.
        :raises KeyError: One or more UIDs provided do not match any stored
            descriptors.  The index should not be modified.

        """
        check_empty_iterable(uids, self._remove_from_index,
                             self._empty_iterable_exception())
Пример #2
0
    def remove_from_index(self, hashes):
        """
        Partially remove hashes from this index.

        :param hashes: Iterable of numpy boolean hash vectors to remove from
            this index.
        :type hashes: collections.Iterable[numpy.ndarray[bool]]

        :raises ValueError: No data available in the given iterable.
        :raises KeyError: One or more UIDs provided do not match any stored
            descriptors.

        """
        check_empty_iterable(hashes, self._remove_from_index,
                             self._empty_iterable_exception())
Пример #3
0
    def update_index(self, hashes):
        """
        Additively update the current index with the one or more hash vectors
        given.

        If no index exists yet, a new one should be created using the given hash
        vectors.

        :raises ValueError: No data available in the given iterable.

        :param hashes: Iterable of numpy boolean hash vectors to add to this
            index.
        :type hashes: collections.Iterable[numpy.ndarray[bool]]

        """
        check_empty_iterable(hashes, self._update_index,
                             self._empty_iterable_exception())
Пример #4
0
    def build_index(self, hashes):
        """
        Build the index with the given hash codes (bit-vectors).

        Subsequent calls to this method should rebuild the current index.  This
        method shall not add to the existing index nor raise an exception to as
        to protect the current index.

        :raises ValueError: No data available in the given iterable.

        :param hashes: Iterable of descriptor elements to build index
            over.
        :type hashes: collections.Iterable[numpy.ndarray[bool]]

        """
        check_empty_iterable(hashes, self._build_index,
                             self._empty_iterable_exception())
Пример #5
0
    def update_index(self, descriptors):
        """
        Additively update the current index with the one or more descriptor
        elements given.

        If no index exists yet, a new one should be created using the given
        descriptors.

        :raises ValueError: No data available in the given iterable.

        :param descriptors: Iterable of descriptor elements to add to this
            index.
        :type descriptors: collections.Iterable[smqtk.representation
                                                     .DescriptorElement]

        """
        check_empty_iterable(descriptors, self._update_index,
                             self._empty_iterable_exception())
Пример #6
0
    def build_index(self, descriptors):
        """
        Build the index with the given descriptor data elements.

        Subsequent calls to this method should rebuild the current index.  This
        method shall not add to the existing index nor raise an exception to as
        to protect the current index.

        :raises ValueError: No data available in the given iterable.

        :param descriptors: Iterable of descriptor elements to build index
            over.
        :type descriptors:
            collections.Iterable[smqtk.representation.DescriptorElement]

        """
        check_empty_iterable(descriptors, self._build_index,
                             self._empty_iterable_exception())