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 /sys/vops/amap.gx | |
download | iraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz |
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/vops/amap.gx')
-rw-r--r-- | sys/vops/amap.gx | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/sys/vops/amap.gx b/sys/vops/amap.gx new file mode 100644 index 00000000..9006b221 --- /dev/null +++ b/sys/vops/amap.gx @@ -0,0 +1,42 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +# AMAP -- Vector linear transformation. Map the range of pixel values +# a1,a2 from a into the range b1,b2 in b. It is assumed that a1 < a2 +# and b1 < b2. + +procedure amap$t (a, b, npix, a1, a2, b1, b2) + +PIXEL a[ARB], b[ARB] +PIXEL a1, a2, b1, b2 + +$if (datatype == sil) +long minout, maxout, aoff, boff, pixval +$else +PIXEL minout, maxout, aoff, boff, pixval +$endif + +$if (datatype == ld) +double scalar +$else +real scalar +$endif + +int npix, i + +begin + $if (datatype == ld) + scalar = (double (b2) - double (b1)) / (double (a2) - double (a1)) + $else + scalar = (real (b2) - real (b1)) / (real (a2) - real (a1)) + $endif + + minout = min (b1, b2) + maxout = max (b1, b2) + aoff = a1 + boff = b1 + + do i = 1, npix { + pixval = (a[i] - aoff) * scalar + b[i] = max(minout, min(maxout, pixval + boff)) + } +end |