stringcalc 0.1.0.dev16__tar.gz → 0.1.0.dev18__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. stringcalc-0.1.0.dev18/.flake8 +3 -0
  2. {stringcalc-0.1.0.dev16 → stringcalc-0.1.0.dev18}/.pre-commit-config.yaml +6 -6
  3. {stringcalc-0.1.0.dev16 → stringcalc-0.1.0.dev18}/.readthedocs.yaml +2 -2
  4. {stringcalc-0.1.0.dev16 → stringcalc-0.1.0.dev18}/PKG-INFO +2 -2
  5. {stringcalc-0.1.0.dev16 → stringcalc-0.1.0.dev18}/README.md +14 -14
  6. {stringcalc-0.1.0.dev16 → stringcalc-0.1.0.dev18}/docs/api.rst +1 -0
  7. {stringcalc-0.1.0.dev16 → stringcalc-0.1.0.dev18}/docs/examples/compare-data.md +108 -88
  8. {stringcalc-0.1.0.dev16 → stringcalc-0.1.0.dev18}/docs/examples/gauge-suggest.md +75 -75
  9. {stringcalc-0.1.0.dev16 → stringcalc-0.1.0.dev18}/docs/examples/pythagoras-ratios.md +57 -52
  10. {stringcalc-0.1.0.dev16 → stringcalc-0.1.0.dev18}/docs/examples/tension-plot.md +106 -106
  11. {stringcalc-0.1.0.dev16 → stringcalc-0.1.0.dev18}/docs/index.md +54 -54
  12. {stringcalc-0.1.0.dev16 → stringcalc-0.1.0.dev18}/docs/prior-art.md +53 -53
  13. {stringcalc-0.1.0.dev16 → stringcalc-0.1.0.dev18}/pyproject.toml +1 -11
  14. {stringcalc-0.1.0.dev16 → stringcalc-0.1.0.dev18}/stringcalc/__init__.py +1 -1
  15. stringcalc-0.1.0.dev18/stringcalc/data/daddario-stp.csv +621 -0
  16. {stringcalc-0.1.0.dev16 → stringcalc-0.1.0.dev18}/stringcalc/frets.py +18 -15
  17. {stringcalc-0.1.0.dev16 → stringcalc-0.1.0.dev18}/stringcalc/tension.py +83 -31
  18. {stringcalc-0.1.0.dev16 → stringcalc-0.1.0.dev18}/tests/test_frets.py +2 -2
  19. {stringcalc-0.1.0.dev16 → stringcalc-0.1.0.dev18}/LICENSE +0 -0
  20. {stringcalc-0.1.0.dev16 → stringcalc-0.1.0.dev18}/docs/cli.rst +0 -0
  21. {stringcalc-0.1.0.dev16 → stringcalc-0.1.0.dev18}/docs/cli_gauge-suggest_tb23nw.svg +0 -0
  22. {stringcalc-0.1.0.dev16 → stringcalc-0.1.0.dev18}/docs/cli_gauge-suggest_tb23nw_d.svg +0 -0
  23. {stringcalc-0.1.0.dev16 → stringcalc-0.1.0.dev18}/docs/conf.py +0 -0
  24. {stringcalc-0.1.0.dev16 → stringcalc-0.1.0.dev18}/docs/panel.rst +0 -0
  25. {stringcalc-0.1.0.dev16 → stringcalc-0.1.0.dev18}/stringcalc/cli.py +0 -0
  26. {stringcalc-0.1.0.dev16 → stringcalc-0.1.0.dev18}/stringcalc/data/__init__.py +0 -0
  27. {stringcalc-0.1.0.dev16 → stringcalc-0.1.0.dev18}/stringcalc/data/aquila-nng.csv +0 -0
  28. {stringcalc-0.1.0.dev16 → stringcalc-0.1.0.dev18}/stringcalc/data/daddario-tension.csv +0 -0
  29. {stringcalc-0.1.0.dev16 → stringcalc-0.1.0.dev18}/stringcalc/data/ghs.csv +0 -0
  30. {stringcalc-0.1.0.dev16 → stringcalc-0.1.0.dev18}/stringcalc/data/stringjoy.csv +0 -0
  31. {stringcalc-0.1.0.dev16 → stringcalc-0.1.0.dev18}/stringcalc/data/worth.csv +0 -0
  32. {stringcalc-0.1.0.dev16 → stringcalc-0.1.0.dev18}/stringcalc/py.typed +0 -0
  33. {stringcalc-0.1.0.dev16 → stringcalc-0.1.0.dev18}/stringcalc/util.py +0 -0
  34. {stringcalc-0.1.0.dev16 → stringcalc-0.1.0.dev18}/tests/test_string.py +0 -0
