Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential Issue with Unscaling Formula from nodeVars.py #1233

Closed
franflame opened this issue Jul 10, 2024 · 2 comments
Closed

Potential Issue with Unscaling Formula from nodeVars.py #1233

franflame opened this issue Jul 10, 2024 · 2 comments
Assignees
Labels
Priority:Normal Normal Priority Issue or PR

Comments

@franflame
Copy link
Contributor

During development for #1197, we found a potential mathematical inconsistency in the formula for the "Log" unscaling function.

elif self.scaling == "Log":
out = math.pow(self.min * (self.max / self.min), (val / 10.0))

For #1197, we found that the following alternative seems to work:

def unscale_log(array_in, lo, hi):
    result = lo * np.power(hi / lo, array_in)
    return result

For reference, a plot of the scaling formulas can be found here: https://www.desmos.com/calculator/dxyj2nmpln

@ksbeattie ksbeattie assigned ksbeattie, sotorrio1 and bpaul4 and unassigned ksbeattie Jul 16, 2024
@ksbeattie ksbeattie added the Priority:Normal Normal Priority Issue or PR label Jul 16, 2024
@bpaul4
Copy link
Contributor

bpaul4 commented Jul 16, 2024

@franflame thank you for opening this issue. You are correct and I agree with your suggested form. The original scaled form is

$scaled = 10 \frac{\log unscaled - \log min}{\log max - \log min}$

Solving for $unscaled$ yields

$\log \frac{unscaled}{min} = \frac{scaled}{10} \log \frac{max}{min}$

$unscaled = min (10 \log \frac{max}{min})^\frac{scaled}{10} = min (\frac{max}{min})^\frac{scaled}{10}$

which matches your alternative formula.

@sotorrio1
Copy link
Member

I concur with @bpaul4, the math checks out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority:Normal Normal Priority Issue or PR
Projects
None yet
Development

No branches or pull requests

4 participants