package Util::BATCave; ############################################################################## # # DESCRIPTION: Utilities for BAT pipeline processing # # # HISTORY: $Log: BATCave.pm,v $ # HISTORY: Revision 1.4 2004/11/10 17:59:43 apsop # HISTORY: Comment out get_bayes, as it is not used, and used SimpleFITS. # HISTORY: # HISTORY: Revision 1.3 2004/11/09 22:22:29 apsop # HISTORY: Corrected name of peak GTI. # HISTORY: # HISTORY: Revision 1.2 2004/11/09 22:03:53 apsop # HISTORY: All GTIs now collected in a single file. # HISTORY: # HISTORY: Revision 1.1 2004/11/09 19:07:31 apsop # HISTORY: Adding BAT pipeline support modules. # HISTORY: # # VERSION: $Revision: 1.4 $ # # ############################################################################## use strict; sub chan1 { return '15-350'; # keV } sub chan4 { return '15-25,25-50,50-100,100-350'; # keV } sub get_gti { my ($self, $type) = @_; my $log = $self->log; my $filename = $self->filename; my $procpar = $self->procpar; my $jobpar = $self->jobpar; if ($type eq 'NONE') { return 'NONE'; } my $gti = undef; my $gtifile = $filename->get('gti', 'bat'); if (not $gtifile or not -f $gtifile) { $log->error(1, "missing BAT GTI file"); } elsif ($type eq 'GTI_TOT' or $type eq 'GTI_PEAK' or $type eq 'GTI_T90' or $type eq 'GTI_T50' or $type eq 'GTI_BKG1' or $type eq 'GTI_BKG2' or $type eq 'GTI_BAYES') { $gti = $gtifile . "[$type]"; } else { $log->error(1, "invalid BAT GTI type requested [$type]"); } if (not $gti) { $log->error(2, "unable to locate BAT $type GTI"); } return $gti; } ## sub get_bayes ## { ## my ($self, $key) = @_; ## ## my $log = $self->log; ## my $filename = $self->filename; ## my $jobpar = $self->jobpar; ## ## my $gti_bayes = get_gti($self, 'GTI_BAYES'); ## ## my $value = undef; ## ## my $status = Util::SimpleFITS->open("<$gti_bayes") ## ->readkey($key => $value) ## ->close ## ->status; ## ## if ($status) { ## $log->error(2, "unable to determine BAT Bayes $key [$status]"); ## } ## ## return $value; ## } sub get_tdrss_ack { my ($self) = @_; my $log = $self->log; my $filename = $self->filename; my $ack = undef; my @acks = $filename->get('tdmess', 'bat', 'ce', '*'); if (@acks) { my $root = $filename->sequence_specific; my @filtered = grep /$root/, @acks; $ack = $filtered[0]; } if (not $ack) { $log->error(1, 'no BAT TDRSS centroid message'); } return $ack; } 1;