FIARITH(1)
π FIARITH(1) β the fiarith manual, but make it cute π
okay bestie, sit down, hydrate, because we're about to talk about fiarith, a lil user-command from the fitsh universe that does math on your FITS images like it's nothing. no cap. β¨
πΈ NAME πΈ
fiarith β evaluating arithmetic expressions on images as operands
so basically: it's a calculator, but the numbers are pictures. iconic behavior honestly. π
π¦ SYNOPSIS π¦
fiarith [options] "<expression>" [-o|--output <output.fits>]
β¨ DESCRIPTION β¨
The whole point of this program is to evaluate <expression>, which is intended to contain arithmetic operations and functions on FITS images (and those images have to be the same size, periodt). If you wanna see what the syntax of <expression> actually looks like, scroll your pretty eyes down to the "Examples" section, bestie. π
π OPTIONS π
π«Ά General options:
-h,--helpβ gives you a general summary about the command line options.--long-help,--help-longβ gives you a detailed list of command line options. the deluxe version.--wiki-help,--help-wiki,--mediawiki-help,--help-mediawikiβ gives you a detailed list of command line options, but in Mediawiki format. wiki girlies rise up. π--version,--version-short,--short-versionβ gives some version information about the program.-o,--output <fits>β the name of the output file. if you omit it, or if you specify'-', the output gets written to stdout instead. π«§-s,--size <sx>,<sy>β horizontal and vertical size of the output image. lowkey meaningless if<expression>already contains any existing FITS image, just saying.-M,--input-mask <fits>β input mask file to co-add to the output image.--output-mask <fits>β name of the 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. bye bye masked pixels. π-e,--header <fits>β inherit the output header from the specified FITS file. heirloom header energy.
π₯ Available arithmetic operators:
+β addition.-β subtraction.*β multiplication./β division. and listen, dividing by zero yields zero automatically. the program said "no drama today" and moved on. π§
π 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. the whole glow-up squad. β¨
π 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>. soft focus, but make it math. π¦
π 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. one number, one vibe, one image. π
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. and btw the "-o -" can either be omitted, since by default the output is written to stdout. so you didn't even have to type it, but you can, for the aesthetic. π
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.
bestie, heads up: yes, the expression in the command says(X^2-Y^2)and the explanation says(X^2+Y^2). that's exactly how the original manual rolls. we do not edit the sacred text. π
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. astronomy girlies, this one's for you. ππ
π REPORTING BUGS π
Report bugs to <apal@szofi.net>, see also https://fitsh.net/.
if something's broken, tell the maintainer, don't just suffer in silence. fr fr. π«Ά
π COPYRIGHT π
Copyright Β© 1996, 2002, 2004-2008, 2010-2016, 2018-2020; Pal, Andras <apal@szofi.net>
and that's the whole page, bestie!! π this was fiarith 0.9.4 (dated 2021.01.24), living in a January 2021 mood, and it's part of the User Commands lineup. go do math on some pixels, you absolute main character. ππβ¨
π¦ where this page comes from
- debian bookworm: fitsh 0.9.4-1 Β· GPL-3.0-or-later
- debian trixie: fitsh 0.9.4-1 Β· GPL-3.0-or-later
- ubuntu jammy: fitsh 0.9.4-1 Β· GPL-3.0-or-later
- ubuntu noble: fitsh 0.9.4-1 Β· GPL-3.0-or-later
- ubuntu resolute: fitsh 0.9.4-2 Β· GPL-3.0-or-later
- ubuntu stonking: fitsh 0.9.4-2 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms