remove_fits_kwords

Delete FITS header cards with keywords listed in an input list. Such a list can be created with fitskw.

% remove_fits_kwords a.fits list.1 
BEWARE: The a.fits image is overwritten. 
Usage: remove_fits_kwords a.fits list.1 
arg1 = FITS image to be treated
arg2 = keywords to remove

Later I wanted a way to run this script on a list of FITS files. A simple script for this is:

 
% remove_fitslist_kwords List.Local my_bad_cards

Usage: remove_fitslist_kwords list.files Bad_Keywords 
arg1 = list of FITS images to be treated
arg2 = file of keywords to remove
In thsi case, the list of FITS files in in Local.List and my list of bad keywords is in "my_bad_cards".


A good example.

The early ACAM images often have lots of header cards that are best removed. Below I show a simple sequence for this, with the last step being a run of remove_fits_kwords:

 

Image = 20150827T090729.2_acm_sci.fits

% imhead 20150827T090729.2_acm_sci.fits
SIMPLE  =                    T
BITPIX  =                  -32
NAXIS   =                    2
NAXIS1  =                  775
NAXIS2  =                  771
EXTEND  =                    T
DATE    = '2015-08-27T09:07:29' / date and time of writing file
ORIGIN  = 'LTL FITS IO class, September 2010' / FITS file originator
EXPTIME =                    5
CCDTEMP =                  -30
TARGTEMP=                  -30
CYCLETIM=                    1
COADDED =                    1
NFLUSHES=                    0
HWSUM   = '1 1     '
SWSUM   = '4 4     '
CCDSUM  = '4 4     '
CCDSIZE = '[1:3103, 1:3086]'
HWSEC   = '[1:3103, 1:3086]'
CCDSEC  = '[1:3103, 1:3086]'
DATASEC = '[1:775, 1:771]'
BIASSEC = '[1:775, 1:771]'
PIXSCALE=    0.271186440677966
END

Next, I make a list of the keywords, then I edit out the 
keyword values that I DO NOT WANT removed:

% fitskw.sh 20150827T090729.2_acm_sci.fits > bad.keys 
% vi bad.keys 

Finally, I remove the offending cards with these keywords. 
% remove_fits_kwords 20150827T090729.2_acm_sci.fits bad.keys 

% imhead 20150827T090729.2_acm_sci.fits
SIMPLE  =                    T
BITPIX  =                  -32
NAXIS   =                    2
NAXIS1  =                  775
NAXIS2  =                  771
EXTEND  =                    T
DATE    = '2015-08-27T09:07:29' / date and time of writing file
ORIGIN  = 'LTL FITS IO class, September 2010' / FITS file originator
EXPTIME =                    5
END

Now most of the bullshit stuff is removed!




Back to SCO CODES page