unblank_wmap (version 0.0)
You can also look at:
#! /usr/bin/perl -w
use strict;
##############################################################################
#
# SYNTAX: unblank_wmap filename
#
# DESCRIPTION: This utility is a workaround for the FTOOLS 5.0 version of the
# DESCRIPTION: extractor. This version of the extractor creates spectra
# DESCRIPTION: with floating point (BITPIX=-32) WMAPS, but it includes
# DESCRIPTION: the keyword BLANK = -1 in the header. This causes the
# DESCRIPTION: spectra to fail fverify. This script deletes the BLANK
# DESCRIPTION: keyword from the primary header of a specified file if
# DESCRIPTION: BITPIX < 0
#
#
# VERSION: 0.0
#
##############################################################################
my $file=shift;
my $UTIL=$ENV{UTIL};
my $FTOOL=$ENV{FTOOL};
##################################
# read the BITPIX keyword
##################################
my $bitpix=`$UTIL/read_fits_keyword $file\[0\] BITPIX`;
chomp($bitpix);
if($bitpix < 0 ) {
##############################################
# floating point WMAP - need to remove BLANK
# keyword if it exists
##############################################
my $exists=`$UTIL/keyword_exists $file\[0\] BLANK`;
if($exists =~ /yes/) {
system("$UTIL/log_entry \"Deleting BLANK keyword from $file\"");
my $template="wmap_cludge_template.tmp";
unlink $template;
open TEMPLATE, ">$template";
print TEMPLATE "-BLANK\n";
close TEMPLATE;
system("$UTIL/setup_parfile $FTOOL/fmodhead.par infile=$file\[0\] \\
tmpfil=$template" );
system("$FTOOL/fmodhead >stdout.log 2>stderr.log");
system("$UTIL/ftool_test fmodhead $? $0 2 stdout.log stderr.log");
unlink $template;
} else {
############################################################
# there isn't a BLANK keyword in the primary header anyway
############################################################
system("$UTIL/log_entry \"no BLANK keyword to delete from $file\"");
}
}
exit(0);