geirs2Panic
Richard J. Mathar
Fits header keyword batch editor
|
The program fitsImg2Asc converts the image in the primary HDU of a FITS file to an ASCII format. More...
Functions | |
void | usage (char *argv0) |
Print a usage syntax message detailing the command line. More... | |
int | main (int argc, char *argv[]) |
The program fitsImg2Asc converts the image in the primary HDU of a FITS file to an ASCII format. More... | |
The program fitsImg2Asc converts the image in the primary HDU of a FITS file to an ASCII format.
void usage | ( | char * | argv0 | ) |
Print a usage syntax message detailing the command line.
[in] | argv0 | The name of the main program. |
int main | ( | int | argc, |
char * | argv[] | ||
) |
The program fitsImg2Asc converts the image in the primary HDU of a FITS file to an ASCII format.
The input file is an image in the FITS file, of which only the first slice is taken if this is a FITS cube.
3D view The standard syntax is
fitsImg2Asc fitsIn.fits > fitsout.plt
or
fitsImg2Asc -r '[xstrt:xend,ystrt:yend]' fitsIn.fits > fitsout.plt
which means that the command line argument is the name of the FITS file with the image, and the output is redirected into some other file. This output file will be roughly a factor of 4 larger than the input file, and the program will run slowlier than some people would expect. In almost all cases the field will be too crowded to get useful response times from gnuplot while rotating the image, so the option -r allows to take only a rectangular subarea of the image, where the 4 arguments are 0-based ranges for the two pixel axes.
The output contains lines with three values, which is the x coordinate of the pixel, the y coordinate of the pixel, and the value in the image at this pixel.
This ASCII file has been targeted for use with a gnuplot(1) session e.g. like: gnuplot gnuplot> set xlabel "x pixel" gnuplot> set ylabel "y pixel" gnuplot> set zlabel "adu" gnuplot> splot "...." wi li # insert the fitsout.plt file data name here gnuplot> set grid gnuplot> set contour base gnuplot> replot gnuplot> set logscale z gnuplot> replot
Example: fitsImg2Asc -r '[200:800,1200:1800]' fitsIn.fits > fitsout.plt
Histogram The syntax to generate a gnuplot X11 window or EPS file with a histogram of pixel ADU values is triggered by the -h option as follows:
fitsImg2Asc -h [-l] [-N bins] [-m min] [-M max] [-a [xmin:xmax,ymin:ymax]] [-o fitsout.eps] fitsIn.fits [fitsIn.fits ... ]
The option -N followed by a positive integer number can be used to specify the number of bins to be generated. If not provided, the program uses a default.
The option -m followed by a number is the minimum number on the horizontal axis which delimits the range of ADU's to be shown.
The option -M followed by a number is the maximum number on the horizontal axis which delimits the range of ADU's to be shown.
The option -l means a logarithmic scale is used on the vertical axis.
The option -a followed by four positive integer numbers in brackets selects a quadrangular region (of FITS coordinates) in the image to be scanned. The default is to scan all pixels in the image.
The option -o followed by a file name causes the plot to be moved to a EPS file, not to the screen.
The option -t followed by a file name causes the histogram to be dumped into the named ASCII file.
The other command line arguments are existing fits files which will be read. The gnuplot display shows the count of pixels on a per-file basis which fall into a range of ADU's. There are two variants of showing the result, one with a logarithmic scale for the counts in the bins, one with a linear scale.
Example (which uses the shell's expansion mechanism of file names):
fitsImg2Asc -h -m 0 -M 200 aa000[1-8].fits fitsImg2Asc -h -m '-50' -M 50 -N 100 -a '[5:2044,5:2044]' aa000[1-8].fits
Example (which shows the selection mechanism of moving to a named extension HDU to locate the image):
fitsImg2Asc -h -m '-50' -M 50 -N 100 -a '[5:2044,5:2044]' aa0001.fits'[WIN1]'
Bad pixel mask The syntax to generate a bad pixel mask is:
fitsImg2Asc -b [-a '[xstrt:xend,ystrt:yend]'] [-t textout] [-X] [-Y] -m minADU -M maxADU fitsIn.fits fitsOut.fits
The mask is defined by investigating the 2D image provided in the input file fitsIn.fits and writing the bad pixel mask to fitsOut.fits.
The option -a defines a subwindow of pixel ranges to be scanned for out-of-range values. The pixels inside the original window but outside that internal window are a frame which is also regarded of containing only bad pixels. So usually for a single Hawaii-2 RG image one would declare the 4-pixel frame to be bad with -a '[5:2044,5:2044]' .
The option -t followed by the name of a file lets the program generate that file where the bad pixels are listed (one by a line) with their 1-based integer x and y coordinates. (This is also the convention of the fixpix routine of the IRAF reduction. It does not produce the generalized format with four parameters equivalent to xstrt, xend, ystrt, yend to define bad pixel blocks.)
The option -X and similarly the option -Y trigger that the bad pixel mask is generated after flipping the image of fitsIn.fits left-right along x or up-down along y. This helps to generate the mask for images that had another WCS orientation convention than the images the bad pixel mask will be generated for.
The option -m (quasi mandatory) defines the minimum ADU value and the option -M (quasi mandatory) defines the maximum ADU value of pixels in fitsIn.fits supposed to be good.
The option -i causes the bad pixel mask to be written with values of 0 for good pixels and values of 1 for bad pixels (as in some IRAF conventions). The default (without the option) is to write 1's for good values and NaN for bad values, so it could be used for multiplicative application for generic pictures.
The two final arguments are the file names of the input image and of the bad pixel image to be created.
[in] | argc | The number of command line switches and arguments. |
[in] | argv | The vector of all command line arguments. |