gethead Examples

1. Print Usage Instructions

Print basic instructions for use of this program by typing only the program name.
$ gethead
GETHEAD WCSTools 3.8.8, 22 February 2013, Jessica Mink (jmink@cfa.harvard.edu)
Print FITS or IRAF header keyword values
Usage: gethead [-abhoptv][-d dir][-f num][-m num][-n num] file1.fit ...
filen.fits kw1 kw2 ... kwn
  or : gethead [-abhoptv][-d dir][-f num][-m num][-n num] @filelist kw1
  kw2 ... kwn
  or : gethead [-abhoptv][-d dir][-f num][-m num][-n num] file1.fit ...
  filen.fits @keywordlist
  or : gethead [-abhoptv][-d dir][-f num][-m num][-n num] @filelist
  @keywordlist
  -a: List file even if keywords are not found or null
  -b: Replace blanks in strings with underscores
  -c: Read all files as plain ASCII
  -d dir: Root directory for input files (default is cwd)
  -e: Output keyword=value's on one line per file
  -f: Never print filenames (default is print if >1)
  -g: Output keyword=value's on one line per keyword
  -h: Print column headings
  -j: Print output ra and dec in J2000
  -m num: Change maximum length of IRAF multi-line value
  -n num: Number of decimal places in numeric output
  -o: OR conditions instead of ANDing them
  -p: Print full pathnames of files
  -s: Do not pad tab-separated table with spaces
  -t: Output in tab-separated table format
  -u: Always print ___ if keyword not found or null value
  -v: Verbose
  -x [range]: Read header for these extensions (no arg=all)
$

2. Single File, Verbose Mode

Print the right ascension and declination of a FITS image from its RA and DEC header parameters in verbose mode.
$ gethead -v test.fts ra dec
GETHEAD WCSTools 3.8.8, 22 February 2013, Jessica Mink
(jmink@cfa.harvard.edu)
Print Header Parameter Values from FITS image file test.fts
RA = 09:51:19.450
DEC = +69:15:26.420

3. Multiple parameters from multiple FITS and IRAF files

Get the values of the EPOCH and EQUINOX header parameters from all of the FITS and IRAF files in a directory and print the parameter names used at the top of each column:
$ gethead -h epoch equinox *imh *fits
FILENAME                   EPOCH EQUINOX
0011moon.fits.0001.imh     2000 ___
0011test1.fits.0001.imh    2000 ___
Bdemoobj2.imh              1991.9 ___
Bdemoobj2x.imh             1991.9 ___
cb27.ms.imh                1950 ___
f86btemp1.imh              2000.0 ___
mstar396.imh               1950 ___
0011.MoonBrightSideTF.fits 2000 ___
0011sky.fits               2000 ___
0011test.fits              2000 ___
0084.H072946.fits          2000.0 ___
0104.H096050.fits          2000.0 ___
0114.HIC050807.fits        2000.0 ___
0119.TTSORIm79.fits        2000.0 ___
HR79_Ca19z.fits            2000 2000.0000
mstar396.fits              1950 ___
$

4. Multiple parameters from list of FITS and IRAF files

Get the image sizes from the NAXIS, NAXIS1, and NAXIS2 header keywords from a list of FITS and IRAF files, printing the output in tab table format:
$ gethead -th @fits.list naxis naxis1 naxis2
FILENAME        NAXIS   NAXIS1  NAXIS2
--------        -----   ------  ------
0083.19083010-0706459.fits      2       2720    161
hiptest.fits    2       600     600
test.fits       2       2720    161
test_fabien.fits        2       2080    2048
testbin.fits    2       765     510
testbinf.fits   2       680     450
testbinfg10x10.fits     2       765     510
testbinfg20x20.fits     2       765     510
testbinfg40x40.fits     2       680     450
webccd-1.fits   2       680     450
webccd-2.fits   2       765     510
$

5. Reading keywords from a compressed FITS image file

Extract the DATE and DATE-OBS keyword values from a gzipped FITS file in verbose mode so that the keyword names are listed. This illustrates the use of the stdin filename to accept input from standard input.
$ gzcat newdate.fits.gz | gethead -v stdin date date-obs
GETHEAD WCSTools 3.8.8, 22 February 2013, Jessica Mink
(jmink@cfa.harvard.edu)
Print Header Parameter Values from FITS image file stdin
DATE = 1997-07-25
DATE-OBS = 1979-09-19
$

6. Reading keyword values from an IRAF multi-line WCS keyword

Extract the reference pixel wavelength and increment from an IRAF multispec FITS file.
FITS header excerpt:
WAT2_268= '= "234 234 0 5144.7115085913 0.034289344511465 4601 0. 3945.80 3955.'
WAT2_269= '80" spec235 = "235 235 0 5143.4521120694 0.034276524124504 4601 0. 3'
WAT2_270= '960.20 3970.20" spec236 = "236 236 0 5144.578528625 0.03427612506272'
WAT2_271= ' 4601 0. 3978.13 3988.13" spec237 = "237 237 0 5143.3220898796 0.034'
WAT2_272= '267803931016 4601 0. 3993.14 4003.14" spec238 = "238 238 0 5144.4632'
WAT2_273= '360545 0.034263643405847 4601 0. 4010.83 4020.83" spec239 = "239 239'
WAT2_274= ' 0 5143.2032675292 0.034256420622552 4601 0. 4026.76 4036.76" spec24'
WAT2_275= '0 = "240 240 0 5144.3196988462 0.034251911470459 4601 0. 4044.35 405'
WAT2_276= '4.35"   '
$ gethead test.ms.fits wat2:spec238,4 wat2:spec238,5
5144.4632360545 0.034263643405847
$

Last updated 19 May 2014 by Jessica Mink

Telescope Data Center [WCSTools] [WCSTools programs] [gethead]