Skip to content

Commit ddae807

Browse files
Add reciprocal scaling function
1 parent 32e1a2e commit ddae807

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

hwcomponents/scaling/scalefuncs.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,19 @@ def linear(target: float, scalefrom: float) -> float:
1818
return target / scalefrom
1919

2020

21+
def reciprocal(target: float, scalefrom: float) -> float:
22+
"""
23+
Reciprocal scaling function. Returns 1 / (target / scalefrom).
24+
25+
Args:
26+
target: The target value.
27+
scalefrom: The value to scale from.
28+
Returns:
29+
The scaled value.
30+
"""
31+
return 1 / (target / scalefrom)
32+
33+
2134
def pow_base(power: float) -> Callable[[float, float], float]:
2235
"""
2336
Power scaling function. Returns a lambda that computes (target - scalefrom) **

0 commit comments

Comments
 (0)