## table of contents

FIARITH(1) | User Commands | FIARITH(1) |

# NAME¶

fiarith - evaluating arithmetic expressions on images as operands# SYNOPSIS¶

**fiarith**[

*options*]

*"<expression>"*[

*-o|--output <output.fits>*]

# DESCRIPTION¶

The purpose of this program is to evaluate <expression> which is intented to contain arithmetic operations and functions on FITS images (of the same size). See the section "Examples" below for examples on the syntax of <expression># OPTIONS¶

## General options:¶

**-h**,**--help**- Gives general summary about the command line options.
**--long-help**,**--help-long**- Gives a detailed list of command line options.
**--wiki-help**,**--help-wiki**,**--mediawiki-help**,**--help-mediawiki**- Gives a detailed list of command line options in Mediawiki format.
**--version**,**--version-short**,**--short-version**- Gives some version information about the program.
**-o**,**--output**<fits>- The name of the output file (omitting or specifing '-' yields the output to be written to stdout).
**-s**,**--size**<sx>,<sy>- Horizontal and vertical size of the output image (meaningless if <expression> contains any existing FITS image).
**-M**,**--input-mask**<fits>- Input mask file to co-add to output image.
**--output-mask**<fits>- Name of output mask file to create.
**-D**,**--data**<spec>- Output pixel data format specification.
**-b**,**--bitpix**<bitpix>- Standard FITS output bitpix value.
**-a**,**--apply-mask**- Resets pixel values to zero if masked.
**-e**,**--header**<fits>- Inherit output header from the specified FITS file.

## Available arithmetic operators:¶

- +
- Addition.
- -
- Subtraction.
- *
- Multiplication.
- /
- Division. Dividing by zero yields zero automatically.

## Available arithmetic functions:¶

- sin(.), cos(.), tan(.)
- Trigonometric functions.
- asin(.), acos(.), atan(.), atan2(.,.), arg(.,.)
- Inverse trigonometric functions.
- abs(.), sq(.), sqrt(.), exp(.), log(.)
- Absolute value, square, Square root, exponential and natural logarithm functions.

## Available image functions:¶

- min(....)
- The per pixel minimal value of pixel intensities of the images listed (separated by comma) in the argument of the function.
- max(....)
- The per pixel maximal value of pixel intensities of the images listed (separated by comma) in the argument of the function.
- mean(...)
- The per pixel mean value of pixel intensities of the images listed (separated by comma) in the argument of the function.
- norm(.)
- The mean of the pixel values on the image.
- sign(.)
- The per pixel sign function.
- theta(.)
- The per pixel Heaviside step function.
- laplace(.)
- The Laplace transform of the image.
- scatter(.)
- Noise level estimation for the image.
- corr(.,.)
- Correlation between two images.
- smooth(<image>,<sigma>,<size>)
- The smoothed variant of the first argument (threated as an image), which is yielded by the convolution with a Gaussian profile with a standard deviation of <sigma>, evaluated on a kernel stamp with the size of <size>.

# EXAMPLES¶

- fiarith "'img1.fits'-'orig.fits'" -o diff.fits
- Calculates the per pixel difference between images "img1.fits" and "orig.fits" and stores the result in "diff.fits".
- fiarith -s 512,512 "137.42" -o constant.fits
- Creates a new image with the size of 512 by 512 pixels with the constant value of 137.42.
- fiarith "'-'*26" -o -
- Multiplies the pixel intensities of the image read from the standard input by 26 and writes the result to the standard output. The "-o -" can either be omitted, since by default the output is written to stdout.
- fiarith -s 512,512 "['input.fits'](a/(1-0.3*(X^2-Y^2)))" -o flattened.fits
- This invocation evaluates the "a/(1-0.3*(X^2+Y^2))" expression on each pixel of the image "input.fits", where "a" referes to the pixel value itself and X and Y are the normalized spatial coordinates. The normalization is always done as X=(2*x-SX)/(SX) and Y=(2*y-SY)/SX, i.e. the X and Y coordinates are zero at the center of the images, X has a unity absolute value at the left and right edges and Y is scaled properly to X.
- fiarith "('R.fits'-'B.fits'-0.5*'D.fits')*(norm('F.fits')/'F.fits')" -o C.fits
- This operation performs a simple bias, dark and flat calibration on the input raw image "R.fits", expecting "B.fits", "D.fits" and "F.fits" to be the master bias, dark and flat calibration frames, respectively; and assuming an exposure time for the raw image which is the half of the exposure time of the master dark frame. Due to the "norm(...)" function, the mean intensity level of the image is kept to be the same as it is in the raw image.

# REPORTING BUGS¶

Report bugs to <apal@szofi.net>, see also http://fitsh.net/.# COPYRIGHT¶

Copyright © 1996, 2002, 2004-2008, 2010-2015; Pal, Andras <apal@szofi.net>September 2016 | fiarith 1.0pre3 (0.9.2@2016.09.23) |