Extract DIMS to separate dims.py module

- Create src/dims.py with DIMS_4, DIMS_5, DIMS_7, DIMS_8 constants
- Update pitch.py to import from dims
- Update harmonic_space.py to import from dims
- Update io.py to import from dims
- Fix circular import issue
This commit is contained in:
Michael Winter 2026-03-16 15:50:02 +01:00
parent ed13c006b0
commit b349ee89bc
4 changed files with 9 additions and 6 deletions

5
src/dims.py Normal file
View file

@ -0,0 +1,5 @@
# DIMS constants - which prime factors define harmonic space dimensions
DIMS_8 = (2, 3, 5, 7, 11, 13, 17, 19)
DIMS_7 = (2, 3, 5, 7, 11, 13, 17)
DIMS_5 = (2, 3, 5, 7, 11)
DIMS_4 = (2, 3, 5, 7)

View file

@ -11,8 +11,9 @@ from typing import Iterator
import networkx as nx
from .pitch import Pitch, DIMS_7
from .pitch import Pitch
from .chord import Chord
from .dims import DIMS_4, DIMS_5, DIMS_7, DIMS_8
class HarmonicSpace:

View file

@ -242,7 +242,7 @@ def save_graph_to_cache(
def main():
"""Demo: Generate compact sets and build graph."""
import argparse
from .pitch import DIMS_4, DIMS_5, DIMS_7, DIMS_8
from .dims import DIMS_4, DIMS_5, DIMS_7, DIMS_8
from .harmonic_space import HarmonicSpace
from .graph import PathFinder

View file

@ -12,10 +12,7 @@ from math import log
from operator import add
from typing import Iterator
DIMS_8 = (2, 3, 5, 7, 11, 13, 17, 19)
DIMS_7 = (2, 3, 5, 7, 11, 13, 17)
DIMS_5 = (2, 3, 5, 7, 11)
DIMS_4 = (2, 3, 5, 7)
from .dims import DIMS_4, DIMS_5, DIMS_7, DIMS_8
class Pitch: