Command-line Scripts¶
Astroimtools installs a couple of useful utility programs for calculating image statistics and simple arithmetic.
imarith¶
imarith
is a command-line script based on
astroimtools.nddata_arith
for performing basic arithmetic on arrays
extracted from two FITS files. The arithmetic is performed for the data
in only a single FITS extension in both FITS file.
Example usage:
Add the array in extension 1 of the first FITS file with extension 3 in the second FITS file, placing the result in “result.fits”:
$ imarith filename1.fits filename2.fits '+' -e1 1 -e2 3 -o 'result.fits'
Perform the same operation above, but also add the exposure time values in the headers of the FITS files, placing the result in “result.fits”:
$ imarith filename1.fits filename2.fits '+' -e1 1 -e2 3 -k 'exptime' -o 'result.fits'
imstats¶
imstats
is a command-line script based on
astroimtools.nddata_stats
to calculate various statistics of an
array from a single extension of a FITS file. Sigma-clipped statistics
can be calculated by specifying the sigma
option.
The currently available statistics are:
'mean'
'median'
'mode'
'std'
'mad_std'
'npixels'
(for sigma-clipped statistics)
'nrejected'
(for sigma-clipped statistics)
'min'
'max'
'biweight_location'
'biweight_midvariance'
'kurtosis'
'skew'
Example usage:
Calculate simple image statistics on the data in the first FITS extension:
$ imstats filename.fits -e 1
filename npixels mean std min max ------------- ------- -------- ------ -------- ------- filename.fits 1027865 0.438514 0.6974 -59.8228 65.8734
Same as above, but specify different statistics:
$ imstats filename.fits -e 1 --columns 'mean, mode, std, mad_std'
filename mean mode std mad_std ------------- -------- ------ ------ ------- filename.fits 0.438514 0.4271 0.6974 0.68134
Calculate sigma-clipped (at 3 standard deviations) image statistics on the data in the first FITS extension:
$ imstats filename.fits -e 1 -sigma 3
filename npixels mean std min max ------------- ------- -------- ------ -------- ------- filename.fits 1020413 0.425871 0.5742 -39.2302 55.2304