Swiss army knife for listing and editing values or informations included in FITS files.
Usage: munipack fits [-k] [-t] [-i] [-K <str>] [--short] [file] -k, --header list header -t, --table list table -i, --image list image -K, --keys=key[,key,..] print selected header keyword(s) --short print header keywords in short form
The functionality is activated when fits key is passed as an argument.
Any FITS file may by composited from multiple parts (HDUs) of three types: dummy, image or table. Every HDU must contain header with some parameters (dimensions, spectral bands, …). Multiple HDUs are used for storing of related informations. As an example, Munipack adds a table with photometrical results to processed images.
The structure of a FITS file is listed when no arguments are used:
$ munipack fits spln.fits # EXTNAME TYPE BITPIX SIZE 1 IMAGE -32 200x200x4 2 'u5ct.c0h.tab' ASCII_TBL 4x49
In this example, the FITS file consist from two parts (HDU). The unnamed first is an 3D image 200x200x4 pixels and the second is an table. The image can be accessed as spln.fits[0] and the table as spln.fits[1].
Every HDU contains parameters carrying additional informations about any included data. The mandatory parameters specifying dimensions of image or table and data representation must be included in any case. Other optional parameters gives time, exposure conditions, band specifications for images. Table headers must include standardized descriptions of columns. Frequently headers contains some calibration data as the astrometrical data. A set of commonly used optional parameters is differently used by various astronomical communities.
The argument -k (or --header) switch-on listing of full header.
$ munipack fits -k spln.fits SIMPLE = T / file does conform to FITS standard BITPIX = -32 / number of bits per data pixel NAXIS = 3 / number of data axes NAXIS1 = 200 / length of data axis 1 ...
These records are directly copied-out from FITS header without any formatting. Comments are included.
The selected key(s) may be listed by using of -K (or --keys) argument.
$ munipack fits -K NAXIS1,NAXIS2 spln.fits NAXIS1 = 200 / length of data axis 1 NAXIS2 = 300 / length of data axis 2
There is also possibility to print a record in a machine targeted processing format of type KEYWORD = VALUE. To activate of the mode, use the switch --short:
$ munipack fits -K NAXIS --short spln.fits NAXIS = 3
The argument -i (or --image) switch-on listing of intensity values contained in an image.
The output listing is in the format: indexes in all axes followed by a value itself:
i1 i2 i3 ... value
Use of extended filename syntax is recommended. See the example:
$ munipack -i fits spln.fits 1 1 321 2 1 310 ...
The argument -t (or --table) switch-on listing of values contained in a table.
Use of extended filename syntax is recommended. See the example:
$ munipack -t fits spln.fits B 330.460300000000 42.0238720000000 S ...
The syntax is commonly used for selecting of an embedded part of FITS file or a certain part of an image or a table. The extended filenames contains brace index selector in addition to usual file names. Ones considerably benefits from FITS file extended syntax.
Important note: The extended syntax infers with shell syntax. Therefore it is recommended to enclose extended filenames in apostrophes.
The second part of a FITS file (indexed from zero) will be selected as
$ munipack -k = fits 'spln.fits[1]' XTENSION= 'TABLE ' / Ascii table extension BITPIX = 8 / 8-bits per 'pixels' NAXIS = 2 / Simple 2-D matrix NAXIS1 = 796 / Number of characters per ...
A sub-image of a whole image can be got as
$ munipack -i fits 'spln.fits[666:676,100:103]' 1 1 321 2 1 310 ...
Analogically only selected column of a table named MAG will be listed:
$ munipack -t fits 'spln.fits[MAG]' 12.335 12.339 ...
The fits action gives a good support for usage in shell scripts and other machine processing tools.
The simple usage of the action for listing of some parameters from all FITS files in a directory shows following example.
bash$ for A in *.fits; do \
B=$(munipack fits --short -K DATE-OBS,FILTER "$A[0]" | \
awk -F "=" { printf "%s ", $2;}'); \
echo $A $B;
done
...
hp29716_48R.fits '2011-02-07T20:50:18.822' 'R '
hp29716_49R.fits '2011-02-07T20:51:36.610' 'R '
hp29716_50R.fits '2011-02-07T20:52:54.345' 'R '
hp29716_51R.fits '2011-02-07T20:54:11.962' 'R '
hp29716_52R.fits '2011-02-07T20:55:29.588' 'R '
...
Copyright © 1997-2011, F. Hroch (✉, Blog⤴), DTFA, Masaryk University.