diff options
| author | Selene ToyKeeper | 2019-09-18 16:18:49 -0600 |
|---|---|---|
| committer | Selene ToyKeeper | 2019-09-18 16:18:49 -0600 |
| commit | a0b974352bccb97a9efdd66fffe6825793b5e5d0 (patch) | |
| tree | b001326e595be48dcafd90dbf4ab01318d7b4010 /bin/level_calc.py | |
| parent | merged MF01-Mini / MT07 support branch (diff) | |
| parent | added a compile flag to fix compatibility with GCC 7/8/9's new semantics for ... (diff) | |
| download | anduril-a0b974352bccb97a9efdd66fffe6825793b5e5d0.tar.gz anduril-a0b974352bccb97a9efdd66fffe6825793b5e5d0.tar.bz2 anduril-a0b974352bccb97a9efdd66fffe6825793b5e5d0.zip | |
merged updates from trunk, including gcc7/8/9 compatibility
Diffstat (limited to 'bin/level_calc.py')
| -rwxr-xr-x | bin/level_calc.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/bin/level_calc.py b/bin/level_calc.py index f1e7d16..74385da 100755 --- a/bin/level_calc.py +++ b/bin/level_calc.py @@ -14,7 +14,7 @@ def main(args): """ # Get parameters from the user questions_main = [ - (str, 'ramp_shape', 'cube', 'Ramp shape? [cube, square, fifth, seventh, ninth, log]'), + (str, 'ramp_shape', 'cube', 'Ramp shape? [cube, square, fifth, seventh, ninth, log, N.NN]'), (int, 'num_channels', 1, 'How many power channels?'), (int, 'num_levels', 4, 'How many total levels do you want?'), ] @@ -189,11 +189,19 @@ shapes = dict( ) def power(x): - return shapes[ramp_shape][0](x) + try: + factor = float(ramp_shape) + return math.pow(x, factor) + except ValueError: + return shapes[ramp_shape][0](x) def invpower(x): - return shapes[ramp_shape][1](x) + try: + factor = float(ramp_shape) + return math.pow(x, 1.0 / factor) + except ValueError: + return shapes[ramp_shape][1](x) def input_text(): |
