File Coverage

blib/lib/Astro/FITS/HdrTrans/RxH3.pm
Criterion Covered Total %
statement 16 25 64.0
branch 4 12 33.3
condition 2 9 22.2
subroutine 5 6 83.3
pod 3 3 100.0
total 30 55 54.5


line stmt bran cond sub pod time code
1             =head1 NAME
2              
3             Astro::FITS::HdrTrans::RxH3 - translation class for RxH3
4              
5             =cut
6              
7             package Astro::FITS::HdrTrans::RxH3;
8              
9 10     10   4682833 use warnings;
  10         34  
  10         442  
10 10     10   61 use strict;
  10         32  
  10         473  
11              
12             our $VERSION = '1.64';
13              
14 10     10   58 use base qw/Astro::FITS::HdrTrans::JCMT/;
  10         19  
  10         4565  
15              
16             my %CONST_MAP = (
17             DR_RECIPE => 'REDUCE_HOLOGRAPHY',
18             );
19              
20             my %UNIT_MAP = (
21             OBSERVATION_MODE => 'OBS_TYPE',
22             REST_FREQUENCY => 'FREQBAND',
23             NUMBER_OF_FREQUENCIES => 'NFREQ',
24             );
25              
26             __PACKAGE__->_generate_lookup_methods(\%CONST_MAP, \%UNIT_MAP);
27              
28             =head1 METHODS
29              
30             =over 4
31              
32             =item B<this_instrument>
33              
34             Returns "RxH3".
35              
36             =cut
37              
38             sub this_instrument {
39 20     20 1 58 return 'RxH3';
40             }
41              
42             =item B<can_translate>
43              
44             Older RxH3 data files lack an INSTRUME header, so look for other
45             headers also.
46              
47             =cut
48              
49             sub can_translate {
50 20     20 1 59 my $self = shift;
51 20         50 my $headers = shift;
52              
53 20 50       122 return 1 if $self->SUPER::can_translate($headers);
54              
55 20         56 my $freqfile = undef;
56              
57 20 50 33     93 if (exists $headers->{'FREQFILE'}) {
    50          
58 0         0 $freqfile = $headers->{'FREQFILE'};
59             }
60             elsif (exists $headers->{'SUBHEADERS'} &&
61             exists $headers->{'SUBHEADERS'}->[0]->{'FREQFILE'}) {
62 0         0 $freqfile = $headers->{'SUBHEADERS'}->[0]->{'FREQFILE'};
63             }
64              
65 20 50 33     689 return (defined $freqfile and $freqfile =~ /\/rxh3/) ? 1 : 0;
66             }
67              
68             =item B<to_UTSTART>
69              
70             Older RxH3 data only has a "DATE" header (the date the FITS file was created),
71             so fall back to this if we don't get a value from the standard header ("DATE-OBS").
72              
73             =cut
74              
75             sub to_UTSTART {
76 0     0 1   my $self = shift;
77 0           my $headers = shift;
78              
79 0           my $utstart = $self->SUPER::to_UTSTART($headers);
80              
81 0 0         unless (defined $utstart) {
82 0 0 0       if ((exists $headers->{'DATE'}) and (defined $headers->{'DATE'})) {
83 0           $utstart = $self->_parse_iso_date($headers->{'DATE'});
84             }
85             }
86              
87 0           return $utstart;
88             }
89              
90             1;
91              
92             =back
93              
94             =head1 COPYRIGHT
95              
96             Copyright (C) 2018 East Asian Observatory
97             All Rights Reserved.
98              
99             This program is free software; you can redistribute it and/or modify it under
100             the terms of the GNU General Public License as published by the Free Software
101             Foundation; either version 2 of the License, or (at your option) any later
102             version.
103              
104             This program is distributed in the hope that it will be useful,but WITHOUT ANY
105             WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
106             PARTICULAR PURPOSE. See the GNU General Public License for more details.
107              
108             You should have received a copy of the GNU General Public License along with
109             this program; if not, write to the Free Software Foundation, Inc.,51 Franklin
110             Street, Fifth Floor, Boston, MA 02110-1301, USA
111              
112             =cut