package Subs::XRTProducts; ############################################################################## # # DESCRIPTION: Run xrtproducts on level 2 files # # HISTORY: # HISTORY: $Log: XRTProducts.pm,v $ # HISTORY: Revision 1.2 2005/10/04 14:14:43 apsop # HISTORY: Use parameter value CALDB when invoking xrtproducts. # HISTORY: # HISTORY: Revision 1.1 2004/08/27 18:56:00 apsop # HISTORY: Runs xrtproducts tool to make level 3 XRT products. # HISTORY: # # VERSION: 0.0 # # ############################################################################## use Subs::Sub; @ISA = ("Subs::Sub"); use strict; sub new { my $proto=shift; my $self=$proto->SUPER::new(); $self->{DESCRIPTION}="Generating XRT products"; return $self; } ################## # METHODS: ################## sub body { my $self = shift; $self->make_image_products; $self->make_event_products; } sub make_image_products { my $self = shift; my $log = $self->log(); my $filename= $self->filename(); my $procpar = $self->procpar(); my $jobpar = $self->jobpar(); $log->entry("making image products"); foreach my $skyFile ($filename->get('skyimage', 'xrt', 'im', '*')) { my $producer = Util::HEAdas->new('xrtproducts') ->params({ outdir => '.', display => 'no', plotdevice => 'gif', mode => 'im', }) ->is_script(1); $producer->params({ infile => $skyFile, }) ->run; undef($producer); } } # end of make_image_products method sub make_event_products { my $self = shift; my $log = $self->log(); my $filename= $self->filename(); my $procpar = $self->procpar(); my $jobpar = $self->jobpar(); $log->entry("making event products"); foreach my $evtFile ($filename->get('event', 'xrt', '*', '*')) { my (undef, $mode) = $filename->parse($evtFile, 'event'); my $mo = substr($mode, 0, 2); print "producing $evtFile [$mode, $mo]\n"; my $producer = Util::HEAdas->new('xrtproducts') ->params({ outdir => '.', plotdevice => 'gif', }) ->is_script(1); # mode specific parameters my @par; if ($mo eq 'pc') { push(@par, rmffile => 'CALDB', # imagefile => "swx$mode.imx", ra => $jobpar->read('burst_ra'), dec => $jobpar->read('burst_dec'), transmfile => 'CALDB', radius => 20, ); } elsif ($mo eq 'wt') { push(@par, binsize => 1, rmffile => 'CALDB', # imagefile => "swx$mode.imx", width => 40, height => 10, roll => $jobpar->read('roll'), ra => $jobpar->read('burst_ra'), dec => $jobpar->read('burst_dec'), transmfile => 'CALDB', ); } elsif ($mo eq 'lr' or $mo eq 'pu') { push(@par, binsize => 1, rmffile => 'CALDB', transmfile => 'CALDB', ); } # common parameters push(@par, lcfile => $filename->get('lightcurve', 'xrt', $mo), phafile => $filename->get('spectrum', 'xrt', $mo), arffile => 'CALDB', # lcfile => 'DEFAULT', # sw00073213001xwtwnposr.lc # phafile => 'DEFAULT', # sw00073213001xwtwnposr.pha # arffile => 'DEFAULT', # sw00073213001xwtwnposr.arf mirfile => 'CALDB', psffile => 'CALDB', vigfile => 'CALDB', psfflag => 'yes', ); $producer->params({ infile => $evtFile, mode => $mo, @par, }) ->run; undef($producer); qx(rm -rf ximage.hty xselect.hty defaults.def .xspec); } } # end of make_event_products method