def _update_similarity_view(self):
        """Update the similarity view with matches for the specified
        clusters."""
        if not self.similarity:
            return
        selection = self.cluster_view.selected
        if not len(selection):
            return
        cluster_id = selection[0]
        cluster_ids = self.clustering.cluster_ids
        self._best = cluster_id
        logger.log(5, "Update the similarity view.")
        # This is a list of pairs (closest_cluster, similarity).
        similarities = self.similarity(cluster_id)
        # We save the similarity values wrt the currently-selected clusters.
        # Note that we keep the order of the output of the self.similary()
        # function.
        clusters_sim = OrderedDict([(int(cl), s) for (cl, s) in similarities])
        # List of similar clusters, remove non-existing ones.
        clusters = [c for c in clusters_sim.keys()
                    if c in cluster_ids]
        # The similarity view will use these values.
        self._current_similarity_values = clusters_sim
        # Set the rows of the similarity view.
        # TODO: instead of the self._current_similarity_values hack,
        # give the possibility to specify the values here (?).
        self.similarity_view.set_rows([c for c in clusters
                                       if c not in selection])
dataset/ETHPy150Open kwikteam/phy/phy/cluster/manual/gui_component.py/ManualClustering._update_similarity_view/original