@@ -0,0 +1,3 @@
1
+ [flake8]
2
+ max-line-length = 100
3
+ ignore = E203,E402,E501,W503,E226
@@ -8,10 +8,10 @@ repos:
8
8
  - id: check-yaml
9
9
 
10
10
  - repo: https://github.com/asottile/pyupgrade
11
- rev: "v3.19.1"
11
+ rev: "v3.20.0"
12
12
  hooks:
13
13
  - id: pyupgrade
14
- args: [--py39-plus]
14
+ args: [--py310-plus]
15
15
 
16
16
  - repo: https://github.com/PyCQA/isort
17
17
  rev: "6.0.1"
@@ -23,12 +23,12 @@ repos:
23
23
  hooks:
24
24
  - id: black
25
25
 
26
- - repo: https://github.com/csachs/pyproject-flake8
27
- rev: "v7.0.0"
26
+ - repo: https://github.com/PyCQA/flake8
27
+ rev: "7.3.0"
28
28
  hooks:
29
- - id: pyproject-flake8 # pflake8
29
+ - id: flake8
30
30
 
31
31
  - repo: https://github.com/rbubley/mirrors-prettier
32
- rev: "v3.5.3"
32
+ rev: "v3.6.2"
33
33
  hooks:
34
34
  - id: prettier
@@ -1,9 +1,9 @@
1
1
  version: 2
2
2
 
3
3
  build:
4
- os: ubuntu-24.04
4
+ os: ubuntu-lts-latest
5
5
  tools:
6
- python: "3.11"
6
+ python: "3.13"
7
7
 
8
8
  python:
9
9
  install:
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stringcalc
3
- Version: 0.1.0.dev16
3
+ Version: 0.1.0.dev18
4
4
  Summary: Calculations for instrument strings
5
5
  Author-email: zmoon <zmoon92@gmail.com>
6
- Requires-Python: ~=3.9
6
+ Requires-Python: ~=3.10
7
7
  Description-Content-Type: text/markdown
8
8
  Classifier: License :: OSI Approved :: MIT License
9
9
  License-File: LICENSE
