Beispiel #1
0
 def compute(self, features, clusters,
         cluster_groups, masks, clusters_selected, target_next=None,
         similarity_measure=None):
     log.debug("Computing correlation for clusters {0:s}.".format(
         str(list(clusters_selected))))
     if len(clusters_selected) == 0:
         return {}
     if self.sm is None:
         self.sm = SimilarityMatrix(features, masks)
     correlations = self.sm.compute_matrix(clusters, clusters_selected)
     return correlations
Beispiel #2
0
class SimilarityMatrixTask(QtCore.QObject):
    correlationMatrixComputed = QtCore.pyqtSignal(np.ndarray, object,
        np.ndarray, np.ndarray, object)

    def __init__(self, parent=None):
        super(SimilarityMatrixTask, self).__init__(parent)
        self.sm = None

    def compute(self, features, clusters,
            cluster_groups, masks, clusters_selected, target_next=None,
            similarity_measure=None):
        log.debug("Computing correlation for clusters {0:s}.".format(
            str(list(clusters_selected))))
        if len(clusters_selected) == 0:
            return {}
        if self.sm is None:
            self.sm = SimilarityMatrix(features, masks)
        correlations = self.sm.compute_matrix(clusters, clusters_selected)
        return correlations

    def compute_done(self, features, clusters,
            cluster_groups, masks, clusters_selected, target_next=None,
            similarity_measure=None, _result=None):
        correlations = _result
        self.correlationMatrixComputed.emit(np.array(clusters_selected),
            correlations,
            get_array(clusters, copy=True),
            get_array(cluster_groups, copy=True),
            target_next)
Beispiel #3
0
class SimilarityMatrixTask(QtCore.QObject):
    correlationMatrixComputed = QtCore.pyqtSignal(np.ndarray, object,
        np.ndarray, np.ndarray, object)

    def __init__(self, parent=None):
        super(SimilarityMatrixTask, self).__init__(parent)
        self.sm = None

    def compute(self, features, clusters,
            cluster_groups, masks, clusters_selected, target_next=None,
            similarity_measure=None):
        log.debug("Computing correlation for clusters {0:s}.".format(
            str(list(clusters_selected))))
        if len(clusters_selected) == 0:
            return {}
        if self.sm is None:
            self.sm = SimilarityMatrix(features, masks)
        correlations = self.sm.compute_matrix(clusters, clusters_selected)
        return correlations

    def compute_done(self, features, clusters,
            cluster_groups, masks, clusters_selected, target_next=None,
            similarity_measure=None, _result=None):
        correlations = _result
        self.correlationMatrixComputed.emit(np.array(clusters_selected),
            correlations,
            get_array(clusters, copy=True),
            get_array(cluster_groups, copy=True),
            target_next)
Beispiel #4
0
 def compute(self, features, clusters,
         cluster_groups, masks, clusters_selected, target_next=None,
         similarity_measure=None):
     log.debug("Computing correlation for clusters {0:s}.".format(
         str(list(clusters_selected))))
     if len(clusters_selected) == 0:
         return {}
     if self.sm is None:
         self.sm = SimilarityMatrix(features, masks)
     correlations = self.sm.compute_matrix(clusters, clusters_selected)
     return correlations