FITSMaths documentation

FITSMaths is a little utility for the mathematical manipulation of FITS files. The program applies mathematical operations to individual pixels of files. It takes a list of input files and operators. The list is taken as a reverse-polish expression which is evaluated to produce the output image.

Usage

FITSmaths infile1 [infileX|operator|@number] ... outfile

infile is an input FITS file (with extension). Alternatively a numerical constant can be specified by prefixing it with an @ sign. operator is one of the following:

+,-,*,/Standard mathematical operators, applied to the top two images on the input stack. a b - calculates a-b
sqrtSquare-root the top image on the stack. Negative values produce a warning message and the square-root of the absolute value of the pixel.
ln,loglog base e and 10 the top image. Negative values produce a warning message and the log of the absolute value of the pixel.
expexp the top image.
dupDuplicate top image on the stack.
dropForget top stack image.
swapSwap the top two images.

Notes

  1. FITSMaths will complain if there are more than one images left on the stack at the end.
  2. All the input images must be of the same size in pixels.
  3. A numerical constant cannot appear first.
  4. WCS information from the last FITS file read will be copied to the output file.
  5. Remember commands like "*" need to be protected from the shell using quotes.
  6. File names with the same names as operators (if they don't have .fits extensions) will be treated as operators!

Examples

# FITSMaths file1.fits dup "*" out.fits
Square an image

# FITSMaths file1.fits file2.fits + @2 / out.fits
Average two images

# FITSMaths file1.fits file2.fits + @2 / ln file3.fits "*" out.fits
Calculate ln((file1+file2)/2)*file3


Back to the documentation page


This page is maintained by Jeremy Sanders. It was last modified on 2000/11/23. This page is not an official page of the Institute of Astronomy.