diff options
author | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
---|---|---|
committer | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
commit | 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch) | |
tree | 4464880c571602d54f6ae114729bf62a89518057 /noao/digiphot/apphot/aputil/apmapr.x | |
download | iraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz |
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'noao/digiphot/apphot/aputil/apmapr.x')
-rw-r--r-- | noao/digiphot/apphot/aputil/apmapr.x | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/noao/digiphot/apphot/aputil/apmapr.x b/noao/digiphot/apphot/aputil/apmapr.x new file mode 100644 index 00000000..0d4159ab --- /dev/null +++ b/noao/digiphot/apphot/aputil/apmapr.x @@ -0,0 +1,21 @@ +# APMAPR -- Vector linear transformation. Map the range of pixel values +# a1, a2 from a into the range b1, b2 into b. It is assumed that a1 < a2 +# and b1 < b2. + +real procedure apmapr (a, a1, a2, b1, b2) + +real a # the value to be mapped +real a1, a2 # the numbers specifying the input data range +real b1, b2 # the numbers specifying the output data range + +real minout, maxout, aoff, boff +real scalar + +begin + scalar = (real (b2) - real (b1)) / (real (a2) - real (a1)) + minout = min (b1, b2) + maxout = max (b1, b2) + aoff = a1 + boff = b1 + return (max(minout, min(maxout, real((a - aoff) * scalar) + boff))) +end |