stringcalc 0.1.0.dev14__py3-none-any.whl → 0.1.0.dev15__py3-none-any.whl
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.
- stringcalc/__init__.py +1 -1
- stringcalc/cli.py +65 -3
- stringcalc/frets.py +4 -3
- stringcalc/tension.py +2 -2
- {stringcalc-0.1.0.dev14.dist-info → stringcalc-0.1.0.dev15.dist-info}/METADATA +3 -3
- stringcalc-0.1.0.dev15.dist-info/RECORD +16 -0
- {stringcalc-0.1.0.dev14.dist-info → stringcalc-0.1.0.dev15.dist-info}/WHEEL +1 -1
- stringcalc-0.1.0.dev14.dist-info/RECORD +0 -16
- {stringcalc-0.1.0.dev14.dist-info → stringcalc-0.1.0.dev15.dist-info}/LICENSE +0 -0
- {stringcalc-0.1.0.dev14.dist-info → stringcalc-0.1.0.dev15.dist-info}/entry_points.txt +0 -0
stringcalc/__init__.py
CHANGED
stringcalc/cli.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""
|
|
2
2
|
CLI
|
|
3
3
|
"""
|
|
4
|
+
|
|
4
5
|
from __future__ import annotations
|
|
5
6
|
|
|
6
7
|
import functools
|
|
@@ -85,7 +86,7 @@ def _version_callback(show: bool):
|
|
|
85
86
|
|
|
86
87
|
|
|
87
88
|
@app.callback()
|
|
88
|
-
def main(
|
|
89
|
+
def main( # noqa: E704
|
|
89
90
|
version: bool = typer.Option(
|
|
90
91
|
False,
|
|
91
92
|
"--version/",
|
|
@@ -93,8 +94,7 @@ def main(
|
|
|
93
94
|
callback=_version_callback,
|
|
94
95
|
is_eager=True,
|
|
95
96
|
)
|
|
96
|
-
):
|
|
97
|
-
...
|
|
97
|
+
): ...
|
|
98
98
|
|
|
99
99
|
|
|
100
100
|
def _with_float_nonext_dtypes(df):
|
|
@@ -298,6 +298,34 @@ def gauge_(
|
|
|
298
298
|
nsuggest: int = typer.Option(
|
|
299
299
|
3, "-N", "--nsuggest", help="Number of suggestions. Only relevant if using --suggest."
|
|
300
300
|
),
|
|
301
|
+
is_fan: bool = typer.Option(
|
|
302
|
+
None,
|
|
303
|
+
"--fanned",
|
|
304
|
+
help=(
|
|
305
|
+
"Fanned calculations. Must provide two scale lengths. "
|
|
306
|
+
"Assumed if two scale lengths are provided."
|
|
307
|
+
),
|
|
308
|
+
),
|
|
309
|
+
nut_width: float = typer.Option(
|
|
310
|
+
None,
|
|
311
|
+
"-w",
|
|
312
|
+
"--nut-width",
|
|
313
|
+
help=(
|
|
314
|
+
"Neck width at (center of?) nut (for fanned calculations). "
|
|
315
|
+
"Required if using --fanned."
|
|
316
|
+
),
|
|
317
|
+
),
|
|
318
|
+
edge_space: list[float] = typer.Option(
|
|
319
|
+
None,
|
|
320
|
+
"-e",
|
|
321
|
+
"--edge-space",
|
|
322
|
+
help=(
|
|
323
|
+
"Edge space, between the edge of the neck and the center of the first string. "
|
|
324
|
+
"You can specify one (used for both left and right) or two (left, right). "
|
|
325
|
+
'The default is 5/32" on the left and 1/8" on the right. '
|
|
326
|
+
"Only used for fanned calculations."
|
|
327
|
+
),
|
|
328
|
+
),
|
|
301
329
|
float_format: str = typer.Option(
|
|
302
330
|
r"%.3f", help="Format for float-to-string conversion. Only relevant if using --suggest."
|
|
303
331
|
),
|
|
@@ -327,6 +355,40 @@ def gauge_(
|
|
|
327
355
|
else:
|
|
328
356
|
types_set = set(types)
|
|
329
357
|
|
|
358
|
+
if is_fan is None:
|
|
359
|
+
is_fan = len(L) == 2
|
|
360
|
+
if is_fan:
|
|
361
|
+
if len(L) != 2:
|
|
362
|
+
error(
|
|
363
|
+
"Must supply two scale lengths (bass and treble sides) for fanned calculation. "
|
|
364
|
+
f"Got {len(L)}.",
|
|
365
|
+
rc=2,
|
|
366
|
+
)
|
|
367
|
+
n_str = max(len(T), len(P))
|
|
368
|
+
if n_str < 2:
|
|
369
|
+
error("Need at least two strings for fanned calculation.", rc=2)
|
|
370
|
+
if not nut_width:
|
|
371
|
+
error("Must supply nut width for fanned calculation.", rc=2)
|
|
372
|
+
if edge_space is None:
|
|
373
|
+
edge_space = [5 / 32, 1 / 8]
|
|
374
|
+
else:
|
|
375
|
+
if len(edge_space) == 1:
|
|
376
|
+
edge_space *= 2
|
|
377
|
+
elif len(edge_space) > 2:
|
|
378
|
+
error(f"Specify one or two edge space values. Got {len(edge_space)}.", rc=2)
|
|
379
|
+
e_b, e_t = edge_space
|
|
380
|
+
L_b, L_t = L
|
|
381
|
+
dLdx = (L_t - L_b) / nut_width
|
|
382
|
+
d = (nut_width - e_b - e_t) / (n_str - 1) # string spacing
|
|
383
|
+
xs = [e_b + i * d for i in range(n_str)]
|
|
384
|
+
L = [round(L_b + dLdx * x, 4) for x in xs]
|
|
385
|
+
if verbose:
|
|
386
|
+
info(f"Nut width: {nut_width}")
|
|
387
|
+
info(f"Left/bass edge space: {e_b}")
|
|
388
|
+
info(f"Right/treble edge space: {e_t}")
|
|
389
|
+
info(f"Computed string spacing: {round(d, 4)}")
|
|
390
|
+
info(f"Computed string nut positions: {[round(x, 4) for x in xs]}")
|
|
391
|
+
|
|
330
392
|
if verbose:
|
|
331
393
|
info(f"Searching string types: {types_set}")
|
|
332
394
|
|
stringcalc/frets.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Fret distances
|
|
3
3
|
"""
|
|
4
|
+
|
|
4
5
|
from __future__ import annotations
|
|
5
6
|
|
|
6
7
|
from typing import Union
|
|
@@ -18,7 +19,7 @@ QLike = Union[Quantity, str]
|
|
|
18
19
|
# Note also `pint._typing.UnitLike`
|
|
19
20
|
|
|
20
21
|
|
|
21
|
-
def distance_et(n: int | npt.ArrayLike, *, L: float) -> np.
|
|
22
|
+
def distance_et(n: int | npt.ArrayLike, *, L: float) -> np.float64 | npt.NDArray[np.float64]:
|
|
22
23
|
"""Exact equal-temperament distance from nut for fret(s) `n` for scale length `L`.
|
|
23
24
|
|
|
24
25
|
Using the 12th-root-of-2 method.
|
|
@@ -33,12 +34,12 @@ def distance_et(n: int | npt.ArrayLike, *, L: float) -> np.float_ | npt.NDArray[
|
|
|
33
34
|
s
|
|
34
35
|
Scale length.
|
|
35
36
|
"""
|
|
36
|
-
n = np.floor(n, dtype=
|
|
37
|
+
n = np.floor(n, dtype=np.float64)
|
|
37
38
|
|
|
38
39
|
if not np.all(n > 0):
|
|
39
40
|
raise ValueError("input fret numbers should be positive")
|
|
40
41
|
|
|
41
|
-
return L * (1 - 1 / (2 ** (n / 12)))
|
|
42
|
+
return (L * (1 - 1 / (2 ** (n / 12)))).astype(np.float64)
|
|
42
43
|
|
|
43
44
|
|
|
44
45
|
def distances(N: int, *, L: float, method: str = "et") -> pd.DataFrame:
|
stringcalc/tension.py
CHANGED
|
@@ -5,6 +5,7 @@ e.g.
|
|
|
5
5
|
- For specified strings, calculate tensions
|
|
6
6
|
- For specified total or per-string tension, suggest strings
|
|
7
7
|
"""
|
|
8
|
+
|
|
8
9
|
from __future__ import annotations
|
|
9
10
|
|
|
10
11
|
import math
|
|
@@ -211,8 +212,7 @@ def load_ghs_data(*, for_combined: bool = False) -> pd.DataFrame:
|
|
|
211
212
|
|
|
212
213
|
|
|
213
214
|
class _DataLoader(Protocol):
|
|
214
|
-
def __call__(self, *, for_combined: bool = False) -> pd.DataFrame:
|
|
215
|
-
...
|
|
215
|
+
def __call__(self, *, for_combined: bool = False) -> pd.DataFrame: ... # noqa: E704
|
|
216
216
|
|
|
217
217
|
|
|
218
218
|
_DATA_LOADERS: list[_DataLoader] = [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: stringcalc
|
|
3
|
-
Version: 0.1.0.
|
|
3
|
+
Version: 0.1.0.dev15
|
|
4
4
|
Summary: Calculations for instrument strings
|
|
5
5
|
Author-email: zmoon <zmoon92@gmail.com>
|
|
6
6
|
Requires-Python: ~=3.9
|
|
@@ -26,7 +26,7 @@ Provides-Extra: test
|
|
|
26
26
|
|
|
27
27
|
# stringcalc
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
_Calculations for [string instrument](https://en.wikipedia.org/wiki/String_instrument)s' strings_
|
|
30
30
|
|
|
31
31
|
[](https://github.com/zmoon/stringcalc/actions/workflows/ci.yml)
|
|
32
32
|
[](https://pypi.org/project/stringcalc/)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
stringcalc/__init__.py,sha256=gTPuQjuhWOIGeb2ILIx_Lb_cXAR6YOZt5zq8eAk5zi0,73
|
|
2
|
+
stringcalc/cli.py,sha256=Cc-1UuA-bG4LJzpeZG30Njee5eafdRLLlmqCC7XCHws,14483
|
|
3
|
+
stringcalc/frets.py,sha256=p9o7yrp9adCqzVyEp8AzxMecu5XwGM98UOM21yCYyYk,3476
|
|
4
|
+
stringcalc/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
stringcalc/tension.py,sha256=3e8oZDJuyJYR-g-bjgTC049d1mE7HBrRgux9yx58nWs,14210
|
|
6
|
+
stringcalc/data/__init__.py,sha256=K9uwWfdSMDlhF15qV84g1ZGpG0784rOsUFuSN_rc4EQ,27
|
|
7
|
+
stringcalc/data/aquila-nng.csv,sha256=nV-kXoRPEXr59NvzMyYob5dg5E3yEw3SW7x1obBeK80,1762
|
|
8
|
+
stringcalc/data/daddario-tension.csv,sha256=gX2waKA9Vt9Bg-jkIC62fugTAZ38EHTegOEhi5fFcsk,124808
|
|
9
|
+
stringcalc/data/ghs.csv,sha256=RQiBahLEkrozCjru1K6T2UKu60LUgJQt3PWKwps4BwA,26173
|
|
10
|
+
stringcalc/data/stringjoy.csv,sha256=qGKvHcLKMpGMo8tN10qkyocbp8OT0WtzTqQNge_RFqU,5004
|
|
11
|
+
stringcalc/data/worth.csv,sha256=S0HVB7sww4gTR4DunkHcqR1YHgVHG8b_u_63B6vkE7s,288
|
|
12
|
+
stringcalc-0.1.0.dev15.dist-info/entry_points.txt,sha256=0DV5ry2A4YzcRzPmWKPXWSFG_dd2rE1Q17UORWHN9vI,49
|
|
13
|
+
stringcalc-0.1.0.dev15.dist-info/LICENSE,sha256=QJZDkt5nq7Pto8WzgmPHKnpeTyEyyqscYUFlKoyXgZg,1090
|
|
14
|
+
stringcalc-0.1.0.dev15.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
|
|
15
|
+
stringcalc-0.1.0.dev15.dist-info/METADATA,sha256=vB6hjihaJuUvGoPelpp9HhPUvIL-i0RFYwKIppIY-BY,1436
|
|
16
|
+
stringcalc-0.1.0.dev15.dist-info/RECORD,,
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
stringcalc/__init__.py,sha256=dxIpROtpcwB3gXBhc5rg12xtd_9Ghv9IMS5gkTADg6Q,73
|
|
2
|
-
stringcalc/cli.py,sha256=H3Ag-WVqk0J68ZwqkY2sutHh4nvT79m_bgqTGz7gAsg,12072
|
|
3
|
-
stringcalc/frets.py,sha256=9cYKDhAVk6Zzf4f1rHCZHkh-CFBph-83gdDy1d8ztXU,3447
|
|
4
|
-
stringcalc/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
-
stringcalc/tension.py,sha256=mZRwlg7COFk3k8NMW-Nd-DZhnuLalWaXGeIMNFqckdM,14203
|
|
6
|
-
stringcalc/data/__init__.py,sha256=K9uwWfdSMDlhF15qV84g1ZGpG0784rOsUFuSN_rc4EQ,27
|
|
7
|
-
stringcalc/data/aquila-nng.csv,sha256=nV-kXoRPEXr59NvzMyYob5dg5E3yEw3SW7x1obBeK80,1762
|
|
8
|
-
stringcalc/data/daddario-tension.csv,sha256=gX2waKA9Vt9Bg-jkIC62fugTAZ38EHTegOEhi5fFcsk,124808
|
|
9
|
-
stringcalc/data/ghs.csv,sha256=RQiBahLEkrozCjru1K6T2UKu60LUgJQt3PWKwps4BwA,26173
|
|
10
|
-
stringcalc/data/stringjoy.csv,sha256=qGKvHcLKMpGMo8tN10qkyocbp8OT0WtzTqQNge_RFqU,5004
|
|
11
|
-
stringcalc/data/worth.csv,sha256=S0HVB7sww4gTR4DunkHcqR1YHgVHG8b_u_63B6vkE7s,288
|
|
12
|
-
stringcalc-0.1.0.dev14.dist-info/entry_points.txt,sha256=0DV5ry2A4YzcRzPmWKPXWSFG_dd2rE1Q17UORWHN9vI,49
|
|
13
|
-
stringcalc-0.1.0.dev14.dist-info/LICENSE,sha256=QJZDkt5nq7Pto8WzgmPHKnpeTyEyyqscYUFlKoyXgZg,1090
|
|
14
|
-
stringcalc-0.1.0.dev14.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
|
|
15
|
-
stringcalc-0.1.0.dev14.dist-info/METADATA,sha256=I9HVWPTi2ULa-9GNDr9UqqZHl6F4jMef3qJCsOozgX4,1436
|
|
16
|
-
stringcalc-0.1.0.dev14.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|