; MATHS ;--------------------------------------------------------------- ;! operates on an image with a choice of mathematical functions ;# Task Analysis ;----------------------------------------------------------------------- ;; Copyright (C) 1995, 2000, 2009, 2015 ;; Associated Universities, Inc. Washington DC, USA. ;; ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as ;; published by the Free Software Foundation; either version 2 of ;; the License, or (at your option) any later version. ;; ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public ;; License along with this program; if not, write to the Free ;; Software Foundation, Inc., 675 Massachusetts Ave, Cambridge, ;; MA 02139, USA. ;; ;; Correspondence concerning AIPS should be addressed as follows: ;; Internet email: aipsmail@nrao.edu. ;; Postal address: AIPS Project Office ;; National Radio Astronomy Observatory ;; 520 Edgemont Road ;; Charlottesville, VA 22903-2475 USA ;----------------------------------------------------------------------- MATHS LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC MATHS: Task to operate on an image with mathematical functions INNAME Input image name INCLASS Input image class INSEQ 0.0 9999.0 Input image seq. no. INDISK 0.0 9.0 Input image disk no. OUTNAME Output image name OUTCLASS Output image class OUTSEQ 0.0 9999.0 Output image seq. # OUTDISK 0.0 9.0 Output image disk drive BLC BLC of input image TRC TRC of input image OPCODE Operator code: SIN, COS, TAN, ASIN, ACOS, ATAN, LOG, ALOG, LOGN, EXP, POLY, DIVP, POWR, MOD, ABS CPARM CPARM(1:5): Output map is formed from C1+C2*OP[C3*IN+C4] except for 'POLY' when its C1+C2*IN+C3*IN**2+C4*IN**3 'DIVP' when its C1+C2/IN+C3/IN**2+C4/IN**3 'POWR' when its C1+C2*[C3*IN+C4]**C5 and 'MOD' when its C1+C2*MOD[C3*IN+C4, C5] CPARM(6) <= 0 -> all output undefined pixels are magic blanked, else zeroes used --------------------------------------------------------------- MATHS Type: Task Use: Operate on an image, pixel by pixel, with a mathematical function. Current choices are SIN, COS, TAN, ASIN, ACOS, ATAN, LOG, LOGN, ALOG, EXP, POLY, DIVP, POWR, and MOD. Undefined output pixels are either magic value blanked or zeroed. NO checks for overflows which may occur with some of these operators are made, since they depend on your computer. For example, with TAN, if the absolute value of an input pixel is very close say, 90 degrees, then an overflow may occur. Note also that the FORTRAN 77 standard trigonometric functions require arguments in radians. Thus, there is some loss of accuracy in converting the input data to radians. For example, for OPCODE='SIN', if an input pixel has a value of 180.0 degrees then the output pixel will not be identically zero, usually a small negative number of the order of 1E-9 will result. Adverbs: INNAME........Input image name INCLASS.......Input image class INSEQ.........Input image seq. # INDISK........Input image disk drive # OUTNAME.......Output image name OUTCLASS......Output image class, blank = OPCODE OUTSEQ........Output image seq. # OUTDISK.......Output image disk drive # BLC...........BLC of input image TRC...........TRC of input image OPCODE........SIN, COS, and TAN: The input image units should be DEGREES. If not, you could use CPARM(3) to rescale them. For OPCODE = 'TAN', if the input pixel is one of ...-270, -90, 90, 270... then the output pixel is blanked. OUT = C(1) + C(2) * OP [C(3) * IN + C(4)] ASIN, ACOS, and ATAN: The output image units are DEGREES in the range: ASIN -90 < THETA < 90 ACOS 0 < THETA < 180 ATAN -90 < THETA < 90 For ASIN and ACOS, if the input pixel is < -1.0 or > 1.0, then the output pixel is blanked. OUT = C(1) + C(2) * OP [C(3) * IN + C(4)] LOG and LOGN: These take the base 10 and base e (natural) logarithm of the input image. If the input pixel is <= 0.0, then the output pixel is blanked. OUT = C(1) + C(2) * OP [C(3) * IN + C(4)] ALOG and EXP: These take the base 10 and base e (natural) anti-logarithm of the input image. OUT = C(1) + C(2) * OP [C(3) * IN + C(4)] POLY: Every OUTput pixel is formed from the INput pixel according to: OUT = C(1) + C(2)*IN + C(3)*IN*IN + C(4)*IN*IN*IN DIVP: Every OUTput pixel is formed from the INput pixel according to: OUT = C(1) + C(2)/IN + C(3)/IN/IN + C(4)/IN/IN/IN POWR: Each OUTput pixel is formed from the INput pixel according to: OUT = C(1) + C(2)*[C(3)*IN + C(4)]**C(5) Let X = C(3)*IN + C(4) If C(5) is not an integer, the output pixel is blanked when X is negative, or when X and C(5) are both zero. MOD: Each OUTput pixel is formed from the INput pixel according to: OUT = C(1) + C(2)* MOD [C(3)*IN+C(4), C(5)] The output pixel is blanked when C(5) = 0.0 ABS: Each OUTput pixel is formed from the INput pixel according to: OUT = C(1) + C(2)* ABS [C(3)*IN+C(4)] IF all C are zeros, then: OUT = ABS[IN] CPARM.........C(1:5): Additive and multiplicative factors for the input image. The defaults depend on the operator For OP = SIN, COS, TAN, ASIN, ACOS, ATAN, LOG, ALOG, LOGN, EXP, POWR, MOD, ABS C(2) = 0 -> C(2) = 1 C(3) = 0 -> C(3) = 1 For OP = POLY and DIVP, there are no CPARM defaults C(6) <= 0 -> all undefined output pixels magic blanked C(6) > 0 -> all undefined output pixels zeroed Note that this includes input pixels that were magic blanked ----------------------------------------------------------------