Skip to content

Code and notebooks

Every number on this site is computed by the code below. 5 notebooks show the computation step by step, and 10 source files define the functions.

The path of a number

  1. Package The functions are defined in the tonnetz package.
  2. Tests Every number in the brief is checked by a test.
  3. Notebooks The computation is run step by step and produces tables and figures.
  4. Data and site The results are written to data files and the site reads its numbers from there.
The code does not run here. The outputs you see were saved when the notebooks were last run.
Code, comments and printed output are in Turkish. The explanations are translated.

Notebooks

  1. Setup and torus Brief 3 6 code cells, 2 figures
  2. The AEU chain and T1 Brief 4.1 6 code cells, 2 figures
  3. Cycles and T2 Brief 4.2 5 code cells, 1 figures
  4. The diameter of the Tonnetz graph Brief 4.3 3 code cells, 1 figures
  5. Makam scales Brief 4.4 5 code cells, 1 figures

Source files

FileWhat it doesDefinitionsLines
core.py PackageN-TET Tonnetz: nodes, edges, triangles.20156
plr.py PackageThe P, L, R transformations and their compositions.876
chain.py PackageThe chain-of-fifths coordinate and chains of consecutive fifths.677
graph.py PackageDistances and diameter in the Tonnetz graph.227
scales.py PackageMakam scales: the pitch set, the chords it contains and its shape on the network.592
lattice.py PackagePlanar lattice coordinates and the fundamental parallelogram of the torus.565
plot.py PackageMatplotlib drawings for the report figures (optional dependency: matplotlib).181
__init__.py PackageThe N-TET Tonnetz computation core. This file gathers the public functions of the package and lists the equal divisions used in the brief's table.042
export.py ScriptProduces the JSON for the web site and the report: ../data/*.json.8185
test_brief.py TestOne test for each ([DOĞRULANDI], verified) number in the brief. Section numbers follow docs/PROJE-BRIFI.md.25310

Every number on this site comes from data produced by the Python core and is checked by tests.

TÜBİTAK 2204-A mathematics project