def comparison_matrix(self): """Returns Morris (1987) a cseg COM-Matrix. >>> Contour([0, 1, 3, 2]).comparison_matrix() | 0 1 3 2 ----------- 0 | 0 + + + 1 | - 0 + + 3 | - - 0 - 2 | - - + 0 """ size = len(self) r_size = range(size) m = [[a, b] for a in self for b in self] n = [m[(i * size):((i + 1) * size)] for i in range(size)] line = [self] [line.append([auxiliary.comparison(x) for x in n[r]]) for r in r_size] return matrix.ComparisonMatrix(line)
def __int_d(subset): """Returns a contour comparison from a given subset. """ a, b = subset[0], subset[-1] return auxiliary.comparison([a, b])