Skip to content
This repository was archived by the owner on Aug 11, 2026. It is now read-only.

Commit 897a513

Browse files
committed
fix: use consistent LaTeX dot symbols for octave diacritics
- Replace \bullet with \cdot in lower octave diacritics - Ensures visual consistency between upper (\dot) and lower (\cdot) octave markings - Fixes Issue #21: LaTeX octave diacritics had inconsistent visual weights - Update all corresponding test expectations Before: Upper octaves used thin \dot, lower octaves used bold \bullet After: Both upper and lower octaves use similarly-weighted dot symbols This improves visual consistency in matplotlib visualizations that use the latex_octaved_sargam_letter property for musical notation rendering. Resolves #21
1 parent 8771fa9 commit 897a513

2 files changed

Lines changed: 19 additions & 19 deletions

File tree

idtap/classes/pitch.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -294,12 +294,12 @@ def _octave_diacritic(self) -> str:
294294
def _octave_latex_diacritic(self) -> str:
295295
"""Convert octave to LaTeX math notation for proper diacritic positioning."""
296296
mapping = {
297-
-3: r'\underset{\bullet\bullet\bullet}', # Triple dot below
298-
-2: r'\underset{\bullet\bullet}', # Double dot below
299-
-1: r'\underset{\bullet}', # Single dot below
300-
1: r'\dot', # Single dot above
301-
2: r'\ddot', # Double dot above
302-
3: r'\dddot' # Triple dot above
297+
-3: r'\underset{\cdot\cdot\cdot}', # Triple dot below
298+
-2: r'\underset{\cdot\cdot}', # Double dot below
299+
-1: r'\underset{\cdot}', # Single dot below
300+
1: r'\dot', # Single dot above
301+
2: r'\ddot', # Double dot above
302+
3: r'\dddot' # Triple dot above
303303
}
304304
return mapping.get(self.oct, '')
305305

idtap/tests/pitch_test.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -617,33 +617,33 @@ def test_latex_octaved_sargam_letter_negative_octaves():
617617
"""Test LaTeX octaved sargam letter with negative octaves (dots below)."""
618618
# Test oct=-1 (single dot below)
619619
p = Pitch({'swara': 'sa', 'oct': -1})
620-
assert p.latex_octaved_sargam_letter == r'$\underset{\bullet}{\mathrm{S}}$'
620+
assert p.latex_octaved_sargam_letter == r'$\underset{\cdot}{\mathrm{S}}$'
621621

622622
p = Pitch({'swara': 're', 'raised': True, 'oct': -1})
623-
assert p.latex_octaved_sargam_letter == r'$\underset{\bullet}{\mathrm{R}}$'
623+
assert p.latex_octaved_sargam_letter == r'$\underset{\cdot}{\mathrm{R}}$'
624624

625625
# Test oct=-2 (double dot below)
626626
p = Pitch({'swara': 'ga', 'raised': False, 'oct': -2})
627-
assert p.latex_octaved_sargam_letter == r'$\underset{\bullet\bullet}{\mathrm{g}}$'
627+
assert p.latex_octaved_sargam_letter == r'$\underset{\cdot\cdot}{\mathrm{g}}$'
628628

629629
p = Pitch({'swara': 'ma', 'raised': True, 'oct': -2})
630-
assert p.latex_octaved_sargam_letter == r'$\underset{\bullet\bullet}{\mathrm{M}}$'
630+
assert p.latex_octaved_sargam_letter == r'$\underset{\cdot\cdot}{\mathrm{M}}$'
631631

632632
# Test oct=-3 (triple dot below)
633633
p = Pitch({'swara': 'pa', 'oct': -3})
634-
assert p.latex_octaved_sargam_letter == r'$\underset{\bullet\bullet\bullet}{\mathrm{P}}$'
634+
assert p.latex_octaved_sargam_letter == r'$\underset{\cdot\cdot\cdot}{\mathrm{P}}$'
635635

636636
p = Pitch({'swara': 'dha', 'raised': False, 'oct': -3})
637-
assert p.latex_octaved_sargam_letter == r'$\underset{\bullet\bullet\bullet}{\mathrm{d}}$'
637+
assert p.latex_octaved_sargam_letter == r'$\underset{\cdot\cdot\cdot}{\mathrm{d}}$'
638638

639639

640640
def test_latex_octaved_sargam_letter_all_sargam_all_octaves():
641641
"""Test all sargam letters across all octave levels."""
642642
sargam_letters = ['sa', 're', 'ga', 'ma', 'pa', 'dha', 'ni']
643643
octave_expected = {
644-
-3: r'\underset{\bullet\bullet\bullet}',
645-
-2: r'\underset{\bullet\bullet}',
646-
-1: r'\underset{\bullet}',
644+
-3: r'\underset{\cdot\cdot\cdot}',
645+
-2: r'\underset{\cdot\cdot}',
646+
-1: r'\underset{\cdot}',
647647
0: '',
648648
1: r'\dot',
649649
2: r'\ddot',
@@ -707,9 +707,9 @@ def test_latex_octave_diacritic_helper():
707707
"""Test the _octave_latex_diacritic helper method."""
708708
# Test all octave levels
709709
octave_mapping = {
710-
-3: r'\underset{\bullet\bullet\bullet}',
711-
-2: r'\underset{\bullet\bullet}',
712-
-1: r'\underset{\bullet}',
710+
-3: r'\underset{\cdot\cdot\cdot}',
711+
-2: r'\underset{\cdot\cdot}',
712+
-1: r'\underset{\cdot}',
713713
0: '',
714714
1: r'\dot',
715715
2: r'\ddot',
@@ -729,7 +729,7 @@ def test_latex_properties_edge_cases():
729729

730730
# Test with different fundamentals (should not affect LaTeX output)
731731
p = Pitch({'swara': 'ma', 'raised': True, 'oct': -1, 'fundamental': 440.0})
732-
assert p.latex_octaved_sargam_letter == r'$\underset{\bullet}{\mathrm{M}}$'
732+
assert p.latex_octaved_sargam_letter == r'$\underset{\cdot}{\mathrm{M}}$'
733733

734734
# Test serialization includes existing functionality
735735
p = Pitch({'swara': 'dha', 'raised': False, 'oct': 2})

0 commit comments

Comments
 (0)