Fits_tools is a collection of simple tasks of transformation of the geometry and intensity scale of a spectral cube or a 2-D image in a basic FITS file. The program uses the Dislin graphic library (https://www.dislin.de) for the graphical interface.
An output 3-axes FITS file is produced for most transformations. The output file has a version number added at the end of the input file name and used as input for the next transformation. For a file <file>.fits, the output file is <file>_1.fits. In general, when performing a chain of transformations, a set of output files <file>_1.fits, <file>_2.fits, . . . , <file>_n.fits are produced. At each step the header table shows the header of the last file.
Table cells with white background are editable. Cells with light-gray background show values that are not editable
Linux system,
Dislin graphic library (https://www.dislin.de),
Fortran 90 compiler (gfortran is assumed).
The distribution file fits_tools.tgz contains the following files:
fits_tools.f90
fits_tools_help.txt
fits_tools_README
dislin.mod
Download the distribution file fits_tools.tgz in the installation directory you like (for example $HOME/fits), untar the file and compile the source file:
$ tar -xzvf fits_tools.tgz
$ gfortran fits_tools.f90 -o fits_tools -l dislin
Additionally, if you want to be able to run fits_tools from any location in your computer, you have to define the environment variable FITS_DIR pointing to your installation directory, and the external editor of preference. This can be done by adding to your .bashrc file the lines
#fits_tools
export FITS_DIR=$HOME/fits
export EDITOR=kate
and making a symbolic link to fits_tools from a directory in your path (for example $HOME/bin)
$ cd $HOME/bin
$ ln -s $HOME/fits/fits_tools .
$ fits_tools
The command opens the dislin widgets window (see below). The following transformations and extractions are possible:
FITS FILE
Read FITS file: Reads a FITS file with up to 3 non-degenerate axes. The frequency or velocity axis does not need to be the 3rd axis. The relevant header parameters are shown in the table.
Display header: Displays the full FITS header.
Edit header: The header can be edited in an external editor. The editor application used is given by the environment variable EDITOR, and if not set, defaults to nano.
SWAP AXES: The pair of axes selected is swapped.
INVERT AN AXIS: The axis selected is inverted. The reference pixel and value, CRPIXn and CRVALn, are preserved.
IMAGE (X, Y) ROTATION: The image is rotated the selected angle (CCW) around the selected center for all the channels.
SUBIMAGE EXTRACTION: For each axis a sampling is made from the selected first to last pixel, with the selected step.
SMOOTHING: (X, Y) BOXCAR, CHANNEL HANNING: A circular boxcar smoothing with the selected radius and a Hanning spectral smoothing with the selected half-width (1 for the standard 3-pt Hanning) is performed. The number of (x, y) pixels and channels is not changed.
SINGLE CHANNEL MAP: The output is a 2-axes FITS file with the selected channel map.
MOMENT 0 MAP: The sum of all channels, that is, the moment 0, is written to a 2-axes FITS file.
SINGLE PIXEL SPECTRA: The spectra at the selected pixels (first, last, step) for the x and y axes are written to a set of ASCII files spectrum_<xpix>_<ypix>.dat.
AVERAGE SPECTRUM: The spectrum averaged for all pixels is written to the ASCII file spectrum_avg.dat.
SWITCH FREQUENCY TO/FROM VELOCITY: Change the spectral axis scale from frequency to velocity or vice versa. The two parameters ALTRPIX, ALTRVAL, if present, are used for the transformation. If not, the RESTFREQ parameter, or the value introduced in the table is used. The CTYPE3 parameter is changed accordingly.
CHANGE SCALE JY/BEAM TO/FROM K: Change the intensity scale from Jy/beam to K or vice versa. The parameters BMAJ, BMIN, RESTFREQ, or the values introduced in the table are used for the transformation. The BUNIT parameter is changed accordingly. The scale factor, Jy/beam per K, is shown in the table.
LINEAR CHANGE OF SCALE: Change the intensity to Output= A*Input+B with the selected values of A and B.
PRIMARY BEAM CORRECTION: Apply the primary beam correction for a Gaussian beam centered on the selected position and with the selected FWHM.