Mapping a value in python

From XPUB & Lens-Based wiki
Revision as of 13:04, 20 March 2017 by Michael Murtaugh (talk | contribs) (Created page with " <source lang="python"> def map (v, inlow, inhigh, outlow, outhigh): p = (float(v) - inlow) / inhigh return outlow + (p * (outhigh - outlow)) </source>")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
def map (v, inlow, inhigh, outlow, outhigh):
    p = (float(v) - inlow) / inhigh
    return outlow + (p * (outhigh - outlow))