"This notebook will briefly present some functionnalities implemented to cope with symbolic representation of music, as an upgrade of C. Louboutin's code."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"It contains 2 files: note.py, chord.py.\n",
"All these files represent different objects, used to handle musical information at different levels.\n",
"\n",
"A note is the most basic element, a chord is an aggregation of notes."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## note.py"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"ExecuteTime": {
"end_time": "2020-10-30T15:35:39.980475Z",
"start_time": "2020-10-30T15:35:39.976485Z"
},
"scrolled": true
},
"outputs": [],
"source": [
"from polytopes.model.note import Note"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's start with the Note object, which is the lowest-level object in music.\n",
"\n",
"The interest of defining such an object is that it allows us to control what is an acceptable note, and what isn't."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Initialization"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Particularily, a Note contains two attributes:\n",
" - a number: between 0 and 11, which corresponds to the pitch classe of the note. 0 represent the C pitch class, and 11 the B pitch class. \n",
" - a symbol: the classical representation of a note as a letter, with flat (\"b\") or sharp(\"#\") suffixes."
"\u001b[1;32m<ipython-input-10-8a3266453d6f>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0ma_note\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mnumber\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;36m15\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[1;32mc:\\users\\amarmore\\desktop\\projects\\phd main projects\\on git\\code\\polytopes and relation\\polytopes\\model\\note.py\u001b[0m in \u001b[0;36m_set_number\u001b[1;34m(self, number)\u001b[0m\n\u001b[0;32m 122\u001b[0m \u001b[1;32mraise\u001b[0m \u001b[0merr\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mInvalidNoteNumberException\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"The desired new number is not an integer, and is not valid.\"\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[1;32mNone\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 123\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0mIndexError\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 124\u001b[1;33m \u001b[1;32mraise\u001b[0m \u001b[0merr\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mInvalidNoteNumberException\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"The desired new number is too large to be a valid note.\"\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[1;32mNone\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 125\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 126\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;31mInvalidNoteNumberException\u001b[0m: The desired new number is too large to be a valid note."
]
}
],
"source": [
"a_note.number = 15"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"ExecuteTime": {
"end_time": "2020-10-30T15:35:52.920685Z",
"start_time": "2020-10-30T15:35:52.908717Z"
},
"scrolled": true
},
"outputs": [
{
"ename": "InvalidNoteSymbolException",
"evalue": "This symbol is not a correct note symbol.",
"\u001b[1;32m<ipython-input-11-20488d99cd64>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0ma_note\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msymbol\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;34m'K'\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[1;32mc:\\users\\amarmore\\desktop\\projects\\phd main projects\\on git\\code\\polytopes and relation\\polytopes\\model\\note.py\u001b[0m in \u001b[0;36m_set_symbol\u001b[1;34m(self, symbol)\u001b[0m\n\u001b[0;32m 87\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_number\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mnumber_from_symbol\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 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[1;32mraise\u001b[0m \u001b[0merr\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mInvalidNoteSymbolException\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"This symbol is not a correct note symbol.\"\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[1;32mNone\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;33m\u001b[0m\u001b[0m\n\u001b[0;32m 91\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0m_get_number\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\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;31mInvalidNoteSymbolException\u001b[0m: This symbol is not a correct note symbol."
]
}
],
"source": [
"a_note.symbol = 'K'"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Finally, sharp and flat symbols should both exist but shouldn't invalid tests, as they represent the same note.\n"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"ExecuteTime": {
"end_time": "2020-10-30T15:35:55.400706Z",
"start_time": "2020-10-30T15:35:55.396706Z"
},
"scrolled": true
},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Note('A#') == Note(\"Bb\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"By default, a note symbol is set in flat convention. Still, it can be set to sharp with an argument in the constructor."
"\u001b[1;32m<ipython-input-18-bf07a16d637a>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mChord\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[0m",
"\u001b[1;32mc:\\users\\amarmore\\desktop\\projects\\phd main projects\\on git\\code\\polytopes and relation\\polytopes\\model\\chord.py\u001b[0m in \u001b[0;36m__init__\u001b[1;34m(self, a_chord, redundancy)\u001b[0m\n\u001b[0;32m 71\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_notes\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mlocal_notes\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 72\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_notes\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---> 73\u001b[1;33m \u001b[1;32mraise\u001b[0m \u001b[0merr\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mInvalidChordNotesException\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"Empty list of notes: a Chord must admit notes.\"\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[1;32mNone\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 74\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_triad\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mtriad_from_notes\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 75\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mtriad\u001b[0m \u001b[1;33m!=\u001b[0m \u001b[0mcst\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mAMBIGUOUS\u001b[0m \u001b[1;32mand\u001b[0m \u001b[1;32mnot\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_redundant\u001b[0m\u001b[1;33m:\u001b[0m \u001b[1;31m# A redundant chord shouldn't be reordered as it corresponds to permutated chord (#TODO: rename the parameter ?)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;31mInvalidChordNotesException\u001b[0m: Empty list of notes: a Chord must admit notes."
]
}
],
"source": [
"Chord([])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"It can be directly defined by a list of numbers."
"To facilitates the visualization of polytopes, when they contain 16 elements, a 4 by 4 visualization function has been implemented."
]
},
{
"cell_type": "code",
"execution_count": 53,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"16"
]
},
"execution_count": 53,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"polytope.get_length()"
]
},
{
"cell_type": "code",
"execution_count": 54,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0 [8, 0, 3] 1 [8, 0, 3] \n",
"2 [8, 0, 3] 3 [8, 0, 3] \n",
"\n",
"4 [7, 10, 2] 5 [7, 10, 2] \n",
"6 [7, 10, 2] 7 [7, 10, 2] \n",
"\n",
"8 [8, 0, 3] 9 [8, 0, 3] \n",
"10 [8, 0, 3] 11 [8, 0, 3] \n",
"\n",
"12 [10, 1, 5] 13 [10, 1, 5] \n",
"14 [3, 7, 10] 15 [3, 7, 10] \n",
"\n"
]
}
],
"source": [
"polytope.pretty_print()"
]
},
{
"cell_type": "code",
"execution_count": 55,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0 Ab 1 Ab \n",
"2 Ab 3 Ab \n",
"\n",
"4 Gm 5 Gm \n",
"6 Gm 7 Gm \n",
"\n",
"8 Ab 9 Ab \n",
"10 Ab 11 Ab \n",
"\n",
"12 Bbm 13 Bbm \n",
"14 Eb 15 Eb \n",
"\n"
]
}
],
"source": [
"polytope.pretty_print(symbols = True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"It is also possible to access to the chords of a polytope as a list of Chord symbols or by lists of the note numbers:"
]
},
{
"cell_type": "code",
"execution_count": 56,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['Ab',\n",
" 'Ab',\n",
" 'Ab',\n",
" 'Ab',\n",
" 'Gm',\n",
" 'Gm',\n",
" 'Gm',\n",
" 'Gm',\n",
" 'Ab',\n",
" 'Ab',\n",
" 'Ab',\n",
" 'Ab',\n",
" 'Bbm',\n",
" 'Bbm',\n",
" 'Eb',\n",
" 'Eb']"
]
},
"execution_count": 56,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"polytope.get_list_of_symbols()"
]
},
{
"cell_type": "code",
"execution_count": 57,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[[8, 0, 3],\n",
" [8, 0, 3],\n",
" [8, 0, 3],\n",
" [8, 0, 3],\n",
" [7, 10, 2],\n",
" [7, 10, 2],\n",
" [7, 10, 2],\n",
" [7, 10, 2],\n",
" [8, 0, 3],\n",
" [8, 0, 3],\n",
" [8, 0, 3],\n",
" [8, 0, 3],\n",
" [10, 1, 5],\n",
" [10, 1, 5],\n",
" [3, 7, 10],\n",
" [3, 7, 10]]"
]
},
"execution_count": 57,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"polytope.get_list_of_numbers()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"One of the interest of the polytopical paradigm is to reorder the elements in a non sequential way.\n",
"\n",
"In that context, a promising framework, developed in [Louboutin 2017], is the \"Primer Preseving Permutation\" system, or PPP. Here, it is possible to obtain the ppp of a polytope with the methods:"
]
},
{
"cell_type": "code",
"execution_count": 58,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[[8, 0, 3],\n",
" [8, 0, 3],\n",
" [7, 10, 2],\n",
" [7, 10, 2],\n",
" [8, 0, 3],\n",
" [8, 0, 3],\n",
" [7, 10, 2],\n",
" [7, 10, 2],\n",
" [8, 0, 3],\n",
" [8, 0, 3],\n",
" [10, 1, 5],\n",
" [10, 1, 5],\n",
" [8, 0, 3],\n",
" [8, 0, 3],\n",
" [3, 7, 10],\n",
" [3, 7, 10]]"
]
},
"execution_count": 58,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"polytope.get_ppp(1).get_list_of_numbers() # The argument is the index of the desired ppp."
"Finally, it is also possible to add a Chord to a polytope."
]
},
{
"cell_type": "code",
"execution_count": 61,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"17"
]
},
"execution_count": 61,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"polytope.add_chord('Abmin')\n",
"polytope.get_length()"
]
},
{
"cell_type": "code",
"execution_count": 62,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[[8, 0, 3],\n",
" [8, 0, 3],\n",
" [8, 0, 3],\n",
" [8, 0, 3],\n",
" [7, 10, 2],\n",
" [7, 10, 2],\n",
" [7, 10, 2],\n",
" [7, 10, 2],\n",
" [8, 0, 3],\n",
" [8, 0, 3],\n",
" [8, 0, 3],\n",
" [8, 0, 3],\n",
" [10, 1, 5],\n",
" [10, 1, 5],\n",
" [3, 7, 10],\n",
" [3, 7, 10],\n",
" [8, 11, 3]]"
]
},
"execution_count": 62,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"polytope.get_list_of_numbers()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.5"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
},
"varInspector": {
"cols": {
"lenName": 16,
"lenType": 16,
"lenVar": 40
},
"kernels_config": {
"python": {
"delete_cmd_postfix": "",
"delete_cmd_prefix": "del ",
"library": "var_list.py",
"varRefreshCmd": "print(var_dic_list())"
},
"r": {
"delete_cmd_postfix": ") ",
"delete_cmd_prefix": "rm(",
"library": "var_list.r",
"varRefreshCmd": "cat(var_dic_list()) "
}
},
"types_to_exclude": [
"module",
"function",
"builtin_function_or_method",
"instance",
"_Feature"
],
"window_display": false
}
},
"nbformat": 4,
"nbformat_minor": 2
}
%% Cell type:markdown id: tags:
# Tutorial for the model classes.
%% Cell type:markdown id: tags:
This notebook will briefly present some functionnalities implemented to cope with symbolic representation of music, as an upgrade of C. Louboutin's code.
%% Cell type:markdown id: tags:
It contains 2 files: note.py, chord.py.
All these files represent different objects, used to handle musical information at different levels.
A note is the most basic element, a chord is an aggregation of notes.
%% Cell type:markdown id: tags:
## note.py
%% Cell type:code id: tags:
``` python
frompolytopes.model.noteimportNote
```
%% Cell type:markdown id: tags:
Let's start with the Note object, which is the lowest-level object in music.
The interest of defining such an object is that it allows us to control what is an acceptable note, and what isn't.
%% Cell type:markdown id: tags:
### Initialization
%% Cell type:markdown id: tags:
Particularily, a Note contains two attributes:
- a number: between 0 and 11, which corresponds to the pitch classe of the note. 0 represent the C pitch class, and 11 the B pitch class.
- a symbol: the classical representation of a note as a letter, with flat ("b") or sharp("#") suffixes.
c:\users\amarmore\desktop\projects\phd main projects\on git\code\polytopes and relation\polytopes\model\chord.py in __init__(self, a_chord, redundancy)
71 self._notes = local_notes
72 if self._notes == []:
---> 73 raise err.InvalidChordNotesException("Empty list of notes: a Chord must admit notes.") from None
74 self._triad = self.triad_from_notes()
75 if self.triad != cst.AMBIGUOUS and not self._redundant: # A redundant chord shouldn't be reordered as it corresponds to permutated chord (#TODO: rename the parameter ?)
InvalidChordNotesException: Empty list of notes: a Chord must admit notes.
c:\users\amarmore\desktop\projects\phd main projects\on git\code\polytopes and relation\polytopes\model\chord.py in __init__(self, a_chord, redundancy)
67 else:
---> 68 note_obj = Note(int(a_note))
69 if not note_obj.is_in_list_of_notes(local_notes) or self._redundant:
ValueError: invalid literal for int() with base 10: 'A'
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
<ipython-input-20-6a8e4e2a89cb> in <module>
----> 1 Chord(['A', 'C', 'E'])
c:\users\amarmore\desktop\projects\phd main projects\on git\code\polytopes and relation\polytopes\model\chord.py in __init__(self, a_chord, redundancy)
80 except ValueError: # If it's a symbol
81 try:
---> 82 self._symbol = format_symbol(a_chord)
83 self._root = self.root_from_symbol()
84 self._triad = self.triad_from_symbol()
c:\users\amarmore\desktop\projects\phd main projects\on git\code\polytopes and relation\polytopes\model\chord.py in format_symbol(symbol)
693 """
694 try:
--> 695 int(symbol)
696 raise err.InvalidChordSymbolException("The symbol isn't valid.") from None
697 except ValueError:
TypeError: int() argument must be a string, a bytes-like object or a number, not 'list'
c:\users\amarmore\desktop\projects\phd main projects\on git\code\polytopes and relation\polytopes\model\chord.py in _not_on_my_watch(self, *args, **kwargs)
197 Raises an error, as these attributes must be found from either the notes or the symbol, and not set independantly (they don't contain enough information on the chord).
198 """
--> 199 raise err.CantModifyAttribute("Not on my watch: you can't modify this attribute alone, you can only modify the notes or the symbol.") from None
To facilitates the visualization of polytopes, when they contain 16 elements, a 4 by 4 visualization function has been implemented.
%% Cell type:code id: tags:
``` python
polytope.get_length()
```
%% Output
16
%% Cell type:code id: tags:
``` python
polytope.pretty_print()
```
%% Output
0 [8, 0, 3] 1 [8, 0, 3]
2 [8, 0, 3] 3 [8, 0, 3]
4 [7, 10, 2] 5 [7, 10, 2]
6 [7, 10, 2] 7 [7, 10, 2]
8 [8, 0, 3] 9 [8, 0, 3]
10 [8, 0, 3] 11 [8, 0, 3]
12 [10, 1, 5] 13 [10, 1, 5]
14 [3, 7, 10] 15 [3, 7, 10]
%% Cell type:code id: tags:
``` python
polytope.pretty_print(symbols=True)
```
%% Output
0 Ab 1 Ab
2 Ab 3 Ab
4 Gm 5 Gm
6 Gm 7 Gm
8 Ab 9 Ab
10 Ab 11 Ab
12 Bbm 13 Bbm
14 Eb 15 Eb
%% Cell type:markdown id: tags:
It is also possible to access to the chords of a polytope as a list of Chord symbols or by lists of the note numbers:
%% Cell type:code id: tags:
``` python
polytope.get_list_of_symbols()
```
%% Output
['Ab',
'Ab',
'Ab',
'Ab',
'Gm',
'Gm',
'Gm',
'Gm',
'Ab',
'Ab',
'Ab',
'Ab',
'Bbm',
'Bbm',
'Eb',
'Eb']
%% Cell type:code id: tags:
``` python
polytope.get_list_of_numbers()
```
%% Output
[[8, 0, 3],
[8, 0, 3],
[8, 0, 3],
[8, 0, 3],
[7, 10, 2],
[7, 10, 2],
[7, 10, 2],
[7, 10, 2],
[8, 0, 3],
[8, 0, 3],
[8, 0, 3],
[8, 0, 3],
[10, 1, 5],
[10, 1, 5],
[3, 7, 10],
[3, 7, 10]]
%% Cell type:markdown id: tags:
One of the interest of the polytopical paradigm is to reorder the elements in a non sequential way.
In that context, a promising framework, developed in [Louboutin 2017], is the "Primer Preseving Permutation" system, or PPP. Here, it is possible to obtain the ppp of a polytope with the methods:
%% Cell type:code id: tags:
``` python
polytope.get_ppp(1).get_list_of_numbers()# The argument is the index of the desired ppp.
```
%% Output
[[8, 0, 3],
[8, 0, 3],
[7, 10, 2],
[7, 10, 2],
[8, 0, 3],
[8, 0, 3],
[7, 10, 2],
[7, 10, 2],
[8, 0, 3],
[8, 0, 3],
[10, 1, 5],
[10, 1, 5],
[8, 0, 3],
[8, 0, 3],
[3, 7, 10],
[3, 7, 10]]
%% Cell type:code id: tags:
``` python
polytope.get_all_ppps()
```
%% Output
[<polytop.Polytop at 0x23b26514808>,
<polytop.Polytop at 0x23b26514908>,
<polytop.Polytop at 0x23b26514f08>,
<polytop.Polytop at 0x23b26514608>,
<polytop.Polytop at 0x23b26514548>,
<polytop.Polytop at 0x23b26514208>]
%% Cell type:code id: tags:
``` python
polytope.get_all_ppps()[3].get_list_of_symbols()
```
%% Output
['Ab',
'Ab',
'Ab',
'Ab',
'Ab',
'Ab',
'Ab',
'Ab',
'Gm',
'Gm',
'Bbm',
'Bbm',
'Gm',
'Gm',
'Eb',
'Eb']
%% Cell type:markdown id: tags:
Finally, it is also possible to add a Chord to a polytope.