Created
December 29, 2012 08:51
-
-
Save benregn/4405525 to your computer and use it in GitHub Desktop.
A function to scale a value from a certain number range to different number range
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def scale_value(value_to_scale, original_min, original_max, target_min, target_max): | |
| return (((target_max - target_min) * (value_to_scale - original_min))/(original_max - original_min)) + target_min |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment