From 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 Mon Sep 17 00:00:00 2001 From: Joe Hunkeler Date: Tue, 11 Aug 2015 16:51:37 -0400 Subject: Repatch (from linux) of OSX IRAF --- noao/digiphot/apphot/aputil/apmapr.x | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 noao/digiphot/apphot/aputil/apmapr.x (limited to 'noao/digiphot/apphot/aputil/apmapr.x') 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 -- cgit