package Subs::SW0Header;
##############################################################################
#
# DESCRIPTION: This module creates the *psu.html header page.
# ISA Subs::Header.
#
# HISTORY: $Log: SW0Header.pm,v $
# HISTORY: Revision 1.11 2014/02/27 09:44:48 apsop
# HISTORY: Added sdc_hea_patches item. Fixed the xrt2fits, bat2fits,
# HISTORY: uvot2fits version items.
# HISTORY:
# HISTORY: Revision 1.10 2008/05/16 14:28:10 apsop
# HISTORY: Add a good attitude fraction to the header.
# HISTORY:
# HISTORY: Revision 1.9 2005/09/28 17:36:12 apsop
# HISTORY: Write processing time into summary file.
# HISTORY:
# HISTORY: Revision 1.8 2005/09/26 21:12:16 apsop
# HISTORY: Set the production date as well as the production time.
# HISTORY:
# HISTORY: Revision 1.7 2004/05/06 20:02:34 dah
# HISTORY: Add version number back into the header comments.
# HISTORY:
# HISTORY: Revision 1.6 2004/04/28 13:50:02 dah
# HISTORY: Fix attitude file instrument type.
# HISTORY:
# HISTORY: Revision 1.5 2004/04/16 20:21:18 dah
# HISTORY: Begin using embedded history records
# HISTORY:
#
# VERSION: $Revision: 1.11 $
#
##############################################################################
use Subs::Header;
use Subs::SwiftSub;
@ISA = ("Subs::Header");
use strict;
#########################
# constructor
#########################
sub new {
my $proto=shift;
my $self=$proto->SUPER::new(@_);
my $proctime= Util::Date->new();
$self->jobpar->set({procdate => $proctime->date(),
proctime => $proctime->time()});
return $self;
}
##################
# METHODS:
##################
sub body {
my $self=shift;
my $log =$self->log();
my $filename=$self->filename();
my $procpar =$self->procpar();
my $jobpar =$self->jobpar();
##########################
# observation information
##########################
$self->begin_section("Observation Information");
$self->item("Nominal Pointing", "(degrees)" );
$self->begin_list();
my $attitude = $filename->get('attitude', 's');
if( -f $attitude ) {
######################################################
# we have attitude data, so list the nominal pointing
######################################################
$self->item("R.A.=",$jobpar->read("ra" ,0.001),
"Dec.=",$jobpar->read("dec",0.001) );
$self->item("Lii=",$jobpar->read("glon",0.001),
"Bii=",$jobpar->read("glat",0.001) );
} else {
############################
# no attitude data
############################
$self->item("No attitude data available");
}
$self->end_list();
$self->item("Observation Date:",
Util::Date->new($jobpar->read("obsdate"))->in_words(),
"Time:", $jobpar->read("obstime") );
my $good_att =
Subs::SwiftSub::good_attitude_fraction($self, $jobpar->read('tstart'), $jobpar->read('tstop'));
$self->item("Good Attitude Fraction:", sprintf("%.2f", $good_att));
$self->end_section();
##########################
# processing information
##########################
$self->begin_section("Processing Information");
$self->item("Processing Date: ",
Util::Date->new($jobpar->read("procdate"))->in_words(),
"Time:", $jobpar->read("proctime") );
$self->item("Version of Data: ", $jobpar->read("seqprocnum") );
$self->item("Processing Script Version: ", $jobpar->read("procscriptver"));
$self->item("FTOOLS Version: ", Util::Ftool->version() );
$self->item("HEAsoft Version: ", Util::HEAdas->version() );
$self->item("SDC patches to HEAsoft: ",
$procpar->read("sdc_hea_patches") );
################
# xrt2fits
################
my $xrt2fits = $procpar->read("xrt2fits");
$xrt2fits =~ s/^.*XRT2FITS\///i;
$self->item("XRT2FITS Version: ", $xrt2fits);
################
# bat2fits
################
my $bat2fits = $procpar->read("bat2fits");
$bat2fits =~ s/^.*BAT2FITS\///i;
$self->item("BAT2FITS Version: ", $bat2fits);
################
# uvot2fits
################
my $uvot2fits = $procpar->read("uvot2fits");
$uvot2fits =~ s/^.*UVOT2FITS\///i;
$self->item("UVOT2FITS Version: ", $uvot2fits);
$self->end_section();
} # end of body method
###################################################################
# generate the links to other pages which are found at the top of the page.
# Sub-classes should override this method to add more links.
###################################################################
sub link_text {
my $self = shift;
$self->SUPER::link_text();
my $url;
my $filename=$self->filename();
my $text=$self->SUPER::link_text();
$url=$filename->get("report", "uvot");
$text .= "<LI><A HREF=\"$url\">UVOT exposure report</A>\n";
$url=$filename->get("report", "xrt");
$text .= "<LI><A HREF=\"$url\">XRT exposure report</A>\n";
$url=$filename->get("report", "bat");
$text .= "<LI><A HREF=\"$url\">BAT exposure report</A>\n";
return $text;
} # end of link_text method