@@ -1,14 +1,14 @@
1
- # stringcalc
2
-
3
- _Calculations for [string instrument](https://en.wikipedia.org/wiki/String_instrument)s' strings_
4
-
5
- [![Version on PyPI](https://img.shields.io/pypi/v/stringcalc.svg)](https://pypi.org/project/stringcalc/)
6
- [![CI workflow status](https://github.com/zmoon/stringcalc/actions/workflows/ci.yml/badge.svg)](https://github.com/zmoon/stringcalc/actions/workflows/ci.yml)
7
- [![Documentation status](https://readthedocs.org/projects/stringcalc/badge/?version=latest)](https://stringcalc.readthedocs.io/en/latest/)
8
- [![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
9
-
10
- ```sh
11
- stringcalc gauge --suggest -T 17 -L 23 -P G2 -P D3 -P A3 -P E4 -N 6 --type DA:LEW --type DA:LE --no-column-info
12
- ```
13
-
14
- <img src="./docs/cli_gauge-suggest_tb23nw.svg" alt="CLI gauge suggestion output for 23&quot; TB for D'Addario loop-end nickel-wound strings" width="550">
1
+ # stringcalc
2
+
3
+ _Calculations for [string instrument](https://en.wikipedia.org/wiki/String_instrument)s' strings_
4
+
5
+ [![Version on PyPI](https://img.shields.io/pypi/v/stringcalc.svg)](https://pypi.org/project/stringcalc/)
6
+ [![CI workflow status](https://github.com/zmoon/stringcalc/actions/workflows/ci.yml/badge.svg)](https://github.com/zmoon/stringcalc/actions/workflows/ci.yml)
7
+ [![Documentation status](https://readthedocs.org/projects/stringcalc/badge/?version=latest)](https://stringcalc.readthedocs.io/en/latest/)
8
+ [![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
9
+
10
+ ```sh
11
+ stringcalc gauge --suggest -T 17 -L 23 -P G2 -P D3 -P A3 -P E4 -N 6 --type DA:LEW --type DA:LE --no-column-info
12
+ ```
13
+
14
+ <img src="./docs/cli_gauge-suggest_tb23nw.svg" alt="CLI gauge suggestion output for 23&quot; TB for D'Addario loop-end nickel-wound strings" width="550">
@@ -29,6 +29,7 @@ https://github.com/zmoon/stringcalc/tree/main/data.
29
29
  stringcalc.tension.load_data
30
30
  stringcalc.tension.load_aquila_data
31
31
  stringcalc.tension.load_daddario_data
32
+ stringcalc.tension.load_daddario_stp_data
32
33
  stringcalc.tension.load_ghs_data
33
34
  stringcalc.tension.load_stringjoy_data
34
35
  stringcalc.tension.load_worth_data
@@ -1,88 +1,108 @@
1
- ---
2
- file_format: mystnb
3
- kernelspec:
4
- name: python3
5
- ---
6
-
7
- # Compare data
8
-
9
- In this example, we compare data from different manufacturers
10
- for two common string types: plain steel and phosphor bronze ball-end strings.
11
-
12
- ```{code-cell} ipython3
13
- import pandas as pd
14
-
15
- from stringcalc.tension import load_data
16
- ```
17
-
18
- First we load all of the available data with the {func}`~stringcalc.tension.load_data` function.
19
-
20
- ```{code-cell} ipython3
21
- data = load_data()
22
- data
23
- ```
24
-
25
- ## Plain steel
26
-
27
- Plain steel ball-end strings.
28
-
29
- ```{code-cell} ipython3
30
- group_ids = ["DA:PL", "GHS:PL", "SJ:PL"]
31
- (
32
- data.query("group_id in @group_ids")
33
- .pivot_table(
34
- index="gauge",
35
- columns="group_id",
36
- values=["uw"],
37
- observed=True,
38
- )
39
- .mul(1000)
40
- )
41
- ```
42
-
43
- ```{note}
44
- We multiplied `uw`, the unit weight (mass per unit length) [lbm/in]
45
- by 1000 to facilitate easier comparison.
46
- ```
47
-
48
- ## Phosphor bronze
49
-
50
- Phosphor bronze ball-end strings.
51
-
52
- ```{code-cell} ipython3
53
- group_ids = ["DA:PB", "GHS:B", "SJ:PB"]
54
- (
55
- data.query("group_id in @group_ids")
56
- .pivot_table(
57
- index="gauge",
58
- columns="group_id",
59
- values=["uw"],
60
- observed=True,
61
- )
62
- .mul(1000)
63
- )
64
- ```
65
-
66
- ## Nickel-wound
67
-
68
- Nickel-wound ball-end strings.
69
-
70
- - `DA:NW`: D'Addario nickel-plated steel
71
- - `GHS:N`: GHS Nickel Rockers (pure nickel, semi-flattened)
72
- - `GHS:DY`: GHS Boomers (nickel-plated steel)
73
- - `SJ:N`: Stringjoy nickel ("Signatures"; nickel-plated steel?)
74
- - `SJ:PN`: Stringjoy pure nickel ("Broadways")
75
-
76
- ```{code-cell} ipython3
77
- group_ids = ["DA:NW", "GHS:N", "GHS:DY", "SJ:N", "SJ:PN"]
78
- (
79
- data.query("group_id in @group_ids")
80
- .pivot_table(
81
- index="gauge",
82
- columns="group_id",
83
- values=["uw"],
84
- observed=True,
85
- )
86
- .mul(1000)
87
- )
88
- ```
1
+ ---
2
+ file_format: mystnb
3
+ kernelspec:
4
+ name: python3
5
+ ---
6
+
7
+ # Compare data
8
+
9
+ In this example, we compare data from different manufacturers
10
+ for common ball-end string types:
11
+
12
+ - plain steel
13
+ - phosphor bronze
14
+ - nickel-wound
15
+
16
+ ```{code-cell} ipython3
17
+ import pandas as pd
18
+
19
+ from stringcalc.tension import load_data
20
+ ```
21
+
22
+ First we load all of the available data with the {func}`~stringcalc.tension.load_data` function.
23
+
24
+ ```{code-cell} ipython3
25
+ data = load_data()
26
+ data
27
+ ```
28
+
29
+ ## Plain steel
30
+
31
+ Plain steel ball-end strings.
32
+
33
+ ```{code-cell} ipython3
34
+ group_ids = ["DA:PL", "STP:PL", "GHS:PL", "SJ:PL"]
35
+ (
36
+ data.query("group_id in @group_ids")
37
+ .pivot_table(
38
+ index="gauge",
39
+ columns="group_id",
40
+ values=["uw"],
41
+ observed=True,
42
+ )
43
+ .mul(1000)
44
+ .style
45
+ .set_caption("Plain steel")
46
+ .background_gradient(axis=1, cmap="RdBu_r")
47
+ )
48
+ ```
49
+
50
+ ```{note}
51
+ We multiplied `uw`, the unit weight (mass per unit length) [lbm/in]
52
+ by 1000 to facilitate easier comparison.
53
+ ```
54
+
55
+ ```{note}
56
+ Within a given row, a red cell background indicates higher values and blue lower.
57
+ For example, Stringjoy plain steel strings are generally heavier than the others (red),
58
+ and D'Addario original and STP are always quite close (same color).
59
+ The lack of a number in a cell indicates that we don't have data for that gauge.
60
+ ```
61
+
62
+ ## Phosphor bronze
63
+
64
+ Phosphor bronze ball-end strings.
65
+
66
+ ```{code-cell} ipython3
67
+ group_ids = ["DA:PB", "STP:PB", "GHS:B", "SJ:PB"]
68
+ (
69
+ data.query("group_id in @group_ids")
70
+ .pivot_table(
71
+ index="gauge",
72
+ columns="group_id",
73
+ values=["uw"],
74
+ observed=True,
75
+ )
76
+ .mul(1000)
77
+ .style
78
+ .set_caption("Phosphor bronze")
79
+ .background_gradient(axis=1, cmap="RdBu_r")
80
+ )
81
+ ```
82
+
83
+ ## Nickel-wound
84
+
85
+ Nickel-wound ball-end strings.
86
+
87
+ - `DA:NW` and `STP:NW`: D'Addario nickel-plated steel
88
+ - `GHS:N`: GHS Nickel Rockers (pure nickel, semi-flattened)
89
+ - `GHS:DY`: GHS Boomers (nickel-plated steel)
90
+ - `SJ:N`: Stringjoy nickel ("Signatures"; nickel-plated steel?)
91
+ - `SJ:PN`: Stringjoy pure nickel ("Broadways")
92
+
93
+ ```{code-cell} ipython3
94
+ group_ids = ["DA:NW", "STP:NW", "GHS:N", "GHS:DY", "SJ:N", "SJ:PN"]
95
+ (
96
+ data.query("group_id in @group_ids")
97
+ .pivot_table(
98
+ index="gauge",
99
+ columns="group_id",
100
+ values=["uw"],
101
+ observed=True,
102
+ )
103
+ .mul(1000)
104
+ .style
105
+ .set_caption("Nickel-wound")
106
+ .background_gradient(axis=1, cmap="RdBu_r")
107
+ )
108
+ ```
@@ -1,75 +1,75 @@
1
- ---
2
- file_format: mystnb
3
- kernelspec:
4
- name: python3
5
- ---
6
-
7
- # Gauge suggest
8
-
9
- We can use the {doc}`/api` or the {doc}`/cli` to do this.
10
- For example, consider this Irish tenor banjo situation
11
- (also shown in [the GitHub README](https://github.com/zmoon/stringcalc/blob/main/README.md)):
12
-
13
- - target tension: 17 lbf
14
- - scale length: 23"
15
- - tuning: G{sub}`2` D{sub}`3` A{sub}`3` E{sub}`4`
16
- - string types: D'Addario loop-end nickel-wound and plain steel (`DA:LEW` and `DA:LE`)
17
-
18
- ## API
19
-
20
- We use the function {func}`stringcalc.tension.suggest_gauge`.
21
-
22
- ```{code-cell} ipython3
23
- :tags: [hide-output]
24
-
25
- from stringcalc.tension import suggest_gauge
26
- ```
27
-
28
- ```{code-cell} ipython3
29
- T = 17
30
- L = 23
31
- pitches = ["G2", "D3", "A3", "E4"]
32
- types = {"DA:LEW", "DA:LE"}
33
-
34
- for pitch in pitches:
35
- df = suggest_gauge(T, L, pitch, types=types, n=6)
36
- display(
37
- df
38
- .style
39
- .set_caption(f'{pitch}, target T = {T} lbf')
40
- .highlight_min(df.dT.abs().argmin())
41
- )
42
- ```
43
-
44
- Most players would prefer a wound A string.
45
- The 018w is probably a better choice than the 017p here, tone- and balance-wise,
46
- even though it is farther from the target tension.
47
-
48
- ## CLI
49
-
50
- On the command-line, we can do the same thing
51
- with `stringcalc gauge --suggest`:
52
-
53
- ```sh
54
- stringcalc gauge --suggest -T 17 -L 23 -P G2 -P D3 -P A3 -P E4 -N 6 --type DA:LEW --type DA:LE --no-column-info
55
- ```
56
-
57
- ```{image} ../cli_gauge-suggest_tb23nw.svg
58
- :alt: CLI gauge suggestion output for 23" TB for D'Addario loop-end nickel-wound strings
59
- :width: 550
60
-
61
- ```
62
-
63
- `--no-column-info` suppresses the descriptions of the columns,
64
- which currently are repeated for each boxed result.
65
- For a single string query, it looks like this:
66
-
67
- ```sh
68
- stringcalc gauge --suggest -T 17 -L 23 -P D3 --type DA:LEW
69
- ```
70
-
71
- ```{image} ../cli_gauge-suggest_tb23nw_d.svg
72
- :alt: CLI gauge suggestion output for 23" TB D string using D'Addario loop-end nickel-wound strings
73
- :width: 450
74
-
75
- ```
1
+ ---
2
+ file_format: mystnb
3
+ kernelspec:
4
+ name: python3
5
+ ---
6
+
7
+ # Gauge suggest
8
+
9
+ We can use the {doc}`/api` or the {doc}`/cli` to do this.
10
+ For example, consider this Irish tenor banjo situation
11
+ (also shown in [the GitHub README](https://github.com/zmoon/stringcalc/blob/main/README.md)):
12
+
13
+ - target tension: 17 lbf
14
+ - scale length: 23"
15
+ - tuning: G{sub}`2` D{sub}`3` A{sub}`3` E{sub}`4`
16
+ - string types: D'Addario loop-end nickel-wound and plain steel (`DA:LEW` and `DA:LE`)
17
+
18
+ ## API
19
+
20
+ We use the function {func}`stringcalc.tension.suggest_gauge`.
21
+
22
+ ```{code-cell} ipython3
23
+ :tags: [hide-output]
24
+
25
+ from stringcalc.tension import suggest_gauge
26
+ ```
27
+
28
+ ```{code-cell} ipython3
29
+ T = 17
30
+ L = 23
31
+ pitches = ["G2", "D3", "A3", "E4"]
32
+ types = {"DA:LEW", "DA:LE"}
33
+
34
+ for pitch in pitches:
35
+ df = suggest_gauge(T, L, pitch, types=types, n=6)
36
+ display(
37
+ df
38
+ .style
39
+ .set_caption(f'{pitch}, target T = {T} lbf')
40
+ .highlight_min(df.dT.abs().argmin())
41
+ )
42
+ ```
43
+
44
+ Most players would prefer a wound A string.
45
+ The 018w is probably a better choice than the 017p here, tone- and balance-wise,
46
+ even though it is farther from the target tension.
47
+
48
+ ## CLI
49
+
50
+ On the command-line, we can do the same thing
51
+ with `stringcalc gauge --suggest`:
52
+
53
+ ```sh
54
+ stringcalc gauge --suggest -T 17 -L 23 -P G2 -P D3 -P A3 -P E4 -N 6 --type DA:LEW --type DA:LE --no-column-info
55
+ ```
56
+
57
+ ```{image} ../cli_gauge-suggest_tb23nw.svg
58
+ :alt: CLI gauge suggestion output for 23" TB for D'Addario loop-end nickel-wound strings
59
+ :width: 550
60
+
61
+ ```
62
+
63
+ `--no-column-info` suppresses the descriptions of the columns,
64
+ which currently are repeated for each boxed result.
65
+ For a single string query, it looks like this:
66
+
67
+ ```sh
68
+ stringcalc gauge --suggest -T 17 -L 23 -P D3 --type DA:LEW
69
+ ```
70
+
71
+ ```{image} ../cli_gauge-suggest_tb23nw_d.svg
72
+ :alt: CLI gauge suggestion output for 23" TB D string using D'Addario loop-end nickel-wound strings
73
+ :width: 450
74
+
75
+ ```
@@ -1,52 +1,57 @@
1
- ---
2
- file_format: mystnb
3
- kernelspec:
4
- name: python3
5
- ---
6
-
7
- # Pythagoras ratios
8
-
9
- ```{code-cell} ipython3
10
- from fractions import Fraction
11
-
12
- from stringcalc.frets import distances
13
- ```
14
-
15
- ## Define the ratios
16
-
17
- I first saw these in [this StackExchange post](https://music.stackexchange.com/questions/93731/does-guitar-fret-spacing-solely-depend-on-the-length-of-the-string).
18
- The same diagram can be found [here](https://passyworldofmathematics.com/guitar-mathematics/), which seems to be the original source.
19
-
20
- ```{code-cell} ipython3
21
- # This maps the fret number to the relative distance to the saddle.
22
- ratios = {
23
- 2: "8/9",
24
- 3: "64/81",
25
- 5: "3/4",
26
- 7: "2/3",
27
- 9: "16/27",
28
- 11: "128/243",
29
- 12: "1/2",
30
- }
31
- ratios = {k: Fraction(v) for k, v in ratios.items()}
32
- ```
33
-
34
- ## Compare to our equal-temperament calculations
35
-
36
- We use {func}`stringcalc.frets.distances`.
37
-
38
- ```{code-cell} ipython3
39
- df = distances(12, L=1)
40
- df["Pythagoras"] = df.index.map(ratios)
41
- df["Pythagoras float"] = df["Pythagoras"].astype(float)
42
-
43
- (
44
- df
45
- .assign(**{
46
- "Δ": df["Pythagoras float"] - df["d_inv"],
47
- "Equal temperament": df["d_inv"]}
48
- )
49
- [["Pythagoras", "Pythagoras float", "Equal temperament", "Δ"]]
50
- .fillna("")
51
- )
52
- ```
1
+ ---
2
+ file_format: mystnb
3
+ kernelspec:
4
+ name: python3
5
+ ---
6
+
7
+ # Pythagoras ratios
8
+
9
+ ```{code-cell} ipython3
10
+ from fractions import Fraction
11
+
12
+ from stringcalc.frets import distances
13
+ ```
14
+
15
+ ## Define the ratios
16
+
17
+ I first saw these in [this StackExchange post](https://music.stackexchange.com/questions/93731/does-guitar-fret-spacing-solely-depend-on-the-length-of-the-string).
18
+ The same diagram can be found [here](https://passyworldofmathematics.com/guitar-mathematics/), which seems to be the original source.
19
+ I used [this table](https://en.wikipedia.org/wiki/Pythagorean_tuning#Method) to fill in (most of) the gaps (leaving out fret 6 since it is ambiguous).
20
+
21
+ ```{code-cell} ipython3
22
+ # This maps the fret number to the relative distance to the saddle.
23
+ ratios = {
24
+ 1: "243/256",
25
+ 2: "8/9",
26
+ 3: "27/32",
27
+ 4: "64/81",
28
+ 5: "3/4",
29
+ 7: "2/3",
30
+ 8: "81/128",
31
+ 9: "16/27",
32
+ 10: "9/16",
33
+ 11: "128/243",
34
+ 12: "1/2",
35
+ }
36
+ ratios = {k: Fraction(v) for k, v in ratios.items()}
37
+ ```
38
+
39
+ ## Compare to our equal-temperament calculations
40
+
41
+ We use {func}`stringcalc.frets.distances`.
42
+
43
+ ```{code-cell} ipython3
44
+ df = distances(12, L=1)
45
+ df["Pythagoras"] = df.index.map(ratios)
46
+ df["Pythagoras float"] = df["Pythagoras"].astype(float)
47
+
48
+ (
49
+ df
50
+ .assign(**{
51
+ "Δ": df["Pythagoras float"] - df["d_inv"],
52
+ "Equal temperament": df["d_inv"]}
53
+ )
54
+ [["Pythagoras", "Pythagoras float", "Equal temperament", "Δ"]]
55
+ .fillna("")
56
+ )
57
+ ```