本文整理匯總了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)