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.
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 |
sqrt | Square-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,log | log base e and 10 the top image. Negative values produce a warning message and the log of the absolute value of the pixel. |
exp | exp the top image. |
dup | Duplicate top image on the stack. |
drop | Forget top stack image. |
swap | Swap the top two images. |
# 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