From c8b900da5f19da6a4cbb742fb55578e814ec60dd Mon Sep 17 00:00:00 2001 From: Axel Marmoret <axel.marmoret@inria.fr> Date: Sat, 24 Dec 2022 00:52:57 +0100 Subject: [PATCH] Rollback - name was changed. --- Notebooks/Tutorial - Handling polytopes.ipynb | 667 ++++-------------- {MusicOnPolytopes => polytopes}/__init__.py | 0 .../accelerated_polytopical_costs.py | 0 .../chord_movement.py | 0 .../compute_frontiers.py | 0 .../compute_scores.py | 0 .../data_manipulation.py | 0 .../model/__init__.py | 0 .../model/chord.py | 0 .../model/constants.py | 0 .../model/errors.py | 0 {MusicOnPolytopes => polytopes}/model/note.py | 0 .../model/triad_manipulation.py | 0 .../pattern_factory.py | 0 .../pattern_manip.py | 0 .../polytopical_costs.py | 0 .../segmentation_algorithms.py | 0 .../segmentation_helper.py | 0 .../triad_transformations.py | 0 .../voiceleading_utilities.py | 0 20 files changed, 151 insertions(+), 516 deletions(-) rename {MusicOnPolytopes => polytopes}/__init__.py (100%) rename {MusicOnPolytopes => polytopes}/accelerated_polytopical_costs.py (100%) rename {MusicOnPolytopes => polytopes}/chord_movement.py (100%) rename {MusicOnPolytopes => polytopes}/compute_frontiers.py (100%) rename {MusicOnPolytopes => polytopes}/compute_scores.py (100%) rename {MusicOnPolytopes => polytopes}/data_manipulation.py (100%) rename {MusicOnPolytopes => polytopes}/model/__init__.py (100%) rename {MusicOnPolytopes => polytopes}/model/chord.py (100%) rename {MusicOnPolytopes => polytopes}/model/constants.py (100%) rename {MusicOnPolytopes => polytopes}/model/errors.py (100%) rename {MusicOnPolytopes => polytopes}/model/note.py (100%) rename {MusicOnPolytopes => polytopes}/model/triad_manipulation.py (100%) rename {MusicOnPolytopes => polytopes}/pattern_factory.py (100%) rename {MusicOnPolytopes => polytopes}/pattern_manip.py (100%) rename {MusicOnPolytopes => polytopes}/polytopical_costs.py (100%) rename {MusicOnPolytopes => polytopes}/segmentation_algorithms.py (100%) rename {MusicOnPolytopes => polytopes}/segmentation_helper.py (100%) rename {MusicOnPolytopes => polytopes}/triad_transformations.py (100%) rename {MusicOnPolytopes => polytopes}/voiceleading_utilities.py (100%) diff --git a/Notebooks/Tutorial - Handling polytopes.ipynb b/Notebooks/Tutorial - Handling polytopes.ipynb index 984fe7f..838eaab 100644 --- a/Notebooks/Tutorial - Handling polytopes.ipynb +++ b/Notebooks/Tutorial - Handling polytopes.ipynb @@ -56,13 +56,25 @@ "execution_count": 1, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:47:46.056333Z", - "start_time": "2021-02-16T19:47:44.670040Z" + "end_time": "2022-12-23T23:51:28.275357Z", + "start_time": "2022-12-23T23:51:28.165741Z" } }, - "outputs": [], + "outputs": [ + { + "ename": "ModuleNotFoundError", + "evalue": "No module named 'polytopes'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m<ipython-input-1-1061df01e14a>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[1;32mfrom\u001b[0m \u001b[0mpolytopes\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mpattern_factory\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0mpf\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mModuleNotFoundError\u001b[0m: No module named 'polytopes'" + ] + } + ], "source": [ - "from polytopes import pattern_factory as pf" + "from MusicOnPolytopes import pattern_factory as pf" ] }, { @@ -94,25 +106,14 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:47:46.079273Z", - "start_time": "2021-02-16T19:47:46.060332Z" + "end_time": "2022-12-23T23:51:28.279347Z", + "start_time": "2022-12-23T23:51:28.170Z" } }, - "outputs": [ - { - "data": { - "text/plain": [ - "[[[1, 1], [1, 1]], [[1, 1], [1, 1]]]" - ] - }, - "execution_count": 2, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "# Feel free to play with the dimension\n", "pf.make_regular_polytope_pattern(dimension = 3)" @@ -230,25 +231,14 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:47:46.103213Z", - "start_time": "2021-02-16T19:47:46.085262Z" + "end_time": "2022-12-23T23:51:28.280352Z", + "start_time": "2022-12-23T23:51:28.179Z" } }, - "outputs": [ - { - "data": { - "text/plain": [ - "[[[1, 1], [1, (1, 1)]], [[1, 1], [1, (1, 1)]]]" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "pf.make_polytope_pattern(dimension = 3, adding_code = [1,0,0], deleting_code = [])" ] @@ -262,25 +252,14 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:47:46.120163Z", - "start_time": "2021-02-16T19:47:46.109200Z" + "end_time": "2022-12-23T23:51:28.282339Z", + "start_time": "2022-12-23T23:51:28.183Z" } }, - "outputs": [ - { - "data": { - "text/plain": [ - "[[[0, 1], [2, (3, 4)]], [[5, 6], [7, (8, 9)]]]" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "pf.make_indexed_pattern(dimension = 3, adding_code = [1,0,0], deleting_code = [])" ] @@ -300,25 +279,14 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:47:46.138115Z", - "start_time": "2021-02-16T19:47:46.123157Z" + "end_time": "2022-12-23T23:51:28.284334Z", + "start_time": "2022-12-23T23:51:28.188Z" } }, - "outputs": [ - { - "data": { - "text/plain": [ - "[[[0, 1], [2, 3]], [[4, 5]]]" - ] - }, - "execution_count": 5, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "#pf.make_polytope_pattern(dimension = 3, adding_code = [], deleting_code = [0,0,1])\n", "pf.make_indexed_pattern(dimension = 3, adding_code = [], deleting_code = [0,0,1])" @@ -335,25 +303,14 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:47:46.156067Z", - "start_time": "2021-02-16T19:47:46.148091Z" + "end_time": "2022-12-23T23:51:28.286331Z", + "start_time": "2022-12-23T23:51:28.192Z" } }, - "outputs": [ - { - "data": { - "text/plain": [ - "[[[0, 1], [2, (3, 4)]], [[5, 6]]]" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "#pf.make_polytope_pattern(dimension = 3, adding_code = [1,0,0], deleting_code = [0,0,1])\n", "pf.make_indexed_pattern(dimension = 3, adding_code = [1,0,0], deleting_code = [0,0,1])" @@ -372,26 +329,14 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:47:46.176020Z", - "start_time": "2021-02-16T19:47:46.165045Z" + "end_time": "2022-12-23T23:51:28.288323Z", + "start_time": "2022-12-23T23:51:28.196Z" } }, - "outputs": [ - { - "data": { - "text/plain": [ - "[[[[0, 1], [2, 3]], [[4, 5], [6, 7]]],\n", - " [[[8, 9], [10, 11]], [[12, 13], [14, 15]]]]" - ] - }, - "execution_count": 7, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "adding_code = [] ### Change values here if needed\n", "deleting_code = [] ### Change values here if needed\n", @@ -409,25 +354,14 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:47:46.191975Z", - "start_time": "2021-02-16T19:47:46.181998Z" + "end_time": "2022-12-23T23:51:28.289325Z", + "start_time": "2022-12-23T23:51:28.200Z" } }, - "outputs": [ - { - "data": { - "text/plain": [ - "30" - ] - }, - "execution_count": 8, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "pf.get_final_pattern_size(dimension = 5, adding_code = [1,0,0,1,0], deleting_code = [0,1,0,1,0])" ] @@ -441,32 +375,14 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:47:46.214909Z", - "start_time": "2021-02-16T19:47:46.200948Z" + "end_time": "2022-12-23T23:51:28.290317Z", + "start_time": "2022-12-23T23:51:28.207Z" } }, - "outputs": [ - { - "data": { - "text/plain": [ - "[([], [0, 0, 0]),\n", - " ([0, 0, 0], [0, 0, 0]),\n", - " ([0, 0, 1], [0, 1, 0]),\n", - " ([0, 0, 1], [1, 0, 0]),\n", - " ([0, 1, 0], [0, 0, 1]),\n", - " ([0, 1, 0], [1, 0, 0]),\n", - " ([1, 0, 0], [0, 0, 1]),\n", - " ([1, 0, 0], [0, 1, 0])]" - ] - }, - "execution_count": 9, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "# The first element of each tuple is the addition code, the second is the deletion one.\n", "pf.get_codes(7)" @@ -481,31 +397,14 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:47:46.232864Z", - "start_time": "2021-02-16T19:47:46.219897Z" + "end_time": "2022-12-23T23:51:28.291314Z", + "start_time": "2022-12-23T23:51:28.213Z" } }, - "outputs": [ - { - "data": { - "text/plain": [ - "[([], [0, 0, 0]),\n", - " ([0, 0, 1], [0, 1, 0]),\n", - " ([0, 0, 1], [1, 0, 0]),\n", - " ([0, 1, 0], [0, 0, 1]),\n", - " ([0, 1, 0], [1, 0, 0]),\n", - " ([1, 0, 0], [0, 0, 1]),\n", - " ([1, 0, 0], [0, 1, 0])]" - ] - }, - "execution_count": 10, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "pf.get_unique_codes(7)" ] @@ -526,29 +425,14 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:47:46.256799Z", - "start_time": "2021-02-16T19:47:46.236851Z" + "end_time": "2022-12-23T23:51:28.293309Z", + "start_time": "2022-12-23T23:51:28.219Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Pattern of ones:\n", - "[[[[1, 1], [1, 1]], [[1, 1], [1, 1]]], [[[1, 1], [1, 1]], [[1, 1], [1, 1]]]]\n", - "\n", - "Previous pattern, indexed:\n", - "[[[[0, 1], [2, 3]], [[4, 5], [6, 7]]], [[[8, 9], [10, 11]], [[12, 13], [14, 15]]]]\n", - "\n", - "Going back to pattern of ones pattern, indexed:\n", - "[[[[1, 1], [1, 1]], [[1, 1], [1, 1]]], [[[1, 1], [1, 1]], [[1, 1], [1, 1]]]]\n" - ] - } - ], + "outputs": [], "source": [ "pattern_of_ones = pf.make_polytope_pattern(dimension = 4, adding_code = [], deleting_code = [])\n", "print(\"Pattern of ones:\\n{}\\n\".format(pattern_of_ones))\n", @@ -569,26 +453,14 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:47:46.275747Z", - "start_time": "2021-02-16T19:47:46.264777Z" + "end_time": "2022-12-23T23:51:28.294307Z", + "start_time": "2022-12-23T23:51:28.226Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Is [[[[1, 1], [1, 1]], [[1, 1], [1, 1]]], [[[1, 1], [1, 1]], [[1, 1], [1, 1]]]] an indexed pattern?\n", - "False\n", - "\n", - "Is [[[[0, 1], [2, 3]], [[4, 5], [6, 7]]], [[[8, 9], [10, 11]], [[12, 13], [14, 15]]]] an indexed pattern?\n", - "True\n" - ] - } - ], + "outputs": [], "source": [ "pattern_of_ones = pf.make_polytope_pattern(dimension = 4, adding_code = [], deleting_code = [])\n", "boolean = pf.is_indexed_pattern(pattern_of_ones)\n", @@ -611,25 +483,14 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:47:46.292703Z", - "start_time": "2021-02-16T19:47:46.281731Z" + "end_time": "2022-12-23T23:51:28.295304Z", + "start_time": "2022-12-23T23:51:28.231Z" } }, - "outputs": [ - { - "data": { - "text/plain": [ - "[[[[0, 1], [2, 3]], [[4, 5], [6, (7, 8)]]], [[[9, 10]], [[11, 12]]]]" - ] - }, - "execution_count": 13, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "pattern = pf.make_indexed_pattern(dimension = 4, adding_code = [1,0,0,0], deleting_code = [0,1,0,1])\n", "pattern" @@ -644,50 +505,28 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:47:46.309656Z", - "start_time": "2021-02-16T19:47:46.297689Z" + "end_time": "2022-12-23T23:51:28.297300Z", + "start_time": "2022-12-23T23:51:28.238Z" } }, - "outputs": [ - { - "data": { - "text/plain": [ - "4" - ] - }, - "execution_count": 14, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "pf.get_pattern_dimension(pattern)" ] }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:47:46.322624Z", - "start_time": "2021-02-16T19:47:46.313645Z" + "end_time": "2022-12-23T23:51:28.299294Z", + "start_time": "2022-12-23T23:51:28.242Z" } }, - "outputs": [ - { - "data": { - "text/plain": [ - "13" - ] - }, - "execution_count": 15, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "pf.get_pattern_size(pattern)" ] @@ -704,25 +543,14 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:47:46.350552Z", - "start_time": "2021-02-16T19:47:46.333593Z" + "end_time": "2022-12-23T23:51:28.301288Z", + "start_time": "2022-12-23T23:51:28.248Z" } }, - "outputs": [ - { - "data": { - "text/plain": [ - "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]" - ] - }, - "execution_count": 16, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "pf.flatten_pattern(pattern)" ] @@ -736,25 +564,14 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:47:46.369497Z", - "start_time": "2021-02-16T19:47:46.355534Z" + "end_time": "2022-12-23T23:51:28.302285Z", + "start_time": "2022-12-23T23:51:28.255Z" } }, - "outputs": [ - { - "data": { - "text/plain": [ - "[0, 1, 2, 3, 4, 5, 6, (7, 8), 9, 10, 11, 12]" - ] - }, - "execution_count": 17, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "pf.flatten_nested_list(pattern)" ] @@ -776,30 +593,14 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:47:46.410399Z", - "start_time": "2021-02-16T19:47:46.380475Z" + "end_time": "2022-12-23T23:51:28.304281Z", + "start_time": "2022-12-23T23:51:28.260Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "List of chords:\n", - "['Eb', 'Eb', 'Eb', 'Eb', 'Abm', 'Abm', 'Abm', 'Abm', 'E', 'E', 'E', 'E', 'F#', 'F#', 'Eb', 'Eb', 'Abm', 'Abm', 'Abm', 'Abm', 'Abm', 'Abm', 'E', 'Eb', 'Ebm', 'Ebm', 'Ebm', 'Ebm', 'Ebm', 'Ebm', 'Ebm', 'Ab', 'Ebm', 'Ebm', 'Ebm', 'Ebm']\n", - "\n", - "The pattern:\n", - "[[[[[0, 1], [2, 3]], [[4, 5], [6, 7]]], [[[8, 9], [10, 11]], [[12, 13], [14, 15]]]], [[[[16, 17], [18, 19]], [[20, 21], [22, 23]]], [[[24, 25], [26, 27]], [[(28, 29), (30, 31)], [(32, 33), (34, 35)]]]]]\n", - "\n", - "The pattern, with chords as elements:\n", - "[[[[['Eb', 'Eb'], ['Eb', 'Eb']], [['Abm', 'Abm'], ['Abm', 'Abm']]], [[['E', 'E'], ['E', 'E']], [['F#', 'F#'], ['Eb', 'Eb']]]], [[[['Abm', 'Abm'], ['Abm', 'Abm']], [['Abm', 'Abm'], ['E', 'Eb']]], [[['Ebm', 'Ebm'], ['Ebm', 'Ebm']], [[('Ebm', 'Ebm'), ('Ebm', 'Ab')], [('Ebm', 'Ebm'), ('Ebm', 'Ebm')]]]]]\n", - "\n" - ] - } - ], + "outputs": [], "source": [ "segment = ['Eb', 'Eb', 'Eb', 'Eb', 'Abm', 'Abm', 'Abm', 'Abm', 'E', 'E', 'E', 'E', 'F#', 'F#', 'Eb', 'Eb', 'Abm', 'Abm', 'Abm', 'Abm', 'Abm', 'Abm', 'E', 'Eb', 'Ebm', 'Ebm', 'Ebm', 'Ebm', 'Ebm', 'Ebm', 'Ebm', 'Ab', 'Ebm', 'Ebm', 'Ebm', 'Ebm']\n", "print(\"List of chords:\\n{}\\n\".format(segment))\n", @@ -830,11 +631,11 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:47:46.434327Z", - "start_time": "2021-02-16T19:47:46.428347Z" + "end_time": "2022-12-23T23:51:28.305277Z", + "start_time": "2022-12-23T23:51:28.264Z" } }, "outputs": [], @@ -871,25 +672,14 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:47:46.453271Z", - "start_time": "2021-02-16T19:47:46.437314Z" + "end_time": "2022-12-23T23:51:28.308269Z", + "start_time": "2022-12-23T23:51:28.268Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Pattern: [[[0, 1], [2, 3]], [[4, (5, 6)], [7, (8, 9)]]] (the same as the right one on the previous figure)\n", - "a_3 has index: [0, 1, 1]\n", - "a_5 has index: [1, 0, (1, 0)]\n", - "a_6 has index: [1, 0, (1, 1)]\n" - ] - } - ], + "outputs": [], "source": [ "pattern = pf.make_indexed_pattern(dimension = 3, adding_code = [0,1,0], deleting_code = [])\n", "print(\"Pattern: {} (the same as the right one on the previous figure)\".format(pattern))\n", @@ -913,26 +703,14 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:47:46.481198Z", - "start_time": "2021-02-16T19:47:46.462249Z" + "end_time": "2022-12-23T23:51:28.309267Z", + "start_time": "2022-12-23T23:51:28.272Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Pattern: [[[0, 1], [2, 3]], [[4, (5, 6)], [7, (8, 9)]]] (the same as before)\n", - "[0,1,1] is the element: 3\n", - "[1, 0, (1, 0)] is the element: 5\n", - "[1, 0, (1, 0)] is the element: 6\n", - "[0, 0, (1, 0)] is the element: None (should be None, as there is no such element added)\n" - ] - } - ], + "outputs": [], "source": [ "pattern = pf.make_indexed_pattern(dimension = 3, adding_code = [0,1,0], deleting_code = [])\n", "print(\"Pattern: {} (the same as before)\".format(pattern))\n", @@ -977,20 +755,23 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 2, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:47:46.504136Z", - "start_time": "2021-02-16T19:47:46.487183Z" + "end_time": "2022-12-23T23:51:28.449519Z", + "start_time": "2022-12-23T23:51:28.418601Z" } }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "Antecedents of the element 3: [1, 2]\n", - "Antecedents of the element [0,1,1]: [1, 2]\n" + "ename": "NameError", + "evalue": "name 'pf' is not defined", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m<ipython-input-2-aad02dca8042>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mpattern\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mpf\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mmake_indexed_pattern\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdimension\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;36m3\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0madding_code\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m[\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdeleting_code\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m[\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 2\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 3\u001b[0m \u001b[0mant_elt\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mpm\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget_antecedents_from_element\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m3\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mpattern\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"Antecedents of the element 3: {}\"\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mant_elt\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mNameError\u001b[0m: name 'pf' is not defined" ] } ], @@ -1013,25 +794,14 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:47:46.523085Z", - "start_time": "2021-02-16T19:47:46.511117Z" + "end_time": "2022-12-23T23:51:28.453508Z", + "start_time": "2022-12-23T23:51:28.283Z" } }, - "outputs": [ - { - "data": { - "text/plain": [ - "[[0, 0, 1], [0, 1, 0]]" - ] - }, - "execution_count": 23, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "pm.get_antecedents_index_from_index([0,1,1])\n", "# This function does not need the pattern, but some of its outputs may not exist in every pattern" @@ -1048,22 +818,14 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:47:46.540041Z", - "start_time": "2021-02-16T19:47:46.528075Z" + "end_time": "2022-12-23T23:51:28.456502Z", + "start_time": "2022-12-23T23:51:28.289Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Element: 6, antecedent: 1, pivot: 5\n" - ] - } - ], + "outputs": [], "source": [ "pattern = pf.make_indexed_pattern(dimension = 3, adding_code = [1,0,0], deleting_code = [0,0,1])\n", "\n", @@ -1083,25 +845,14 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:47:46.552008Z", - "start_time": "2021-02-16T19:47:46.544030Z" + "end_time": "2022-12-23T23:51:28.458500Z", + "start_time": "2022-12-23T23:51:28.293Z" } }, - "outputs": [ - { - "data": { - "text/plain": [ - "[(1, 5), (5, 1)]" - ] - }, - "execution_count": 25, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "pm.get_antecedents_with_pivots_from_index(elt_idx, pattern)" ] @@ -1117,24 +868,14 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:47:46.586915Z", - "start_time": "2021-02-16T19:47:46.561982Z" + "end_time": "2022-12-23T23:51:28.461491Z", + "start_time": "2022-12-23T23:51:28.298Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Successors of 1: [6, 3]\n", - "Successors of [0, 0, 1]: [6, 3]\n", - "Successors of [0, 0, 1]: [[1, 0, 1], [0, 1, 1]]\n" - ] - } - ], + "outputs": [], "source": [ "pattern = pf.make_indexed_pattern(dimension = 3, adding_code = [1,0,0], deleting_code = [0,0,1])\n", "\n", @@ -1179,41 +920,14 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:47:46.632796Z", - "start_time": "2021-02-16T19:47:46.594893Z" + "end_time": "2022-12-23T23:51:28.463480Z", + "start_time": "2022-12-23T23:51:28.305Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Pattern: [[[[0, 1], [2, 3]], [[4, 5], [(6, 7), (8, 9)]]], [[[10, 11], [12, 13]], [[14, 15]]]]\n", - "\n", - "PPP 0 of this pattern:\n", - "[[[[0, 1], [2, 3]], [[4, 5], [(6, 7), (8, 9)]]], [[[10, 11], [12, 13]], [[14, 15]]]]\n", - "\n", - "PPP 1 of this pattern:\n", - "[[[[0, 1], [4, 5]], [[2, 3], [(6, 7), (8, 9)]]], [[[10, 11], [14, 15]], [[12, 13]]]]\n", - "\n", - "PPP 2 of this pattern:\n", - "[[[[0, 1], [10, 11]], [[2, 3], [12, 13]]], [[[4, 5], [14, 15]], [[(6, 7), (8, 9)]]]]\n", - "\n", - "PPP 3 of this pattern:\n", - "[[[[0, 2], [4, (6, 7)]], [[1, 3], [5, (8, 9)]]], [[[10, 12], [14]], [[11, 13], [15]]]]\n", - "\n", - "PPP 4 of this pattern:\n", - "[[[[0, 2], [10, 12]], [[1, 3], [11, 13]]], [[[4, (6, 7)], [14]], [[5, (8, 9)], [15]]]]\n", - "\n", - "PPP 5 of this pattern:\n", - "[[[[0, 4], [10, 14]], [[1, 5], [11, 15]]], [[[2, (6, 7)], [12]], [[3, (8, 9)], [13]]]]\n", - "\n" - ] - } - ], + "outputs": [], "source": [ "pattern = pf.make_indexed_pattern(dimension = 4, adding_code = [1,0,0,1], deleting_code = [0,0,0,1])\n", "print(\"Pattern: {}\\n\".format(pattern))\n", @@ -1252,11 +966,11 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:47:46.647755Z", - "start_time": "2021-02-16T19:47:46.639774Z" + "end_time": "2022-12-23T23:51:28.465478Z", + "start_time": "2022-12-23T23:51:28.312Z" } }, "outputs": [], @@ -1276,30 +990,14 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:47:47.259117Z", - "start_time": "2021-02-16T19:47:46.652739Z" + "end_time": "2022-12-23T23:51:28.467470Z", + "start_time": "2022-12-23T23:51:28.315Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "List of chords:\n", - "['Eb', 'Eb', 'Eb', 'Eb', 'Abm', 'Abm', 'Abm', 'Abm', 'E', 'E', 'E', 'E', 'F#', 'F#', 'Eb', 'Eb', 'Abm', 'Abm', 'Abm', 'Abm', 'Abm', 'Abm', 'E', 'Eb', 'Ebm', 'Ebm', 'Ebm', 'Ebm', 'Ebm', 'Ebm', 'Ebm', 'Ab', 'Ebm', 'Ebm', 'Ebm', 'Ebm']\n", - "\n", - "Optimal pattern:\n", - "[[[[[0, 1], [2, 3]], [[4, 5], [6, 7]]], [[[8, 9], [10, 11]], [[12, 13], [14, 15]]]], [[[[16, 17], [18, 19]], [[20, 21], [22, 23]]], [[[(24, 25), (26, 27)], [(28, 29), (30, 31)]], [[(32, 33), (34, 35)]]]]]\n", - "Resulting in cost: 12\n", - "The optimal pattern, with chords as elements:\n", - "[[[[['Eb', 'Eb'], ['Eb', 'Eb']], [['Abm', 'Abm'], ['Abm', 'Abm']]], [[['E', 'E'], ['E', 'E']], [['F#', 'F#'], ['Eb', 'Eb']]]], [[[['Abm', 'Abm'], ['Abm', 'Abm']], [['Abm', 'Abm'], ['E', 'Eb']]], [[[('Ebm', 'Ebm'), ('Ebm', 'Ebm')], [('Ebm', 'Ebm'), ('Ebm', 'Ab')]], [[('Ebm', 'Ebm'), ('Ebm', 'Ebm')]]]]]\n", - "\n" - ] - } - ], + "outputs": [], "source": [ "segment = ['Eb', 'Eb', 'Eb', 'Eb', 'Abm', 'Abm', 'Abm', 'Abm', 'E', 'E', 'E', 'E', 'F#', 'F#', 'Eb', 'Eb', 'Abm', 'Abm', 'Abm', 'Abm', 'Abm', 'Abm', 'E', 'Eb', 'Ebm', 'Ebm', 'Ebm', 'Ebm', 'Ebm', 'Ebm', 'Ebm', 'Ab', 'Ebm', 'Ebm', 'Ebm', 'Ebm']\n", "print(\"List of chords:\\n{}\\n\".format(segment))\n", @@ -1339,31 +1037,14 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:47:47.960241Z", - "start_time": "2021-02-16T19:47:47.261111Z" + "end_time": "2022-12-23T23:51:28.469465Z", + "start_time": "2022-12-23T23:51:28.320Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "List of chords:\n", - "['Eb', 'Eb', 'Eb', 'Eb', 'Abm', 'Abm', 'Abm', 'Abm', 'E', 'E', 'E', 'E', 'F#', 'F#', 'Eb', 'Eb', 'Abm', 'Abm', 'Abm', 'Abm', 'Abm', 'Abm', 'E', 'Eb', 'Ebm', 'Ebm', 'Ebm', 'Ebm', 'Ebm', 'Ebm', 'Ebm', 'Ab', 'Ebm', 'Ebm', 'Ebm', 'Ebm']\n", - "\n", - "Optimal pattern:\n", - "[[[[[0, 1], [2, 3]], [[4, 5], [6, 7]]], [[[8, 9], [10, 11]], [[12, 13], [14, 15]]]], [[[[16, 17], [18, 19]], [[20, 21], [22, 23]]], [[[24, 25], [26, 27]], [[(28, 29), (30, 31)], [(32, 33), (34, 35)]]]]]\n", - "Resulting in cost: 63\n", - "\n", - "The optimal pattern, with chords as elements:\n", - "[[[[['Eb', 'Eb'], ['Eb', 'Eb']], [['Abm', 'Abm'], ['Abm', 'Abm']]], [[['E', 'E'], ['E', 'E']], [['F#', 'F#'], ['Eb', 'Eb']]]], [[[['Abm', 'Abm'], ['Abm', 'Abm']], [['Abm', 'Abm'], ['E', 'Eb']]], [[['Ebm', 'Ebm'], ['Ebm', 'Ebm']], [[('Ebm', 'Ebm'), ('Ebm', 'Ab')], [('Ebm', 'Ebm'), ('Ebm', 'Ebm')]]]]]\n", - "\n" - ] - } - ], + "outputs": [], "source": [ "segment = ['Eb', 'Eb', 'Eb', 'Eb', 'Abm', 'Abm', 'Abm', 'Abm', 'E', 'E', 'E', 'E', 'F#', 'F#', 'Eb', 'Eb', 'Abm', 'Abm', 'Abm', 'Abm', 'Abm', 'Abm', 'E', 'Eb', 'Ebm', 'Ebm', 'Ebm', 'Ebm', 'Ebm', 'Ebm', 'Ebm', 'Ab', 'Ebm', 'Ebm', 'Ebm', 'Ebm']\n", "print(\"List of chords:\\n{}\\n\".format(segment))\n", @@ -1392,11 +1073,11 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:47:47.965228Z", - "start_time": "2021-02-16T19:47:47.961239Z" + "end_time": "2022-12-23T23:51:28.471461Z", + "start_time": "2022-12-23T23:51:28.324Z" } }, "outputs": [], @@ -1415,11 +1096,11 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:47:47.992156Z", - "start_time": "2021-02-16T19:47:47.967223Z" + "end_time": "2022-12-23T23:51:28.473454Z", + "start_time": "2022-12-23T23:51:28.329Z" } }, "outputs": [], @@ -1430,32 +1111,14 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:49:55.034936Z", - "start_time": "2021-02-16T19:47:47.994151Z" + "end_time": "2022-12-23T23:51:28.475449Z", + "start_time": "2022-12-23T23:51:28.333Z" } }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "c:\\users\\amarmore\\desktop\\projects\\phd main projects\\on git\\code\\polytopes and relation\\polytopes\\segmentation_algorithms.py:487: UserWarning: No Polytope is available for this size of segment. Trying sequential cost instead.\n", - " warnings.warn(\"No Polytope is available for this size of segment. Trying sequential cost instead.\")\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Frontiers of this algorithm:\n", - "[0, 20, 52, 84, 112, 144, 176, 192, 220, 252, 284, 292, 332, 364, 396, 428, 462]\n", - "With cost:113.25\n" - ] - } - ], + "outputs": [], "source": [ "# Guichaoua\n", "frontiers, cost = sa.dynamic_minimization_guichaoua(song)\n", @@ -1464,42 +1127,14 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2021-02-16T19:58:12.753991Z", - "start_time": "2021-02-16T19:49:55.036933Z" + "end_time": "2022-12-23T23:51:28.476446Z", + "start_time": "2022-12-23T23:51:28.337Z" } }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "c:\\users\\amarmore\\desktop\\projects\\phd main projects\\on git\\code\\polytopes and relation\\polytopes\\segmentation_algorithms.py:616: UserWarning: No Polytope is available for this size of segment. Trying sequential cost instead.\n", - " warnings.warn(\"No Polytope is available for this size of segment. Trying sequential cost instead.\")\n" - ] - }, - { - "ename": "KeyboardInterrupt", - "evalue": "", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m<ipython-input-34-49ee1c4a990d>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[1;31m# Louboutin\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m \u001b[0mfrontiers\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcost\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0msa\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdynamic_minimization_louboutin\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msong\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 3\u001b[0m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"Frontiers of this algorithm:\\n{}\\nWith cost:{}\"\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfrontiers\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcost\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", - "\u001b[1;32mc:\\users\\amarmore\\desktop\\projects\\phd main projects\\on git\\code\\polytopes and relation\\polytopes\\segmentation_algorithms.py\u001b[0m in \u001b[0;36mdynamic_minimization_louboutin\u001b[1;34m(chord_sequence, min_size, max_size, segment_size_penalty, irregularity_penalty, target_size, persist_patterns)\u001b[0m\n\u001b[0;32m 604\u001b[0m \u001b[0mthis_polytope_cost\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mmath\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0minf\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 605\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mi\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mlen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0ma_pattern\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 606\u001b[1;33m \u001b[0mthis_ppp_cost\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mpc\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mlouboutin_cost_for_a_ppp\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msegment\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0ma_pattern\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mi\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0ma_pattern\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m3\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mi\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0ma_pattern\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m4\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mi\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcurrent_min\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mthis_segment_cost\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 607\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mthis_ppp_cost\u001b[0m \u001b[1;33m<\u001b[0m \u001b[0mthis_polytope_cost\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 608\u001b[0m \u001b[0mthis_polytope_cost\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mthis_ppp_cost\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", - "\u001b[1;32mc:\\users\\amarmore\\desktop\\projects\\phd main projects\\on git\\code\\polytopes and relation\\polytopes\\polytopical_costs.py\u001b[0m in \u001b[0;36mlouboutin_cost_for_a_ppp\u001b[1;34m(segment, a_ppp, pattern_of_ones, reindex, current_min)\u001b[0m\n\u001b[0;32m 54\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 55\u001b[0m \u001b[0mnew_segment\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mpm\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mswap_chord_sequence\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msegment\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mreindex\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 56\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mpolytopic_scale_s_and_c_cost_computation\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mnew_segment\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mpattern_of_ones\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcurrent_min\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mcurrent_min\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 57\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 58\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mpolytopic_scale_s_and_c_cost_computation\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msymbol_flow\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mpolytope_pattern\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mextended_s_and_c\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;32mFalse\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcurrent_min\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mmath\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0minf\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", - "\u001b[1;32mc:\\users\\amarmore\\desktop\\projects\\phd main projects\\on git\\code\\polytopes and relation\\polytopes\\polytopical_costs.py\u001b[0m in \u001b[0;36mpolytopic_scale_s_and_c_cost_computation\u001b[1;34m(symbol_flow, polytope_pattern, extended_s_and_c, current_min)\u001b[0m\n\u001b[0;32m 87\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mrecursive_low_level_splitter_for_s_and_c_cost\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msymbol_flow\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mpolytope_pattern\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mextended_s_and_c\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mextended_s_and_c\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 88\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 89\u001b[1;33m \u001b[0minner_systems_cost\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mrecursive_low_level_splitter_for_s_and_c_cost\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msymbol_flow\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mpolytope_pattern\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mextended_s_and_c\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mextended_s_and_c\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 90\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0minner_systems_cost\u001b[0m \u001b[1;33m>\u001b[0m \u001b[0mcurrent_min\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 91\u001b[0m \u001b[1;31m# Cost is already higher than current min, so avoid further computation.\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", - "\u001b[1;32mc:\\users\\amarmore\\desktop\\projects\\phd main projects\\on git\\code\\polytopes and relation\\polytopes\\polytopical_costs.py\u001b[0m in \u001b[0;36mrecursive_low_level_splitter_for_s_and_c_cost\u001b[1;34m(symbol_flow, polytope_pattern, extended_s_and_c)\u001b[0m\n\u001b[0;32m 143\u001b[0m \u001b[0mcost_first_nested_pattern\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mrecursive_low_level_splitter_for_s_and_c_cost\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msymbol_flow\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;33m:\u001b[0m\u001b[0mpf\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget_pattern_size\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfirst_nested_pattern\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mfirst_nested_pattern\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mextended_s_and_c\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mextended_s_and_c\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 144\u001b[0m \u001b[0msecond_nested_pattern\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mpolytope_pattern\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 145\u001b[1;33m \u001b[0mcost_second_nested_pattern\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mrecursive_low_level_splitter_for_s_and_c_cost\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msymbol_flow\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mpf\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget_pattern_size\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfirst_nested_pattern\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0msecond_nested_pattern\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mextended_s_and_c\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mextended_s_and_c\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 146\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mcost_first_nested_pattern\u001b[0m \u001b[1;33m+\u001b[0m \u001b[0mcost_second_nested_pattern\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 147\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", - "\u001b[1;32mc:\\users\\amarmore\\desktop\\projects\\phd main projects\\on git\\code\\polytopes and relation\\polytopes\\polytopical_costs.py\u001b[0m in \u001b[0;36mrecursive_low_level_splitter_for_s_and_c_cost\u001b[1;34m(symbol_flow, polytope_pattern, extended_s_and_c)\u001b[0m\n\u001b[0;32m 141\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 142\u001b[0m \u001b[0mfirst_nested_pattern\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mpolytope_pattern\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 143\u001b[1;33m \u001b[0mcost_first_nested_pattern\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mrecursive_low_level_splitter_for_s_and_c_cost\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msymbol_flow\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;33m:\u001b[0m\u001b[0mpf\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget_pattern_size\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfirst_nested_pattern\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mfirst_nested_pattern\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mextended_s_and_c\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mextended_s_and_c\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 144\u001b[0m \u001b[0msecond_nested_pattern\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mpolytope_pattern\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 145\u001b[0m \u001b[0mcost_second_nested_pattern\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mrecursive_low_level_splitter_for_s_and_c_cost\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msymbol_flow\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mpf\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget_pattern_size\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfirst_nested_pattern\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0msecond_nested_pattern\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mextended_s_and_c\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mextended_s_and_c\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", - "\u001b[1;32mc:\\users\\amarmore\\desktop\\projects\\phd main projects\\on git\\code\\polytopes and relation\\polytopes\\polytopical_costs.py\u001b[0m in \u001b[0;36mrecursive_low_level_splitter_for_s_and_c_cost\u001b[1;34m(symbol_flow, polytope_pattern, extended_s_and_c)\u001b[0m\n\u001b[0;32m 141\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 142\u001b[0m \u001b[0mfirst_nested_pattern\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mpolytope_pattern\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 143\u001b[1;33m \u001b[0mcost_first_nested_pattern\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mrecursive_low_level_splitter_for_s_and_c_cost\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msymbol_flow\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;33m:\u001b[0m\u001b[0mpf\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget_pattern_size\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfirst_nested_pattern\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mfirst_nested_pattern\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mextended_s_and_c\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mextended_s_and_c\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 144\u001b[0m \u001b[0msecond_nested_pattern\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mpolytope_pattern\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 145\u001b[0m \u001b[0mcost_second_nested_pattern\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mrecursive_low_level_splitter_for_s_and_c_cost\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msymbol_flow\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mpf\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget_pattern_size\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfirst_nested_pattern\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0msecond_nested_pattern\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mextended_s_and_c\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mextended_s_and_c\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", - "\u001b[1;32mc:\\users\\amarmore\\desktop\\projects\\phd main projects\\on git\\code\\polytopes and relation\\polytopes\\polytopical_costs.py\u001b[0m in \u001b[0;36mrecursive_low_level_splitter_for_s_and_c_cost\u001b[1;34m(symbol_flow, polytope_pattern, extended_s_and_c)\u001b[0m\n\u001b[0;32m 126\u001b[0m \"\"\"\n\u001b[0;32m 127\u001b[0m \u001b[1;31m# Computing the cost of elements as the sum of all dim 2 polytopes (excluding primers).\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 128\u001b[1;33m \u001b[1;32mif\u001b[0m \u001b[0mlen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msymbol_flow\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m!=\u001b[0m \u001b[0mpf\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget_pattern_size\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mpolytope_pattern\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 129\u001b[0m \u001b[1;32mraise\u001b[0m \u001b[0merr\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mPatternAndSequenceIncompatible\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"Chord sequence and pattern are of different lengths.\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 130\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mpf\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget_pattern_dimension\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mpolytope_pattern\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m<=\u001b[0m \u001b[1;36m2\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", - "\u001b[1;32mc:\\users\\amarmore\\desktop\\projects\\phd main projects\\on git\\code\\polytopes and relation\\polytopes\\pattern_factory.py\u001b[0m in \u001b[0;36mget_pattern_size\u001b[1;34m(pattern)\u001b[0m\n\u001b[0;32m 654\u001b[0m \u001b[0msize\u001b[0m \u001b[1;33m+=\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 655\u001b[0m \u001b[1;32melif\u001b[0m \u001b[0mtype\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mi\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;32mis\u001b[0m \u001b[0mlist\u001b[0m \u001b[1;32mor\u001b[0m \u001b[0mtype\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mi\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;32mis\u001b[0m \u001b[0mtuple\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 656\u001b[1;33m \u001b[0msize\u001b[0m \u001b[1;33m+=\u001b[0m \u001b[0mget_pattern_size\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mi\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 657\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0msize\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 658\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", - "\u001b[1;31mKeyboardInterrupt\u001b[0m: " - ] - } - ], + "outputs": [], "source": [ "# Louboutin\n", "frontiers, cost = sa.dynamic_minimization_louboutin(song)\n", diff --git a/MusicOnPolytopes/__init__.py b/polytopes/__init__.py similarity index 100% rename from MusicOnPolytopes/__init__.py rename to polytopes/__init__.py diff --git a/MusicOnPolytopes/accelerated_polytopical_costs.py b/polytopes/accelerated_polytopical_costs.py similarity index 100% rename from MusicOnPolytopes/accelerated_polytopical_costs.py rename to polytopes/accelerated_polytopical_costs.py diff --git a/MusicOnPolytopes/chord_movement.py b/polytopes/chord_movement.py similarity index 100% rename from MusicOnPolytopes/chord_movement.py rename to polytopes/chord_movement.py diff --git a/MusicOnPolytopes/compute_frontiers.py b/polytopes/compute_frontiers.py similarity index 100% rename from MusicOnPolytopes/compute_frontiers.py rename to polytopes/compute_frontiers.py diff --git a/MusicOnPolytopes/compute_scores.py b/polytopes/compute_scores.py similarity index 100% rename from MusicOnPolytopes/compute_scores.py rename to polytopes/compute_scores.py diff --git a/MusicOnPolytopes/data_manipulation.py b/polytopes/data_manipulation.py similarity index 100% rename from MusicOnPolytopes/data_manipulation.py rename to polytopes/data_manipulation.py diff --git a/MusicOnPolytopes/model/__init__.py b/polytopes/model/__init__.py similarity index 100% rename from MusicOnPolytopes/model/__init__.py rename to polytopes/model/__init__.py diff --git a/MusicOnPolytopes/model/chord.py b/polytopes/model/chord.py similarity index 100% rename from MusicOnPolytopes/model/chord.py rename to polytopes/model/chord.py diff --git a/MusicOnPolytopes/model/constants.py b/polytopes/model/constants.py similarity index 100% rename from MusicOnPolytopes/model/constants.py rename to polytopes/model/constants.py diff --git a/MusicOnPolytopes/model/errors.py b/polytopes/model/errors.py similarity index 100% rename from MusicOnPolytopes/model/errors.py rename to polytopes/model/errors.py diff --git a/MusicOnPolytopes/model/note.py b/polytopes/model/note.py similarity index 100% rename from MusicOnPolytopes/model/note.py rename to polytopes/model/note.py diff --git a/MusicOnPolytopes/model/triad_manipulation.py b/polytopes/model/triad_manipulation.py similarity index 100% rename from MusicOnPolytopes/model/triad_manipulation.py rename to polytopes/model/triad_manipulation.py diff --git a/MusicOnPolytopes/pattern_factory.py b/polytopes/pattern_factory.py similarity index 100% rename from MusicOnPolytopes/pattern_factory.py rename to polytopes/pattern_factory.py diff --git a/MusicOnPolytopes/pattern_manip.py b/polytopes/pattern_manip.py similarity index 100% rename from MusicOnPolytopes/pattern_manip.py rename to polytopes/pattern_manip.py diff --git a/MusicOnPolytopes/polytopical_costs.py b/polytopes/polytopical_costs.py similarity index 100% rename from MusicOnPolytopes/polytopical_costs.py rename to polytopes/polytopical_costs.py diff --git a/MusicOnPolytopes/segmentation_algorithms.py b/polytopes/segmentation_algorithms.py similarity index 100% rename from MusicOnPolytopes/segmentation_algorithms.py rename to polytopes/segmentation_algorithms.py diff --git a/MusicOnPolytopes/segmentation_helper.py b/polytopes/segmentation_helper.py similarity index 100% rename from MusicOnPolytopes/segmentation_helper.py rename to polytopes/segmentation_helper.py diff --git a/MusicOnPolytopes/triad_transformations.py b/polytopes/triad_transformations.py similarity index 100% rename from MusicOnPolytopes/triad_transformations.py rename to polytopes/triad_transformations.py diff --git a/MusicOnPolytopes/voiceleading_utilities.py b/polytopes/voiceleading_utilities.py similarity index 100% rename from MusicOnPolytopes/voiceleading_utilities.py rename to polytopes/voiceleading_utilities.py -- GitLab