Skip to content

Commit

Permalink
2.10.1 - Don't reverse scalings
Browse files Browse the repository at this point in the history
  • Loading branch information
vkottler committed Sep 18, 2023
1 parent b94ee72 commit 84da772
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
- run: |
mk python-release owner=vkottler \
repo=runtimepy version=2.10.0
repo=runtimepy version=2.10.1
if: |
matrix.python-version == '3.11'
&& matrix.system == 'ubuntu-latest'
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
=====================================
generator=datazen
version=3.1.3
hash=19b967281bec6e1ba45147defc9f84b3
hash=52b34641812dbed45846bdf959303a9d
=====================================
-->

# runtimepy ([2.10.0](https://pypi.org/project/runtimepy/))
# runtimepy ([2.10.1](https://pypi.org/project/runtimepy/))

[![python](https://img.shields.io/pypi/pyversions/runtimepy.svg)](https://pypi.org/project/runtimepy/)
![Build Status](https://github.com/vkottler/runtimepy/workflows/Python%20Package/badge.svg)
Expand Down
2 changes: 1 addition & 1 deletion local/variables/package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
major: 2
minor: 10
patch: 0
patch: 1
entry: runtimepy
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta:__legacy__"

[project]
name = "runtimepy"
version = "2.10.0"
version = "2.10.1"
description = "A framework for implementing Python services."
readme = "README.md"
requires-python = ">=3.11"
Expand Down
4 changes: 2 additions & 2 deletions runtimepy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# =====================================
# generator=datazen
# version=3.1.3
# hash=2e57f851d69a8cbe6ddd3d5ef64f5e2f
# hash=347d7aedb488b302404fdabf5b6260f2
# =====================================

"""
Expand All @@ -10,7 +10,7 @@

DESCRIPTION = "A framework for implementing Python services."
PKG_NAME = "runtimepy"
VERSION = "2.10.0"
VERSION = "2.10.1"

# runtimepy-specific content.
METRICS_NAME = "metrics"
6 changes: 3 additions & 3 deletions runtimepy/primitives/scaling.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ def invert(

value = float(value)

offset = scaling[-1]
offset = scaling[0]
scale = 1.0
if len(scaling) > 1:
scale = scaling[-2]
scale = scaling[1]

value -= offset
value /= scale
Expand All @@ -42,7 +42,7 @@ def apply(value: Numeric, scaling: ChannelScaling = None) -> Numeric:

result = 0.0 # solve via accumulating
poly_index_val = 1.0 # self.raw ^ 0
for scalar in reversed(scaling):
for scalar in scaling:
result += scalar * poly_index_val
poly_index_val *= value
else:
Expand Down
4 changes: 2 additions & 2 deletions tests/primitives/test_float.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ def test_primitive_scaling():
assert isclose(prim.scaled, 5.0)

int_prim = Int32(scaling=[2.0, 3.0])
int_prim.scaled = 1
assert isclose(int_prim.scaled, 1)
int_prim.scaled = -1
assert isclose(int_prim.scaled, -1)


def test_primitives_encode_decode():
Expand Down

0 comments on commit 84da772

Please sign in to comment.