stringcalc 0.1.0.dev16__py3-none-any.whl → 0.1.0.dev17__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/frets.py +18 -15
- stringcalc/tension.py +43 -27
- {stringcalc-0.1.0.dev16.dist-info → stringcalc-0.1.0.dev17.dist-info}/METADATA +1 -1
- {stringcalc-0.1.0.dev16.dist-info → stringcalc-0.1.0.dev17.dist-info}/RECORD +8 -8
- {stringcalc-0.1.0.dev16.dist-info → stringcalc-0.1.0.dev17.dist-info}/WHEEL +0 -0
- {stringcalc-0.1.0.dev16.dist-info → stringcalc-0.1.0.dev17.dist-info}/entry_points.txt +0 -0
- {stringcalc-0.1.0.dev16.dist-info → stringcalc-0.1.0.dev17.dist-info}/licenses/LICENSE +0 -0
stringcalc/__init__.py
CHANGED
stringcalc/frets.py
CHANGED
|
@@ -9,14 +9,14 @@ For example:
|
|
|
9
9
|
|
|
10
10
|
from __future__ import annotations
|
|
11
11
|
|
|
12
|
-
from typing import Union
|
|
12
|
+
from typing import Final, Union
|
|
13
13
|
|
|
14
14
|
import numpy as np
|
|
15
15
|
import numpy.typing as npt # v1.21 needed
|
|
16
16
|
import pandas as pd
|
|
17
17
|
from pint import Quantity, UnitRegistry
|
|
18
18
|
|
|
19
|
-
ureg = UnitRegistry()
|
|
19
|
+
ureg: Final[UnitRegistry] = UnitRegistry()
|
|
20
20
|
# Q_ = ureg.Quantity # mypy doesn't like this one
|
|
21
21
|
|
|
22
22
|
QLike = Union[Quantity, str]
|
|
@@ -88,19 +88,22 @@ def distances(N: int, *, L: float, method: str = "et") -> pd.DataFrame:
|
|
|
88
88
|
# TODO: comparison to just intonation for specified root
|
|
89
89
|
|
|
90
90
|
df = pd.DataFrame({"n": n, "d": d, "dd": dd, "d_inv": L - d}).set_index("n")
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
91
|
+
df.attrs.update(
|
|
92
|
+
{
|
|
93
|
+
"col_desc": {
|
|
94
|
+
"n": "fret number",
|
|
95
|
+
"d": "distance from nut to fret",
|
|
96
|
+
"dd": "distance from previous fret to current",
|
|
97
|
+
"d_inv": "distance from fret to saddle",
|
|
98
|
+
},
|
|
99
|
+
"fancy_col": {
|
|
100
|
+
"n": "n",
|
|
101
|
+
"d": "d",
|
|
102
|
+
"dd": "Δd",
|
|
103
|
+
"d_inv": "L−d",
|
|
104
|
+
},
|
|
105
|
+
}
|
|
106
|
+
)
|
|
104
107
|
|
|
105
108
|
return df
|
|
106
109
|
|
stringcalc/tension.py
CHANGED
|
@@ -13,7 +13,7 @@ import math
|
|
|
13
13
|
import re
|
|
14
14
|
import warnings
|
|
15
15
|
from functools import lru_cache
|
|
16
|
-
from typing import NamedTuple, Protocol
|
|
16
|
+
from typing import NamedTuple, Protocol, cast
|
|
17
17
|
|
|
18
18
|
import pandas as pd
|
|
19
19
|
|
|
@@ -29,6 +29,15 @@ def _get_data():
|
|
|
29
29
|
DATA = _get_data()
|
|
30
30
|
|
|
31
31
|
|
|
32
|
+
def _assure_string(s: pd.Series) -> pd.Series[str]:
|
|
33
|
+
"""For pandas(-stubs), assure type checker that a Series is of string type.
|
|
34
|
+
Really we know that we have pandas string dtype, but pandas-stubs
|
|
35
|
+
doesn't know/care about this yet(?) in terms of concretizing Series.
|
|
36
|
+
"""
|
|
37
|
+
assert s.dtype == "string"
|
|
38
|
+
return cast("pd.Series[str]", s)
|
|
39
|
+
|
|
40
|
+
|
|
32
41
|
@lru_cache(1)
|
|
33
42
|
def load_data() -> pd.DataFrame:
|
|
34
43
|
"""Load all string data.
|
|
@@ -92,9 +101,11 @@ def load_daddario_data(*, for_combined: bool = False) -> pd.DataFrame:
|
|
|
92
101
|
if for_combined:
|
|
93
102
|
df = df.drop(columns=["notes", "tens"])
|
|
94
103
|
|
|
95
|
-
df["group"] =
|
|
96
|
-
|
|
97
|
-
|
|
104
|
+
df["group"] = (
|
|
105
|
+
"D'Addario - " + _assure_string(df["category"]) + " - " + _assure_string(df["group"])
|
|
106
|
+
)
|
|
107
|
+
df["group_id"] = "DA:" + _assure_string(df["group_id"])
|
|
108
|
+
df["id"] = "DA:" + _assure_string(df["id"])
|
|
98
109
|
|
|
99
110
|
df = df.drop(columns=["category", "id_pref", "id_suff"])
|
|
100
111
|
|
|
@@ -137,12 +148,13 @@ def load_aquila_data(*, nng_density: float = 1300, for_combined: bool = False) -
|
|
|
137
148
|
# Set group ID (used to select string type)
|
|
138
149
|
df["group"] = "New Nylgut"
|
|
139
150
|
df["group_id"] = "NNG"
|
|
151
|
+
df[["group", "group_id"]] = df[["group", "group_id"]].astype("string")
|
|
140
152
|
|
|
141
153
|
gauge_eqv_cols = [col for col in df.columns if col.startswith("gauge_")]
|
|
142
154
|
if for_combined:
|
|
143
|
-
df["group"] = "Aquila " + df["group"]
|
|
144
|
-
df["group_id"] = "A:" + df["group_id"]
|
|
145
|
-
df["id"] = "A:" + df["id"]
|
|
155
|
+
df["group"] = "Aquila " + _assure_string(df["group"])
|
|
156
|
+
df["group_id"] = "A:" + _assure_string(df["group_id"])
|
|
157
|
+
df["id"] = "A:" + _assure_string(df["id"])
|
|
146
158
|
|
|
147
159
|
df = df.drop(columns=gauge_eqv_cols)
|
|
148
160
|
else:
|
|
@@ -170,11 +182,12 @@ def load_worth_data(*, for_combined: bool = False) -> pd.DataFrame:
|
|
|
170
182
|
# Set group ID (used to select string type)
|
|
171
183
|
df["group"] = "Fluorocarbon"
|
|
172
184
|
df["group_id"] = "FC"
|
|
185
|
+
df[["group", "group_id"]] = df[["group", "group_id"]].astype("string")
|
|
173
186
|
|
|
174
187
|
if for_combined:
|
|
175
|
-
df["group"] = "Worth " + df["group"]
|
|
176
|
-
df["group_id"] = "W" + df["group_id"]
|
|
177
|
-
df["id"] = "WFC:" + df["id"]
|
|
188
|
+
df["group"] = "Worth " + _assure_string(df["group"])
|
|
189
|
+
df["group_id"] = "W" + _assure_string(df["group_id"])
|
|
190
|
+
df["id"] = "WFC:" + _assure_string(df["id"])
|
|
178
191
|
|
|
179
192
|
df = df.drop(columns="rho")
|
|
180
193
|
|
|
@@ -200,9 +213,9 @@ def load_stringjoy_data(*, for_combined: bool = False) -> pd.DataFrame:
|
|
|
200
213
|
df = pd.read_csv(DATA.joinpath("stringjoy.csv"), header=0).convert_dtypes()
|
|
201
214
|
|
|
202
215
|
if for_combined:
|
|
203
|
-
df["id"] = "SJ:" + df["id"]
|
|
204
|
-
df["group"] = "Stringjoy " + df["group"]
|
|
205
|
-
df["group_id"] = "SJ:" + df["group_id"]
|
|
216
|
+
df["id"] = "SJ:" + _assure_string(df["id"])
|
|
217
|
+
df["group"] = "Stringjoy " + _assure_string(df["group"])
|
|
218
|
+
df["group_id"] = "SJ:" + _assure_string(df["group_id"])
|
|
206
219
|
|
|
207
220
|
for name in ["group", "group_id"]:
|
|
208
221
|
df[name] = df[name].astype("category")
|
|
@@ -232,9 +245,9 @@ def load_ghs_data(*, for_combined: bool = False) -> pd.DataFrame:
|
|
|
232
245
|
df = df.dropna(subset=["gauge"])
|
|
233
246
|
|
|
234
247
|
if for_combined:
|
|
235
|
-
df["id"] = "GHS:" + df["id"]
|
|
236
|
-
df["group"] = "GHS - " + df["group"]
|
|
237
|
-
df["group_id"] = "GHS:" + df["group_id"]
|
|
248
|
+
df["id"] = "GHS:" + _assure_string(df["id"])
|
|
249
|
+
df["group"] = "GHS - " + _assure_string(df["group"])
|
|
250
|
+
df["group_id"] = "GHS:" + _assure_string(df["group_id"])
|
|
238
251
|
|
|
239
252
|
for name in ["group", "group_id"]:
|
|
240
253
|
df[name] = df[name].astype("category")
|
|
@@ -553,16 +566,19 @@ def suggest_gauge(
|
|
|
553
566
|
)
|
|
554
567
|
|
|
555
568
|
df = data_sort[["id", "T", "dT"]].sort_values(by="dT").reset_index(drop=True)
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
569
|
+
df.attrs.update(
|
|
570
|
+
{
|
|
571
|
+
"col_desc": {
|
|
572
|
+
"id": "Product ID",
|
|
573
|
+
"T": "Tension",
|
|
574
|
+
"dT": "Tension difference from target tension",
|
|
575
|
+
},
|
|
576
|
+
"fancy_col": {
|
|
577
|
+
"id": "ID",
|
|
578
|
+
"T": "T",
|
|
579
|
+
"dT": "ΔT",
|
|
580
|
+
},
|
|
581
|
+
}
|
|
582
|
+
)
|
|
567
583
|
|
|
568
584
|
return df
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
stringcalc/__init__.py,sha256=
|
|
1
|
+
stringcalc/__init__.py,sha256=nhFKVHPVc1PIPPK4dIVPD4u2WX2QW4dfFOipbhOXdco,78
|
|
2
2
|
stringcalc/cli.py,sha256=b5ra0nyqrjpr8VCDlYQGTdJRU25aK-M5EqR3erL972c,16104
|
|
3
|
-
stringcalc/frets.py,sha256=
|
|
3
|
+
stringcalc/frets.py,sha256=ySu8_WjdIlCRpFzYxJaMkchB4CGikf8DdX9HIhJFK9A,5006
|
|
4
4
|
stringcalc/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
-
stringcalc/tension.py,sha256
|
|
5
|
+
stringcalc/tension.py,sha256=GPMNIfLMgVS-wiikiAT5Ub2Ats-JA5x-VBm-Zt6IU-Q,18068
|
|
6
6
|
stringcalc/util.py,sha256=1ed0gvM_ogAof2R8yrOvZH9CXlNZ4yYRkN6Ib0W6XkA,881
|
|
7
7
|
stringcalc/data/__init__.py,sha256=trvP9fq47dvMJJQEE4tpZUqE00Y7Tq9uaPC8m-5G-p0,30
|
|
8
8
|
stringcalc/data/aquila-nng.csv,sha256=nV-kXoRPEXr59NvzMyYob5dg5E3yEw3SW7x1obBeK80,1762
|
|
@@ -10,8 +10,8 @@ stringcalc/data/daddario-tension.csv,sha256=gX2waKA9Vt9Bg-jkIC62fugTAZ38EHTegOEh
|
|
|
10
10
|
stringcalc/data/ghs.csv,sha256=78KVEkXCbxvuMOE0Kjeh3sz750AqpR7uCHNguxXScWY,26733
|
|
11
11
|
stringcalc/data/stringjoy.csv,sha256=qGKvHcLKMpGMo8tN10qkyocbp8OT0WtzTqQNge_RFqU,5004
|
|
12
12
|
stringcalc/data/worth.csv,sha256=S0HVB7sww4gTR4DunkHcqR1YHgVHG8b_u_63B6vkE7s,288
|
|
13
|
-
stringcalc-0.1.0.
|
|
14
|
-
stringcalc-0.1.0.
|
|
15
|
-
stringcalc-0.1.0.
|
|
16
|
-
stringcalc-0.1.0.
|
|
17
|
-
stringcalc-0.1.0.
|
|
13
|
+
stringcalc-0.1.0.dev17.dist-info/entry_points.txt,sha256=0DV5ry2A4YzcRzPmWKPXWSFG_dd2rE1Q17UORWHN9vI,49
|
|
14
|
+
stringcalc-0.1.0.dev17.dist-info/licenses/LICENSE,sha256=QJZDkt5nq7Pto8WzgmPHKnpeTyEyyqscYUFlKoyXgZg,1090
|
|
15
|
+
stringcalc-0.1.0.dev17.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
|
16
|
+
stringcalc-0.1.0.dev17.dist-info/METADATA,sha256=jvMq0roJASY4mQn6RLTh_9GcdywDtAKL-KtjkMbYax0,2256
|
|
17
|
+
stringcalc-0.1.0.dev17.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|