本文整理汇总了Python中contour.contour.Contour类的典型用法代码示例。如果您正苦于以下问题:Python Contour类的具体用法?Python Contour怎么用?Python Contour使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Contour类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_subsets_normal
def test_subsets_normal():
cseg = Contour([0, 3, 1, 4, 2])
assert cseg.subsets_normal(4) == {(0, 1, 3, 2): [[0, 1, 4, 2]],
(0, 2, 1, 3): [[0, 3, 1, 4]],
(0, 2, 3, 1): [[0, 3, 4, 2]],
(0, 3, 1, 2): [[0, 3, 1, 2]],
(2, 0, 3, 1): [[3, 1, 4, 2]]}
示例2: test_subsets_prime
def test_subsets_prime():
cseg = Contour([0, 3, 1, 4, 2])
assert cseg.subsets_prime(4) == {(0, 1, 3, 2): [[0, 1, 4, 2]],
(0, 2, 1, 3): [[0, 3, 1, 4]],
(0, 2, 3, 1): [[0, 3, 4, 2]],
(0, 3, 1, 2): [[0, 3, 1, 2]],
(1, 3, 0, 2): [[3, 1, 4, 2]]}
示例3: test_comparison_matrix_2
def test_comparison_matrix_2():
cseg = Contour([1, 2, 3, 0, 3, 1])
assert cseg.comparison_matrix() == [[1, 2, 3, 0, 3, 1],
[0, 1, 1, -1, 1, 0],
[-1, 0, 1, -1, 1, -1],
[-1, -1, 0, -1, 0, -1],
[1, 1, 1, 0, 1, 1],
[-1, -1, 0, -1, 0, -1],
[0, 1, 1, -1, 1, 0]]
示例4: voice_contour_reduction
def voice_contour_reduction(piece_path, voice):
"""Retorna a redução de contornos de Morris a partir de uma voz de
uma peça.
>>> voice_contour_reduction('bach/bwv7.7', 'Soprano')
[< 0 2 1 >, 4]
"""
piece = corpus.parse(piece_path)
voice_notes = piece.getElementById(voice).flat.notes
voice_freq = [n.frequency for n in voice_notes]
voice_contour = Contour(voice_freq).translation()
return voice_contour.reduction_algorithm()
示例5: test_rotated_representatives_2
def test_rotated_representatives_2():
cseg = Contour([0, 3, 1, 2])
assert cseg.rotated_representatives() == [[0, 2, 1, 3], [0, 3, 1, 2],
[1, 2, 0, 3], [1, 3, 0, 2],
[2, 0, 3, 1], [2, 1, 3, 0],
[3, 0, 2, 1], [3, 1, 2, 0]]
示例6: test_adjacency_series_vector_2
def test_adjacency_series_vector_2():
cseg = Contour([1, 2, 3, 0, 3, 1])
assert cseg.adjacency_series_vector() == [3, 2]
示例7: test_all_rotations_2
def test_all_rotations_2():
cseg = Contour([0, 3, 1, 2])
assert cseg.all_rotations() == [[0, 3, 1, 2], [3, 1, 2, 0], [1, 2, 0, 3],
[2, 0, 3, 1], [0, 3, 1, 2]]
示例8: test_prime_form_marvin_laprade_2
def test_prime_form_marvin_laprade_2():
cseg = Contour([5, 7, 9, 1])
assert cseg.prime_form_marvin_laprade() == [0, 3, 2, 1]
示例9: test_prime_form_marvin_laprade_5
def test_prime_form_marvin_laprade_5():
cseg = Contour([0, 1, 2, 1, 2])
assert cseg.prime_form_marvin_laprade() == [[0, 1, 3, 2, 4], [0, 2, 4, 1, 3]]
示例10: test_retrograde
def test_retrograde():
cseg = Contour([1, 4, 9, 9, 2, 1])
assert cseg.retrograde() == [1, 2, 9, 9, 4, 1]
示例11: test_translation
def test_translation():
cseg = Contour([1, 4, 9, 9, 2, 1])
assert cseg.translation() == [0, 2, 3, 3, 1, 0]
示例12: test_ri_identity_test_1
def test_ri_identity_test_1():
cseg = Contour([0, 1, 3, 2])
assert cseg.ri_identity_test() == False
示例13: test_ri_identity_test
def test_ri_identity_test():
cseg = Contour([1, 0, 3, 2])
assert cseg.ri_identity_test() == True
示例14: test_segment_class_1
def test_segment_class_1():
cseg = Contour([2, 1, 4])
assert cseg.segment_class() == (3, 2, [0, 2, 1], False)
示例15: test_segment_class_2
def test_segment_class_2():
cseg = Contour([3, 1, 0])
assert cseg.segment_class() == (3, 1, [0, 1, 2], True)